[Solved] Blockchain-Homework 6

$25

File Name: Blockchain-Homework_6.zip
File Size: 197.82 KB

SKU: [Solved] Blockchain-Homework 6 Category: Tag:
5/5 - (1 vote)
  1. Set the hw6.WalletInit.WALLETS_DIR constant to a directory that stores all the wallets.
  2. Run the hw6.WalletInitTest class to ensure that you have enough testnet coins left from the previous homework. If you dont then, use the testnet faucet to get some.
  3. Read and understand the ScriptTester abstract class, and the PayToPubKey subclass. The ScriptTester.run method creates two transactions to test the locking/unlocking scripts created in the PayToPubKey class. Give a detailed explanation on how ScriptTester.run works. Run the PayToPubKey subclass and give the two transaction IDs that it generates as your solution to question 3 in your hw6solutions.txt file. You must ensure that both transactions are confirmed by the network. You may need to run it a few times if they are not confirmed the first time. Use https://www.blocktrail.com/tBTC block chain explorer to find your transactions and check that your pay-to-public-key script appears in the transaction output of the first transaction.

Note:

If you are having difficulty getting your transactions confirmed on testnet, first read the following article to understand why its happening:

https://www.dash.org/forum/threads/frozentransactionswhyithappensandhowtofixit.1649/. One option is to submit the raw transaction bytes directly to a miner. You can use BitcoinJs

Transaction.bitcoinSerialize to generate a byte[] representation of your frozen transaction, convert it to hex using DatatypeConverter.printHexBinary, and submit the hex manually to bitcoin explorer for testnet (e.g. https://live.blockcypher.com/btctestnet/pushtx/).

  1. Implement the createLockingScript and createUnlockingScript methods in the PayToPubKeyHash class and run the class to test your pay-to-public-key-hash implementation. Submit the two transaction IDs that it generates as your solution to question 4 in your hw6solutions.txt file and also submit your PayToPubKeyHash class. You must ensure that both transactions are confirmed by the network. No credit will be given to unconfirmed transactions. You may need to run it a few times if they are not confirmed the first time. Use https://www.blocktrail.com/tBTC block chain explorer to find your transactions and check that your pay-topublic-key-hash script appears in the transaction output of the first transaction.
  2. Follow the same instructions in question 4, but for the MultiSigTransaction class. The locking script should lock the UTXO to a multisig script that is unlocked when exactly signature for one of the keys generated in the constructor (key1, key2, or key3) is provided in the unlocking script.
  3. Follow the same instructions in question 4, but for the GroupMultiSigTransaction class. The locking script should lock the UTXO to a multi-sig transaction involving four parties such that the transaction can be redeemed by the first party (bank) combined with any one of the 3 others (customers) but not by only the c ustomers or only the bank. Create and redeem the transaction and make sure that the script is as small as possible. You can use any legal combination of signatures to redeem the transaction but make sure that all combinations would have worked. The https://blocktrail.com/tBTC explorer wont show your script correctly. Instead try to use the https://testbitpay.com block explorer to make sure your scripts actually made it to the network.
  4. Read and understand the hw6.SendMoneyBackToFaucet class. It sends your testnet coins back to the faucet. Run the class and give the transaction ID used to send your balance back to the faucet in your hw6solutions.txt file.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Blockchain-Homework 6
$25