Bitcoin Forum
May 09, 2024, 06:17:30 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin CLI How does one send from a specific address to another.  (Read 249 times)
tendemo (OP)
Newbie
*
Offline Offline

Activity: 85
Merit: 0



View Profile
January 21, 2018, 07:49:57 PM
 #1

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
1715235450
Hero Member
*
Offline Offline

Posts: 1715235450

View Profile Personal Message (Offline)

Ignore
1715235450
Reply with quote  #2

1715235450
Report to moderator
The Bitcoin software, network, and concept is called "Bitcoin" with a capitalized "B". Bitcoin currency units are called "bitcoins" with a lowercase "b" -- this is often abbreviated BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715235450
Hero Member
*
Offline Offline

Posts: 1715235450

View Profile Personal Message (Offline)

Ignore
1715235450
Reply with quote  #2

1715235450
Report to moderator
eternalgloom
Legendary
*
Offline Offline

Activity: 1792
Merit: 1283



View Profile WWW
January 22, 2018, 12:34:18 PM
 #2

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.

pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
January 22, 2018, 12:47:32 PM
Merited by achow101 (2)
 #3

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.
alexeyneu
Member
**
Offline Offline

Activity: 312
Merit: 30


View Profile
January 28, 2018, 02:17:58 PM
 #4

Code:
bitcoin-cli setaccount 1GBykdD628RbYPr3MUhANiWchoCcE52eW2 myfirstaccount

bitcoin-cli sendfrom myfirstaccount 1AYJyqQHCixxxxxxffevxxxxQosCWqn1bT 0.15
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!