Most common Bitcoin-cli command line

bitcoin-cli getinfo
bitcoin-cli getbalance
bitcoin-cli getaddressesbyaccount “”
bitcoin-cli getnewaddress “”

bitcoin-cli sendfrom “erhverv.1” 1HE66xiaq5ooMADMfRfCXBZApqcW5ZurC5 0.00063

bitcoin-cli listaccounts 0
bitcoin-cli listunspent
bitcoin-cli listtransactions
bitcoin-cli listtransactions “erhverv.1”
bitcoin-cli listreceivedbyaddress “”
bitcoin-cli listreceivedbyaccount

 

bitcoin-cli setaccount 13JLyiRoArrq9QMcpVCur7J8X53P6dcA2u “e-Wallet”

 

wget -q -O- https://blockexplorer.com/q/getblockcount; echo

bitcoin-cli getblockcount

bitcoin-cli -regtest stop
sudo pkill -9 -f bitcoind
bitcoind &

systemctl stop rpcbind.socket
systemctl stop rpcbind.service
systemctl disable rpcbind.service

Bitcoin – How to Build Raw Transaction

Step 1)

listunspent

Format:

Lets check list of unspent using with his address.

Execute:

Result:

What we see here is the results that assigned 50 and 10 mBTC to our address…. To spend this output we will create a new transaction.

Step 2)

createrawtransaction

We need to choose some blocks with sufficient amount from the result of listunspent. Since we only need to send 0.02500000 mBTC I think the first block has the enough amount to make the transaction.

Format:

To pay the fee, we will reduce the change output by 0.5 millibits as you can see below.

Execute:

Result

The createrawtransaction command produces a raw hex string that encodes the transaction details we supplied. If you want to decode the hex just use decoderawtransaction command.

Step 3)

signrawtransaction

signs the transaction in the serialized transaction format using private keys stored in the wallet or provided in the call.

Format:

Execute:

Result:

Now the signrawtransaction command returns another hex-encoded raw transaction.

Step 4)

sendrawtransaction

RPC validates a transaction and broadcasts it to the peer-to-peer network.

Format:

Execute:

Result: