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:
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
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_address
bitcoin-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 b7a257066b2676dfd623144e959a5079af4c6c5ce6a2c6cf9f58c33bc35716e4
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
Last updated