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

+1 vote
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,370 points
1,443 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.

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

Related Questions In Blockchain

0 votes
0 answers

hd wallet bip44 in js - how to create an address for a chain other than bitcoin?

I have a small script basically taken ...READ MORE

Mar 2, 2022 in Blockchain by Aditya
• 7,680 points
1,001 views
+1 vote
0 answers

How to check a Bitcoin wallet balance from first generated address (m/44'/0'/0'/0/0)

Is there a way to check a ...READ MORE

Mar 4, 2022 in Blockchain by Soham
• 9,710 points
2,260 views
+1 vote
0 answers

How to check a Bitcoin wallet balance from first generated address (m/44'/0'/0'/0/0)

Is there a way to check a ...READ MORE

Mar 9, 2022 in Blockchain by Soham
• 9,710 points
1,942 views
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,740 points
2,770 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
1,947 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,740 points
45,301 views
0 votes
1 answer

How do I add multiple recipients for transactions via Blockchain API?

Convert the recipes into JSON objects. x = ...READ MORE

answered Jul 6, 2018 in Blockchain by Perry
• 17,100 points
930 views
+1 vote
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,460 points
1,461 views
+1 vote
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP