RPC Browser and transactions legacy
These are the main steps to be done to send a transaction from the rpc-browser. These are to be done in using legacy addresses to showcase the use of the explorer and terminal. All the steps done from terminal can be done visually from the local bitcoin explorer deployed using clarinet integrate.
Main steps:
Section titled “Main steps:”- getnewaddress - 3 legacy_addresses alice1, alice2 and bob
- get privkey alice1 and bob - dumprivkey
- generate 101 blocks to one address to andrei1
- sendtoaddress to bob, amount
- sign it using the private key of bob
Complete flow
Section titled “Complete flow”- create legacy_wallet from cli
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 createwallet our_legacy_wallet false false "" false false false- use specific wallet ( if more present ) → add argument -rpcwallet=our_legacy_wallet get new addresses for andrei1, deployer, andrei2 and their private keys
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet getnewaddress>> new_addressbitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet dumpprivkey "new_address">> privkey- generate blocks to andrei1 to have balance
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet generatetoaddress 100 bcrt1q2282phtvk88049pkdk9nrhp6kydcrqngyhdcw9- send to deployer 0.01 BTC
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet sendtoaddress bcrt1q8ntuj6ljdhnk9cqzlj7kpfrwtqx6k4h9xfthxh 0.01
=> txid:b7a257066b2676dfd623144e959a5079af4c6c5ce6a2c6cf9f58c33bc35716e4- get transaction details and keep the vout value
- create transaction from bob’s output to alice2
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet gettransaction b7a257066b2676dfd623144e959a5079af4c6c5ce6a2c6cf9f58c33bc35716e4show transaction details
{ "amount": 0.00000000, "fee": -0.00010816, "confirmations": 8, "blockhash": "16e0efa3c15693f2b3b692007f325d95d11e095610dd11a4811cca9ee48bb106", "blockheight": 3207, "blockindex": 1, "blocktime": 1676560079, "txid": "b7a257066b2676dfd623144e959a5079af4c6c5ce6a2c6cf9f58c33bc35716e4", "wtxid": "19cf7683e34036eb843ea2884636feafefb8107a417047d568c5e5d641d23651", "walletconflicts": [ ], "time": 1676560060, "timereceived": 1676560060, "bip125-replaceable": "no", "details": [ { "address": "bcrt1q8ntuj6ljdhnk9cqzlj7kpfrwtqx6k4h9xfthxh", "category": "send", "amount": -0.01000000, "label": "", "vout": 0, "fee": -0.00010816, "abandoned": false }, { "address": "bcrt1q8ntuj6ljdhnk9cqzlj7kpfrwtqx6k4h9xfthxh", "parent_descs": [ ], "category": "receive", "amount": 0.01000000, "label": "", "vout": 0 } ], "hex": "a_lot_longer_than_displayed_here_020000009ade091061bda9163993e6c4cc1997833456618e76e18ca23b459cb63bd48cff330000000000fdffffffb66b39f67d4159a9e26282a55fd027394e84553d5ec00000fdffffff3bf7c298d46d313bab078a1d1490bf820bdd93166034e4795d8abda2bc7566680000000000fdffffff692a5f562e280b331a3f5574b832a3d3c06c1dd5651900d692a096341e26ffe20000000000fdffffff0c72b64849fb1a824c648ddc0d053d16be66189a4edafe7e4fea014a1c2cda470000000000fdffffffeed42cd815c1eec8dd292c032553c5edf3839762e002fcbd60a46e580dab56e5860c0000" }
0200000001e41657c33bc3589fcfc6a2e65c6c4caf79509a954e1423d6df76266b0657a2b70000000000fdffffff01a0bb0d0000000000160014ce306722e9f6097acd14619109d4670c5123bf4500000000n- sign transaction as deployer. do it from the explorer
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet signrawtransactionwithkey "0200000001e41657c33bc3589fcfc6a2e65c6c4caf79509a954e1423d6df76266b0657a2b70000000000fdffffff01a0bb0d0000000000160014ce306722e9f6097acd14619109d4670c5123bf4500000000" ["cSMvmcWW7inRSD7NXPdhgySLiHX8A8q4Yb3HpxHNiYZuNZS9Yxb1"][ { "hex": "02000000000101e41657c33bc3589fcfc6a2e65c6c4caf79509a954e1423d6df76266b0657a2b70000000000fdffffff01a0bb0d0000000000160014ce306722e9f6097acd14619109d4670c5123bf45024730440220794c99e6aed03affbf59a457cf660741b209b968825b1f264a6248e9f1c481330220623c702af101bf6f15ca0ecdf15423efa775c67e4bce236cc9eb986066606a2201210210d54cbd7b6493ae52015860e17105a699447e9402c9ac02a52dfc460d6ade9400000000", "complete": true }]- broadcast transaction to move BTC
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet sendrawtransaction "02000000000101e41657c33bc3589fcfc6a2e65c6c4caf79509a954e1423d6df76266b0657a2b70000000000fdffffff01a0bb0d0000000000160014ce306722e9f6097acd14619109d4670c5123bf45024730440220794c99e6aed03affbf59a457cf660741b209b968825b1f264a6248e9f1c481330220623c702af101bf6f15ca0ecdf15423efa775c67e4bce236cc9eb986066606a2201210210d54cbd7b6493ae52015860e17105a699447e9402c9ac02a52dfc460d6ade9400000000"dc683c0334d8dd03b5e2d64c749374794a1eca0115ca48c1d56fa8701f33d9ae- see the list of transactions and if the amount is in the wanted address.
bitcoin-cli -rpcuser=devnet -rpcpassword=devnet -rpcconnect=localhost -rpcport=18443 -rpcwallet=our_legacy_wallet listtransactions "*" 5 0 false