consumer – Ship or obtain bitcoins with bitcoin-cli with out downloading full blockchain

0
60


I feel you might do what you’re asking with an explorer API and rawtransactions, nevertheless you’ll want to watch out when utilizing rawtransactions as you might lose loads of cash if you happen to dont know what you’re doing (see my word on the finish).

Transactions are fabricated from inputs and outputs. Shall we say you may have 10 cash on tackle A, you might have two unspent transaction outputs (the two outputs from once you deposited the ten cash), possibly one unspent output has 7 cash, and the opposite 3 cash (totaling 10).

If you wish to ship your good friend 1 coin, you might take the obtainable unspent transaction of three cash, ship 1 coin to your good friend, and 1.9999 cash (after charges of 0.0001) can be returned to you as “change”. Right here is an instance transaction https://chainz.cryptoid.information/btc/tx.dws?499936575.htm You possibly can see 1 earlier output, changing into the enter, and the 2 ensuing outputs.

Your bitcoin-cli pockets wants the complete blockchain, as a result of the checklist of your unspent transactions is constructed from all of the inputs and outputs. Nonetheless discover that the explorer I linked to additionally has an API and (if you happen to request and are granted an API key) the next question will lead to supplying you with all of the inputs for that particular tackle;

https://chainz.cryptoid.information/BTC/api.dws?q=unspent&key=(YOUR_API_KEY)&lively=18mcGpg2e3Fj6djLxiCbdjgh3cD46VayLC

You then would use the RPC console to:
1/ createrawtransaction
2/ signrawtransaction
3/ sendrawtransaction

Check with the https://en.bitcoin.it/wiki/Raw_Transactions Wiki for utilization and different helpful CLI instructions round this subject.

WARNING: Notice when utilizing createrawtransaction you MUST MANUALLY CALCULATE TRANSACTION FEES AND CHANGE, if you happen to fail to do that appropriately change can be consumed as charges!!!

So now you’ll be able to see how its doable (though extraordinarily awkward!) to make and ship transactions with no native copy of the blockchain. By way of how a Ledger works, I think they do steps 1/ createrawtransaction and three/ sendrawtransaction in an un-secure setting, they simply use the Ledger itself to do step 2/ signrawtransaction, as that is the one level at which personal keys are wanted.

LEAVE A REPLY

Please enter your comment!
Please enter your name here