Author

Topic: Bitcoin CLI How does one send from a specific address to another. (Read 249 times)

member
Activity: 313
Merit: 30
Code:
bitcoin-cli setaccount 1GBykdD628RbYPr3MUhANiWchoCcE52eW2 myfirstaccount

bitcoin-cli sendfrom myfirstaccount 1AYJyqQHCixxxxxxffevxxxxQosCWqn1bT 0.15
sr. member
Activity: 257
Merit: 343
Have any of your new addresses, and search for an UTXO with the old address ("listunspent"), that can be used, and note down this address, the tx ID and vout (and maybe adjust the value). These are the steps I used last recently (even with a P2SH address):

Code:
bitcoin-cli -regtest listunspent
NEWADDR=mmdox1ww...
UTXO_TXID=d260e120647360... (64 chars)
UTXO_VOUT=0
VALUE=49.9997
RAW_TX=$( bitcoin-cli -regtest createrawtransaction '''[{"txid":"'$UTXO_TXID'","vout":'$UTXO_VOUT'}]''' '''{"'$NEWADDR'":'$VALUE'}''' )
bitcoin-cli -regtest decoderawtransaction $RAW_TX
SIGNED_TX=$( bitcoin-cli -regtest signrawtransaction $RAW_TX | awk -F '\"' '{ print $4 }' )
bitcoin-cli -regtest decoderawtransaction $SIGNED_TX
UTXO_TXID=$( bitcoin-cli -regtest sendrawtransaction $SIGNED_TX )
bitcoin-cli -regtest getrawmempool
bitcoin-cli -regtest generate 1

# verify new address has funds:
Code:
bitcoin-cli -regtest validateaddress "$NEWADDR"
bitcoin-cli -regtest getreceivedbyaddress "$NEWADDR"

This will create a transaction from one address to another. While this is ok on testnet/regtest network, it wouldn't make too much sense in production, as this is a regular bitcoin tx, and it involves fees.
legendary
Activity: 1792
Merit: 1283
I think you can do so by using 'sendtoaddress'.
Here's a list of all available commands: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list (this one is more up to date, but less structured: https://bitcoin.org/en/developer-reference#sendtoaddress)

Note that I'm not a developer myself, so I might be completely wrong here.
newbie
Activity: 85
Merit: 0
Hi I have a node with a couple of addresses , how do I send bitcoins from a specific Address "A" to another one "B" ? For instance Im able to get balances of specific addresses on my node using "./bitcoin-cli getbalance A" How can I do same to send coins using the same CLI from and an Address "A" to another Address "B". Thanks
Jump to: