Skip to content

Instantly share code, notes, and snippets.

@troggy
Created June 24, 2014 21:39
Show Gist options
  • Save troggy/eb5f80e84ac3f8a2c85d to your computer and use it in GitHub Desktop.
Save troggy/eb5f80e84ac3f8a2c85d to your computer and use it in GitHub Desktop.
Testing bitcoinj P2SH support with WalletTool
# Create first wallet
$ wallet-tool --wallet=first --net=REGTEST create --seed="7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f"
# Create second wallet
$ wallet-tool --wallet=second --net=REGTEST create --seed="7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f00"
# Get xpub of the second wallet
$ wallet-tool --wallet=second --net=REGTEST dump
...omitted...
Key to watch: xpub682CUjTxQLabnDD22uFXnQj3yUCvnhT9ytnvuk94tEAWpYzktyeaSKWrT48cNYKcAxqSF3VA2TCWqNgRJXgQagUNdiW1S8b16CrBZKhKpbw
...omitted...
# Create "marriage" for the first wallet
$ wallet-tool --wallet=first --net=REGTEST marry --xpubkeys="xpub682CUjTxQLabnDD22uFXnQj3yUCvnhT9ytnvuk94tEAWpYzktyeaSKWrT48cNYKcAxqSF3VA2TCWqNgRJXgQagUNdiW1S8b16CrBZKhKpbw"
# Get address from the first wallet. I took the first one
$ wallet-tool --wallet=first --net=REGTEST dump
...omitted...
Following chain: xpub67tVq9TLPPoaGqhSmtxDdkmRLzM8eymfCyuYBuZNkh3S7KAQYobU66Js26PF6gsUmJg3nUg22GJaaduY691TXgVRuueqZ1rtiGhA89WnwD2
addr:2N912E16hgZECofuG3C8YtteTstfknH6Yaf hash160:acd25e9279e1e516ef5e12f570e6cf23f3ab5a2e
addr:2MuLaPDztfGvkEraCuifGGvScMGwpf2UxSX hash160:16f35b516733a4e8b93c6bbef9fb351f6194dc65
...omitted...
# Send some funds to it. I used another wallet which has some REGTEST coins
$ wallet-tool --wallet=regtest --net=REGTEST send --output="2N912E16hgZECofuG3C8YtteTstfknH6Yaf:1.0"
1706d075d5cb3671faeea035ddde40ab7a4a7becb60cebf0054e57b3c665de5a
# Sync till we get coins into the first wallet
$ wallet-tool --wallet=first --net=REGTEST sync --condition=">0" --waitfor=BALANCE
1.00
1.00
1.00
# Dump wallet contents
$ wallet-tool --wallet=first --net=REGTEST dump
Wallet containing 1 BTC (available: 0 BTC) in:
1 pending transactions
0 unspent transactions
0 spent transactions
0 dead transactions
Last seen best block: -1 (time unknown): null
Keys:
Seed as words: legal winner thank year wave sausage worth useful legal winner thank yellow
Seed as hex: 7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f
Seed birthday: 1381276800 [Wed Oct 09 04:00:00 MSK 2013]
Key to watch: xpub682fBDZFhy7Utpi4KnsBsigEivctN2htCX4MHUoeJecmQd36jLVk1TGVmLA9kjPK2nesCMYwiDBNFP2ueR3Qtp78hNzJsShhKcTFM5XbNGf
Following chain: xpub67tVq9TLPPoaGqhSmtxDdkmRLzM8eymfCyuYBuZNkh3S7KAQYobU66Js26PF6gsUmJg3nUg22GJaaduY691TXgVRuueqZ1rtiGhA89WnwD2
addr:2N912E16hgZECofuG3C8YtteTstfknH6Yaf hash160:acd25e9279e1e516ef5e12f570e6cf23f3ab5a2e
addr:2MuLaPDztfGvkEraCuifGGvScMGwpf2UxSX hash160:16f35b516733a4e8b93c6bbef9fb351f6194dc65
...omitted...
addr:2MytYDa3sDP7MMoypztzcPbGoRXbeqvn9cF hash160:48df5cb67613c81ab153b62ef22fe4b5c0fc7bcb
>>> PENDING:
Sends 0.00 and receives 1.00, total value 1.00.
1706d075d5cb3671faeea035ddde40ab7a4a7becb60cebf0054e57b3c665de5a: Seen by 1 peer. Pending/unconfirmed.
in PUSHDATA(72)[3045022100bc9efdfe69eb812f7f7a86bf3165a29230106242f7642ef3bf480628cacceb8902207233445db00851ab12b056e303e2e71ac1b3afde979d0d519a3a9c3e07b5c4b501] PUSHDATA(33)[02d8cad4734eb56be9b91930c715c2971ee0bbc3344223203008e8c7a02a9db9ad]
outpoint:859e9ff7bf9e479acee499363bbc83e8d51ddede5511d8e993376dff9c4c9f35:1
out HASH160 PUSHDATA(20)[acd25e9279e1e516ef5e12f570e6cf23f3ab5a2e] EQUAL 1.00 BTC
out DUP HASH160 PUSHDATA(20)[8202fa350e31c853272aae4fbdc878ea64a767a5] EQUALVERIFY CHECKSIG 2.9998 BTC
@troggy
Copy link
Author

troggy commented Aug 4, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment