Author

Topic: How can I create an OP_RETURN TX with the Electrum console? (Read 239 times)

copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
Outputs are scripts, addresses are scripts as well.

Thanks for the clarification, makes perfect sense.  Nevertheless, I don't think that the blockchain should be used as someone's personal notepad.  Seems like a dick-move...

Or perhaps a bit more accurately, a cunt-move.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
Could you not call the same method as is called through the GUI? I have seen other methods that are not GUI commands be called this way and I'm not familiar with python.
Not AFAIK, or perhaps I haven't delved into it enough. I'm aware of certain GUI methods to be called through the console, QR codes etc. The creation of the transaction itself calls the transaction module, while the parsing of the output is done with paytoedit.

As for requiring an address, wouldn't OP_RETURN require one as well?  I'll admit I've never used it (see below,) but I was under the impression that it required a fee, and some bitcoin to burn.
Outputs are scripts, addresses are scripts as well.

They're not treated differently in terms of the fees required, it is always dependent on the size of the transaction. OP_Return is a special kind of output that allows for 0 value output.
copper member
Activity: 2338
Merit: 4543
Join the world-leading crypto sportsbook NOW!
The two commands expects an address and does not parse scripts (OP_return)[1], while the GUI does[2].
Could you not call the same method as is called through the GUI? I have seen other methods that are not GUI commands be called this way and I'm not familiar with python.

That was my initial thought.  I would assume that gui functions are a set of predefined commands that can by manually configured in the console or or cli.  As for requiring an address, wouldn't OP_RETURN require one as well?  I'll admit I've never used it (see below,) but I was under the impression that it required a fee, and some bitcoin to burn.


I hope you know that bitcoin blockchain is not a message storage database.

Yeah, I really don't want to upgrade all my node hard drives any sooner than I have to.  Use ETH for that kind of stupid shit.  It's blockchain is a clusterfuck already.
legendary
Activity: 2702
Merit: 3045
Top Crypto Casino
is their an other Python alternative? I can't set up bitcoin core (I don't have enough storage)
Bitcoin core is better suited for what you are trying to achieve and if storage space is your only concern, you can install it and run it in pruned mode. It won't take much space (only few Gbs).
Otherwise, you can use Coinb.in (as suggested above) or any other tool to construct the raw transaction then you can sign and broadcast it from the Electrum console. I didn't try it, tbh, but I believe it will work.

Note: Storing message in the blockchain is considered spamming even on the testnet network. Other nodes will have to download this extra data so I hope you consider this.
legendary
Activity: 2702
Merit: 4002
I am trying to make a script to write some Data in the blockchain.
(I want to automate the whole process with Python)


If
    write in the Blockchain

thats my plan...
use bitcoinCore console with

Code:
createrawtransaction '[]' '{"your hex-encoded data":"deadbeef"}'

AFAIK, Coinb.in and Trezor support OP_RETURN but I don't know if bout console and not GUI.

Generally why do you need to do this automatically? Writing is expensive and space is 80 byte?
legendary
Activity: 3472
Merit: 10611
The two commands expects an address and does not parse scripts (OP_return)[1], while the GUI does[2].
Could you not call the same method as is called through the GUI? I have seen other methods that are not GUI commands be called this way and I'm not familiar with python.

I am trying to make a script to write some Data in the blockchain.
I hope you know that bitcoin blockchain is not a message storage database.
newbie
Activity: 5
Merit: 4
I am trying to make a script to write some Data in the blockchain.
(I want to automate the whole process with Python)


If
    write in the Blockchain

thats my plan...
legendary
Activity: 3374
Merit: 3095
Playbet.io - Crypto Casino and Sportsbook
I already tried it before looking for a way to make OP_return works on the console when creating transactions in Electrum but no success. It seems they don't support it but works on payto in the GUI.

What actually do you want to achieve?

Alternatively, you can make a transaction on https://coinb.in/#newTransaction with an advanced option to enable OP_return and sign and broadcast the transaction through Electrum.
newbie
Activity: 5
Merit: 4
Ok its really sad that the electrum console does not support OP_RETURN TX...

is their an other Python alternative? I can't set up bitcoin core (I don't have enough storage)

Thank you for your help!
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
why does this not work? Why does it work in the GUI?
The two commands expects an address and does not parse scripts (OP_return)[1], while the GUI does[2].
Do you know a good alternative?
Bitcoin Core, using their CLI.

[1] https://github.com/spesmilo/electrum/blob/master/electrum/commands.py#L640

[2] https://github.com/spesmilo/electrum/blob/master/electrum/gui/qt/paytoedit.py#L119
newbie
Activity: 5
Merit: 4
Ok Thank you!


why does this not work? Why does it work in the GUI?
Do you know a good alternative?
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
Neither payto nor paytomany accepts OP_return as a parameter. You can only do so in the GUI, not the RPC or console.
newbie
Activity: 5
Merit: 4
I can created some OP_RETURN TX by entering "OP_RETURN hereTheHexOfMyMessage" in the "pay to" GUI from electrum.

Now I want to do this with the Electrum Console


My Code Idea (however it does not work):

paytomany(outputs=[["OP_RETURN 6a1a3120746869732069732061206f7052657475726e205465730174", 0], ["tb1qez4ecr6wz0guvd8s2w3d8dlwyf7g7susctgrdp", 0.01880212]])


(I use electrum in the bitcoin-testchain mode, for testing)
Jump to: