5

Hello fellow bitcoin users,

I'm currently working on developing an application that takes advantage of the Electrum wallet in order to receive and payout to users of my service.

My application uses the built in json-rpc server from Electrum to communicate. I am able to accept and monitor incoming payments just fine with the request mechanism but I'm facing some difficulties in terms of paying out.

By running the 'electrum -h' from command line I see that I should be using the 'payto' command to make payments. I need to specify an address and an amount at minimum and then also a password if required.

In order to see what sort of response I'm expected I first tried this directly from the command line using 'electrum payto [BTC_ADDRESS] [AMOUNT]' and then I'm prompted for my password.

Also when entering an incorrect password I get denied (so this isn't the reason).

I enter it and receieve the following response:

{
"complete": true, 
"final": true, 
"hex": "01000000026a7bb00035a682b0c51b00f7e60673a7c9480d03f4653abdf96ee68d63503221000000006b483045022100d4f489641dd85084fe301cd186a4630e1301ae24e3e1c2e99a4ed06675bfd8e202203a9ad7c4c9e456f9d21b0e7c1e0210b65e5363f70a4d87cd27f39475cd0ab22d01210257682e6bebcd9c5a7735c3ea80c6454badbc3d2b0e9d86d875b455538b149fc0ffffffff0763798b137db5feb7ba5cef8de2c1234ccadd29effd0c2c97474f4af4c6218d000000006b483045022100c704edbdf075e29382303207c7f445a4f4d3779b70c7b4798f12a6d0c517b5df02205644c9f7f47910477e9e58971ccbcb80258959208c72b6ec95a21c59b23402420121022f55a3753a30d020a5e052592e1dc1b511968b4a91871debe6b9bc9bedc2f4bfffffffff0278500000000000001976a9148353defb1ecee68e5c21a99239e1ec041d675a8588ac50c30000000000001976a914700bcc46e4421238023727492f724d08c499673988ac00000000"
}

I was expecting perhaps a transaction ID but as the documentation for the API is lacking (or I can't find it more likely) I'm not sure what to expect. The payment is not executed by this command so perhaps I'm missing something.

TL;DR: How do I send bitcoin using Electrum from the command line?

Thanks

6

There is one more step to actually process the transaction, you have to broadcast it. What you have got is a signed transaction which you can save (& even send to someone else to broadcast).

The signed transaction can be broadcasted like this:

electrum payto <bitcoin_address> <amount> | electrum broadcast -

This will write the transaction to the chain. You can read more in the official documentation.

  • 1
    To clarify "This will write the transaction to the chain.": After the transaction is broadcast to the network, it will still need to be relayed to miners, have sufficient fee to be included it in a block, and said block needs to be found. – Murch Dec 5 '16 at 10:09
  • Indeed, the transaction will only be written if all these happen. I just simplified it, but explaining it like that may be better. – Jikku Jose Dec 5 '16 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.