0
Let's say the user sends me his private key. What is the appropriate RPC command to spend the Bitcoins of this user using his private key?
Should I import his private key in the wallet before?
0
Let's say the user sends me his private key. What is the appropriate RPC command to spend the Bitcoins of this user using his private key?
Should I import his private key in the wallet before?
1
If you're using Bitcoin Core, you must first import the private key using the importprivkey console command. The coins held by that private key will then be added to your existing balance (if any).
If you want to spend those specific coins rather than some others in your wallet, you can use the "coin control" feature. This can be enabled in Settings:Options:Display; when you send coins, you will be offered a list to select which addresses/transactions you want to spend from.
Thanks a lot for your answer. Let's say I want to spend those specific coins. Do you know the way to do it with RPC commands? – heyo – 2014-08-14T18:35:27.530
0
For RPC you can do a raw transaction where you can specify which inputs to use. First listunspent then createrawtransaction, then sign and transmit to the network.
1Note that under any normal circumstances, you should never send/receive a private key. It kinda defeats the purpose of having public key cryptography. – Tim S. – 2014-08-14T17:45:44.437
Alternate solution: use https://brainwallet.github.io/#tx so you don't have to rescan the blockchain for transactions, or do raw signing stuff.
– Tim S. – 2014-08-14T17:57:48.123