Is there a way to send funds from a specific bitcoin address in a wallet?

0 votes
The first result from Google gave me an answer from 2012 so I wondered if there was a better one than 'use armoury' now?

It's fine if I have to decode the raw transactions, I would be grateful if someone could take me through the steps.
Sep 3, 2018 in Blockchain by sabby
• 4,350 points
83 views

1 answer to this question.

0 votes

I'll answer my own question,

It was unbelievably easy. (from the debug console or command line)

listunspent

produces a/the list of unspent outputs at your disposal. Make a note of the 'txid', 'vout' and 'scriptPubKey' of each output you wish to use.

Use the 'createrawtransaction' command followed by a list of dictionaries containing the txid's and vout's of the inputs you chose earlier followed by the addresses you wish to send them to (the send to addresses are in a single dictionary, not a list of dictionaries).

createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}

If you don't want to send the outputs in total (you want some change for yourself) you will need to include an address that you control in your sending dictionary (from your wallet or somewhere else) since outputs cannot be partially spent, sorry.

To pay the mining fee simply leave some of the total output amount unaccounted for and bitcoin will use it as the mining fee by default (fee is 0.0001 at time of writing).

If all went well you should be given a hex string.

Use the 'signrawtransaction' command to check there are no errors by passing in your new hex string followed by a list of dictionaries with the txid's, vout's and scriptPubKeys we got at the very beginning of all this.

signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...]

note: in newer versions of bitcoin the list of dictionaries is not required

If you got a new hex with "complete" : true after it then all went well and you can now use the 'sendrawtransaction' command followed by the even newer hex you were just given to broadcast your newly created transaction into the bitcoin network.

sendrawtransaction <new hex string>

If you managed to sign it successfully but get a "code":-22,"message":"TX rejected" error please see the footnote below.

Notice it only took four commands in total:

*get     (listunspent)
*create  (createrawtransaction)
*sign    (signrawtransaction)
*send    (sendrawtransaction)

Easy :)

FOOTNOTE:

Be aware if you designate an unusually large fee like 0.5btc (I tried this on the testnet) the network will reject your transaction when you try to broadcast it because it thinks you've made a mistake which I discovered whilst I was experimenting.

(This is also the case if you are trying to spend more BTC than you have available.)

In the end I set the fee to 0.001 and it worked fine, here is a link to my question regarding this situation.

answered Sep 3, 2018 by Perry
• 17,020 points

Related Questions In Blockchain

0 votes
1 answer

How to get all address and send ethers in solidity using a loop?

I found a similar code somewhere: contract  Holders{ uint ...READ MORE

answered Jul 31, 2018 in Blockchain by digger
• 26,550 points
235 views
0 votes
1 answer

Is it possible to send eth to a contract through its constructor from another contract?

I found the solution for this: pragma solidity ...READ MORE

answered Sep 26, 2018 in Blockchain by slayer
• 29,170 points
99 views
0 votes
1 answer

In a Blockchain, how difficult is it to modify the third to last block?

Technically, it's not difficult at all, all ...READ MORE

answered Apr 20, 2018 in Blockchain by Christine
• 15,790 points
79 views
+1 vote
1 answer

Is it possible to store blockchain in a sql or no-sql database?

Currently, following are the options to store ...READ MORE

answered Apr 20, 2018 in Blockchain by Perry
• 17,020 points

edited Aug 9, 2018 by Omkar 68 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
169 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 26,550 points
4,309 views
0 votes
1 answer
+1 vote
1 answer