Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Subwallets, Part 3: transaction signing using the parent wallet
See commit 7538a94 for Part 1 See commit d1b8aef for Part 2 NOTE: to guard against Seed ID collisions, only the default or first wallet specified in `mmgen-txsign` will be used for signing subwallet transactions. Live example using MMGen regtest (Bob and Alice) mode: $ mmgen-regtest setup # Create a bogus wallet for Bob in mnemonic format: $ echo $(yes bee | head -n24) > bogus.mmwords # Convert the wallet and make it Bob's default: $ mkdir -p $HOME/.mmgen/regtest/btc/bob $ mmgen-walletconv -d $HOME/.mmgen/regtest/btc/bob bogus.mmwords ... MMGen wallet written to file /home/user/.mmgen/regtest/btc/bob/DF449DA4-*.mmdat # Choose two subwallets, 1S and 2L, and get their Seed IDs: $ mmgen-tool --bob get_subseed 1S # ==> 930E1AD5 $ mmgen-tool --bob get_subseed 2L # ==> 62B02F54 # Generate five bech32 addresses each from default wallet and subwallets: $ mmgen-addrgen --bob --type=bech32 1-5 $ mmgen-addrgen --bob --type=bech32 --subwallet=1S 1-5 $ mmgen-addrgen --bob --type=bech32 --subwallet=2L 1-5 # Import the addresses into Bob's tracking wallet: $ mmgen-regtest bob $ mmgen-addrimport --bob DF449DA4*addrs $ mmgen-addrimport --bob 930E1AD5*addrs $ mmgen-addrimport --bob 62B02F54*addrs # Fund addresses from each of the wallets: $ mmgen-regtest send bcrt1q0v8eczv37ynl9zn8w3rh53xrkyuddrunuz74rd 10 # DF449DA4:B:1 $ mmgen-regtest send bcrt1qtzxlnng6jd7yakzp7r69y6nmh5wp0wx7xg6e9w 10 # 930E1AD5:B:1 $ mmgen-regtest send bcrt1qxnj0wgusq357qj62hq88thrw9cwanxc7926vrz 10 # 62B02F54:B:1 # Create a transaction spending to and from each of the wallets: $ mmgen-txcreate --bob --tx-fee=3s DF449DA4:B:2,1.11 930E1AD5:B:2,1.23 62B02F54:B:2 ... (choose inputs 1-3) ... Transaction written to file '<MMGen txid>[2.34].testnet.rawtx' # Sign the transaction: $ mmgen-txsign --bob *\[2.34\].testnet.rawtx ... Found subseed 930E1AD5 (DF449DA4:1S) ... Found subseed 62B02F54 (DF449DA4:2L) ... Signed transaction written to file '<MMGen txid>[2.34].testnet.sigtx' # Send the transaction: $ mmgen-txsend -q --bob *\[2.34\].testnet.sigtx Transaction sent: <BTC txid> # Mine a block and view the result: $ mmgen-regtest generate $ mmgen-tool --bob twview
- Loading branch information
Showing
4 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters