Author

Topic: How to add message in Bitcoin tx (Read 389 times)

legendary
Activity: 2856
Merit: 7410
Crypto Swap Exchange
June 14, 2023, 05:40:03 AM
#26
--snip--
I barely think I have understood anything from the discussion above. Lolz.

First thing first, why would anyone want to add text like these. Is there any purpose behind this feature or it is jut something that is added because we can do it with the help of wallet feature?

One of reason OP_RETURN exist is to discourage people from storing arbitrary data using Bitcoin address. Although there aren't many wallet which let you create transaction which contain OP_RETURN.

Let us say I am transacting someone so its probably after discussion with them over a chat box or phone call and let us say some business I did with them. That would be my first line of communication. So why go through such complicated message addition if that can also screw up with the accidental money spending with this feature as discussed above?

Aside from what @o_e_l_e_o said, i've seen people use OP_RETURN to make public statement[1] or sharing BitTorrent magnet link[2].

I saw the message, and does it hide the bitcoin address if we add the message?

No.

[1] https://preturnio.com/results?p=1&b=congrats&ft=1
[2] https://preturnio.com/results?p=1&b=magnet&ft=1
sr. member
Activity: 406
Merit: 443
June 13, 2023, 01:06:31 PM
#24
Let us say I am transacting someone so its probably after discussion with them over a chat box or phone call and let us say some business I did with them. That would be my first line of communication. So why go through such complicated message addition if that can also screw up with the accidental money spending with this feature as discussed above?


OP_RETURN is a proof of burning because its output is not spendable and therefore it is a POB because the resulting transactions are invalid.
It is something that exists in the Bitcoin network, meaning that it is not a feature associated with a specific wallet, although some wallets may not support it.

OP_RETURN has applications such as proof-of-ownership or the transfer of additional information over an insecure channel, just as it happens when we want to initiate an encrypted communication network between two parties and we want to send the private key in both directions, or what is known as the Elliptic-curve Diffie-Hellman (ECDH) protocol.

Using it to save data is wrong because recording data is expensive, it cannot be erased, and everyone can see it, as the cost of data is almost equivalent to the cost of a Bitcoin transaction and the number of words is limited.
There are cheaper and more efficient alternatives.

OUCH! o_e_l_e_o writes faster than me. I had to delete some parts.

I just realized OP_RETURN has a similarity with the Bitcoin Ordinal though they both are different.
Bitcoin Ordinal is an injection of extra data which is a SPAM while OP_RETURN has some advantages.
legendary
Activity: 2268
Merit: 18509
June 13, 2023, 12:54:17 PM
#23
First thing first, why would anyone want to add text like these. Is there any purpose behind this feature or it is jut something that is added because we can do it with the help of wallet feature?
There are some purposes beyond adding arbitrary text. For example, Samourai Whirlpool Tx0 transactions contain an OP_RETURN output with data which allows the automatic coordinator to track outputs. Here's a recent random example I pulled from the blockchain: https://mempool.space/tx/ba3793dba5988e0acc2b36aac1ee67c34c805a18e76a8af26e424f338269dc08

There are things like Omni, which is a layer two system which allows people to transact altcoins on the bitcoin network. Here is an Omni transaction which is actually sending Tether between two addresses: https://mempool.space/tx/80373137c00a8e47998b886b60056fb228dc7b61caa8840e5ce5cab29c3db1d4

And then of course there is the arbitrary text, such as the following: https://mempool.space/tx/94310784a576d2d51246d4344ccab638467a6da8663ec1fb707e8a3882aceffd

If you want to explore OP_RETURN outputs more, then I would recommend playing around with this site: https://preturnio.com/
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
June 13, 2023, 11:59:55 AM
#22
First thing first, why would anyone want to add text like these. Is there any purpose behind this feature or it is jut something that is added because we can do it with the help of wallet feature?
It's more a method of storing data in the blockchain. We are using the word "message" here. But you are free to call it text or whatever you want. I don't know what exactly OP_RETURN refers to lol. I'm only using it for fun. You can further explore OP_RETURN here- https://en.bitcoin.it/wiki/OP_RETURN
Edit-
Check out this article- https://blog.finxter.com/bitcoin-op_return-exploring-its-functionality-and-use-cases/

I just realized OP_RETURN has a similarity with the Bitcoin Ordinal though they both are different.
full member
Activity: 1092
Merit: 227
June 13, 2023, 11:38:42 AM
#21
Nice message, although you're not the first to do so based on search result from https://preturnio.com/results?p=1&b=Craig&ft=0.
--snip--
That's it. Make sure you read the guide above, specially the warning. Learn first what you are going to do.
And optionally use testnet first, especially if you don't want to spend money or afraid accidental doing something stupid.

I barely think I have understood anything from the discussion above. Lolz.

First thing first, why would anyone want to add text like these. Is there any purpose behind this feature or it is jut something that is added because we can do it with the help of wallet feature?

Let us say I am transacting someone so its probably after discussion with them over a chat box or phone call and let us say some business I did with them. That would be my first line of communication. So why go through such complicated message addition if that can also screw up with the accidental money spending with this feature as discussed above?

I saw the message, and does it hide the bitcoin address if we add the message? Like in the above case all other transactions BTC address is visible but theirs is just replaced with message. Just to spread message or look cool or what importance it has?
hero member
Activity: 504
Merit: 1065
Crypto Swap Exchange
June 11, 2023, 05:40:14 PM
#20
It's pretty much easier than I thought at first. Yeah I followed his suggestion and I did it with Electrum. It's as easy as below part-
1. Convert text to hexadecimal
2. Select the utxo you want to spend.
3. Paste the address you want to send the fund and then use a comma, then the amount you want to send.
4. Press enter, in latest Electrum (not sure whether it was same in the previous version), it didnt work by pressing enter. I had to select pay to many first since I was going with a new line.
5. Write- OP_RETURN and a space, then paste your hexadecimal code. Put a comma and then 0. Use 0 here so you don't have to lose extra funds. You will get the rest amount in your change address.
6. Congrats, release the transaction.

That's it. Make sure you read the guide above, specially the warning. Learn first what you are going to do.

I don't know it's possible with Bitcoin Core or not, no one mentioned this here. I would recommend using electrum first to learn the process.

Thank you for the detailed answer!

I did a test with sending a small tip to bitmover and it worked well via Electrum



https://mempool.space/fr/tx/c2b5eea3e485a284ed9c7fad814e69fa6f23aff26ac0176c6262a80e3ca04691

When I will have access to my Bitcoin Core, I will do a test following the advises shared by nc50lc

Thank you guys for all the help provided, and to Little Mouse for creating this interesting topic !  Cheesy
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
June 07, 2023, 07:50:14 AM
#19
I wanted to learn how to add a message and I tried to add a Bengali sentence first. The output was broken, it doesn't support Bengali. I didn't any more think about new sentences. Just followed the message from the tutorial. I liked the message from the tutorial so I added that.

Quote
And optionally use testnet first, especially if you don't want to spend money or afraid accidental doing something stupid.
Thanks but after reading the tutorial and answers here, everything seems easy. That's why I didn't go for testnet anymore.
legendary
Activity: 2268
Merit: 18509
June 07, 2023, 06:59:18 AM
#18
Does not burdened blockchain?
Creating an OP_RETURN output means that that data is forever stored in the blockchain, yes. However, OP_RETURN outputs are not stored in the set of unspent transactions, so they do not burden nodes in the same way that burn addresses do.
member
Activity: 120
Merit: 44
Stay Humble and Stack Sats
June 07, 2023, 04:27:18 AM
#17
Does not burdened blockchain?
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
June 07, 2023, 03:31:49 AM
#16
From my side, I'm going to try with Bitcoin Core, I've never done it before and your post has made me want to give it a try.
It can't be done in the GUI but doable in the command line or console.
Just learn to use send command, then to add an OP_RETURN output, simply add a "data" key with the value of your hex-encoded message.

Example command:
Code:
send "{\"bc1address\": amount,\"data\":\"4372616967205772696768742069732061206c69617220616e642061206672617564\"}"


You can also manually create the transaction via createrawtransaction command to be able to create a transaction with an OP_RETURN output.
Like in "send", it should be added as the value of the "data" key in the outputs.

Example command:
Code:
createrawtransaction "[{\"txid\":\"\",\"vout\":0}]" "[{\"\":},{\"data\": \"4372616967205772696768742069732061206c69617220616e642061206672617564\"}]"

Since it's a manual process, the fee should be computed from the difference of the input's amount and the total amount of the output(s).
On a side note: This method is where the "or it'll be set a fee" warning should be.
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
June 06, 2023, 01:52:06 PM
#15
How did you do it? Did you follow the tutorial shared by OmegaStarScream and did it with Electrum?
It's pretty much easier than I thought at first. Yeah I followed his suggestion and I did it with Electrum. It's as easy as below part-
1. Convert text to hexadecimal
2. Select the utxo you want to spend.
3. Paste the address you want to send the fund and then use a comma, then the amount you want to send.
4. Press enter, in latest Electrum (not sure whether it was same in the previous version), it didnt work by pressing enter. I had to select pay to many first since I was going with a new line.
5. Write- OP_RETURN and a space, then paste your hexadecimal code. Put a comma and then 0. Use 0 here so you don't have to lose extra funds. You will get the rest amount in your change address.
6. Congrats, release the transaction.

That's it. Make sure you read the guide above, specially the warning. Learn first what you are going to do.

I don't know it's possible with Bitcoin Core or not, no one mentioned this here. I would recommend using electrum first to learn the process.
hero member
Activity: 504
Merit: 1065
Crypto Swap Exchange
June 06, 2023, 01:43:27 PM
#14



Haha well done! We can't spread this message enough  Cheesy

How did you do it? Did you follow the tutorial shared by OmegaStarScream and did it with Electrum?

From my side, I'm going to try with Bitcoin Core, I've never done it before and your post has made me want to give it a try.
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
June 03, 2023, 11:29:59 AM
#12
-snip-
Cool topic, will give that electrum guide a try. Seems you need to be really careful to specify a change address, otherwise the funds will be "lost" to the miner.

Are there any adroid wallets supporting this feature? I know there is electrum for android, but it sucks, so anything aside from that?
That warning is quite exaggerated though,
because Electrum will not let you create the transaction with "0" amount OP_RETURN alone.
And if it has a non-dust amount and you forgot to set a custom change address, Electrum will automatically dedicate a change address if there's an excess amount from the selected UTXO.
And if the custom change address amount is set too low for the input, Electrum will also use an actual change address.

He might have though of it because of his approach on using coin-control.
Notice that even though he set 2.3sat/B (356sat) in the advanced preview, his total fee is 500sat which is the excess from the input, (the excess is added as fee because it's dust)
But if he selected an input with higher amount or lower the amount of the change address, Electrum will use one of his change address to receive the excess, not set it all as fee.

What he/you need to do is to set the custom change address' amount to "!" to send all of the selected UTXO's amount to it in consideration of the fee rate that you'll set.
legendary
Activity: 2030
Merit: 1401
Disobey.
June 03, 2023, 06:21:51 AM
#11
Yes, you can do that using OP_RETURN. I'm not sure about other wallets, but I know Electrum supports it. Here's a step-by-step guide for it:

https://armantheparman.com/op_return/

Make sure to read the warnings.

Cool topic, will give that electrum guide a try. Seems you need to be really careful to specify a change address, otherwise the funds will be "lost" to the miner.

Are there any adroid wallets supporting this feature? I know there is electrum for android, but it sucks, so anything aside from that?
legendary
Activity: 2394
Merit: 5531
Self-proclaimed Genius
May 31, 2023, 04:16:58 AM
#10
or OP_RETURN It's easier than that. All you need is in the Pay to field, type OP_RETURN deadbeef, and in the description, type your message, and make sure the value is zero because it is an invalid transaction and your coins will be burned.
Take note that the "message" should be in hexadecimal, in which a normal text should be converted into HEX.
"deafbeef" just incidentally consists of hexadecimal characters that's why it's valid.
legendary
Activity: 2268
Merit: 18509
May 31, 2023, 01:51:08 AM
#9
Then "Add to coin control" is the same option, isn't it?
Yes. "Add to/Remove from coin control" has replaced "Spend from".

https://github.com/spesmilo/electrum/pull/8156
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
May 31, 2023, 12:15:28 AM
#8
Since you can't specify where you're sending it from, you should make sure to choose where you want to send the remaining amount.
I see. Then "Add to coin control" is the same option, isn't it? Because when I add an input in coin control, it will only let me spend that particular fund. Got it now. In other case, I can also try with freezing other addresses.
Quote
It's probably best to test this with a wallet that only has a couple of dollars and nothing else just to make sure you're doing everything correctly.
If the above statement is correct, then I got the warning. I would test it yesterday. Thank you for the help and alert me the possible risk. I will try with a small input.

Thank you everyone.
staff
Activity: 3402
Merit: 6065
May 30, 2023, 02:52:23 PM
#7
I don't know what I'm missing, pardon me. I can't see the spend option either. I'm trying to spend funds from the address list of coins tab. What does this "spend from" mean? Spend from X address? -snip-

Yes, I just checked Electrum and apparently, that option is gone. I'm not sure if one can use it from somewhere else, but if downgrading is not an option, then I would imagine you should still be able to achieve what you want without that step.

But again, please be careful and make sure to read the warnings in that article.

As for this:

Quote
Final warning: To spell it out further, if you have for example a 1.0 bitcoin UTXO to spend, and you set the OP_Return value to zero sats (good), and an payment of 0.1 bitcoin to an address, and nothing else specified, then the remainder (0.9 bitcoin) will be sent to the miner! Don’t do that.

Since you can't specify where you're sending it from, you should make sure to choose where you want to send the remaining amount.

It's probably best to test this with a wallet that only has a couple of dollars and nothing else just to make sure you're doing everything correctly.
sr. member
Activity: 406
Merit: 443
May 30, 2023, 04:10:36 AM
#6
There are two types of messages, one of which is you write your message in the bitcoin address (a valid address, but it is not possible to generate a private key for it)


TX: https://www.blockchain.com/btc/tx/54215bf9b24db3dbf3463f305128caa0c6ac5be8fd6e7d5d534f494855fd1689

message
I don't know what I'm missing, pardon me. I can't see the spend option either. I'm trying to spend funds from the address list of coins tab. What does this "spend from" mean? Spend from X address? Then is it the same as "Add to coin control" in the current version of electrum?

or OP_RETURN It's easier than that. All you need is in the Pay to field, type OP_RETURN deadbeef, and in the description, type your message, and make sure the value is zero because it is an invalid transaction and your coins will be burned.

source https://twitter.com/ElectrumWallet/status/1380058456854528001

A great site for all OP_RETURN previous messages is here Project: Preturnio - a full text search engine for Bitcoin
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
May 30, 2023, 12:11:50 AM
#5
Yes, you can do that using OP_RETURN. I'm not sure about other wallets, but I know Electrum supports it. Here's a step-by-step guide for it:

https://armantheparman.com/op_return/

Make sure to read the warnings.
I don't know what I'm missing, pardon me. I can't see the spend option either. I'm trying to spend funds from the address list of coins tab. What does this "spend from" mean? Spend from X address? Then is it the same as "Add to coin control" in the current version of electrum?

Sorry, if it is a little bit out of topic, but I find all this very interesting, because I've always wondered how you can technically write a message in the coinbase transaction when you find a block as a mining pool ?

Is it just the pool that defines a message in their node that will be displayed in all the coinbases of the blocks it finds?

How did it work in the past, when we solo mined with Bitcoin Core? Was it possible to choose a text  that was integrated into the coinbase transaction?

I can't tell you how as I'm not an expert but I can say yeah, you can attach a message to the coinbase data. Genesis block has this message attached by satoshi-
Quote
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
if you check the block's coinbase data, you will find many of them has message attached to the coinbase data although most of them are meaningless. One of the blocks after the last halving (can't remember exactly) had something like "Last time to buy below $10000." How nice the message was!

Also, as an end user, we can attach a message to our transaction as well. I was trying to figure out that so I can attach messages in my future txs, just for fun though but I have something in mind for the future. I can utilize this feature.
hero member
Activity: 504
Merit: 1065
Crypto Swap Exchange
May 29, 2023, 09:27:46 PM
#4
Sorry, if it is a little bit out of topic, but I find all this very interesting, because I've always wondered how you can technically write a message in the coinbase transaction when you find a block as a mining pool ?

Is it just the pool that defines a message in their node that will be displayed in all the coinbases of the blocks it finds?

How did it work in the past, when we solo mined with Bitcoin Core? Was it possible to choose a text  that was integrated into the coinbase transaction?
rby
hero member
Activity: 742
Merit: 611
Brotherhood is love
May 29, 2023, 07:00:02 PM
#3
Well detailed tutorial here.
Yes, you can do that using OP_RETURN. I'm not sure about other wallets, but I know Electrum supports it. Here's a step-by-step guide for it:

https://armantheparman.com/op_return/

Make sure to read the warnings.

I want to re emphasis from the article, the two places where you can lose all your bitcoin or 90% of it to miners so that you will be more careful at this stages.

Quote
First, select any UTXO you wish to spend (Learn more on what a UTXO is). In the address window (or coins window), right-click the particular UTXO (or address), and select “spend from”:
Then in the “Send” tab, enter an address you wish to send the UTXO balance to (Otherwise it all goes to the miner! Be very careful!).

Quote
Final warning: To spell it out further, if you have for example a 1.0 bitcoin UTXO to spend, and you set the OP_Return value to zero sats (good), and an payment of 0.1 bitcoin to an address, and nothing else specified, then the remainder (0.9 bitcoin) will be sent to the miner! Don’t do that

Congratulations LM, looking forward to seeing it in Flush.com campaign payment next week. Grin
staff
Activity: 3402
Merit: 6065
May 29, 2023, 02:27:51 PM
#2
Yes, you can do that using OP_RETURN. I'm not sure about other wallets, but I know Electrum supports it. Here's a step-by-step guide for it:

https://armantheparman.com/op_return/

Make sure to read the warnings.
legendary
Activity: 1960
Merit: 1908
Marketing Campaign Manager |Telegram ID- @LT_Mouse
May 29, 2023, 02:21:49 PM
#1
I have seen a lot of txs add messages to Bitcoin transactions. They are publicly visible through the explorer. If I can remember correctly, there was a message in a block where the miner has written something about the price.
How I can add such a message too in a tx created by me? This has been always my curiosity but I forgot when I'm in the forum lol. Can someone share with me the way to do so? I'm using Electrum only now as I had my pc crashed and I have to download the core and whole chain once again  Cry Can I add a message with Electrum? If not, which wallet should I use for this?
Jump to: