Hey!,

Today Luca asks:

Can I write on a Bitcoin Blockchain? Can I drop down a message?

Yes, Luca of course you can! You can leave a message on a Bitcoin blockchain using a particular op code, called **OP_RETURN**.

Through this operation code, your UTXO became unspendable! You can use at most 80 bytes for your message (160 hexadecimal characters)!

This operation is known as “timestamping of write information” because the message will become part of a block with a timestamp as well.

In Action

Can I write on Bitcoin Blockchain? — Italian Language 🇮🇹

First of all, I get a SegWit address from my testnet node.

$ bitcoin-cli getnewaddress "" "bech32"
tb1qrggdlvezgd4uy9mntz50mpmwd6l4vk9rm4ft3d

I need bitcoins! I need to use a faucet service such as: https://bitcoinfaucet.uo1.net/send.php

After that, I can check my mempool and find my TX ID.

$ bitcoin-cli getrawmempool | grep c5ce66d638f1b8ca702dfb8f7d1da7a6707d9c6497212dc66829c99f69b28b9a

the c5ce66d638f1b8ca702dfb8f7d1da7a6707d9c6497212dc66829c99f69b28b9a is the faucet’s transaction.

When can I use my UTXO?

I can use it after the mining process.

Please recover my UTXO with **listunspent** command.

$ bitcoin-cli listunspent 1 101 '["tb1qrggdlvezgd4uy9mntz50mpmwd6l4vk9rm4ft3d"]' | jq
[
{
"txid": "c5ce66d638f1b8ca702dfb8f7d1da7a6707d9c6497212dc66829c99f69b28b9a",
"vout": 1,
"address": "tb1qrggdlvezgd4uy9mntz50mpmwd6l4vk9rm4ft3d",
"label": "",
"scriptPubKey": "00141a10dfb322436bc2177358a8fd876e6ebf5658a3",
"amount": 0.00100000,
"confirmations": 6,
"spendable": true,
"solvable": true,
"desc": "wpkh([3a46ecca/0'/0'/4']020d12775323bbdaf0cb6e9a2b44ae7a591ef5872364e80e363a93d283c10b9e4f)#kxjva7dw",
"safe": true
}
]

Nice! I need to retrieve the private key, as we know it’s mandatory to sign my transaction.

$ bitcoin-cli dumpprivkey tb1qrggdlvezgd4uy9mntz50mpmwd6l4vk9rm4ft3d
cPHTHs7ERe6jDYiitj9eLVswsX3RpeKMB19eXYjpLb4CkEHd7drq

Now, we are able to create an amazing message, for instance: corsocompleto.bitcoininaction.com.

Yep, we need to use hexadecimal!

$ printf "corsocompleto.bitcoininaction.com" | xxd -ps
636f72736f636f6d706c65746f2e626974636f696e696e616374696f6e2e636f6d

I have the necessary to create the transaction!

Using _help_ I can retrieve a lot of information about this method. I want to use it on **createrawtransaction**.

$ bitcoin-cli help createrawtransaction

The receiver is the faucet’s address, I give back bitcoins :).

The address is:

2NGZrVvZG92qGYqzTLjCAewvPZ7JE8S8VxE

Finally, I can build my transaction, in the data field I can put my hexadecimal message. Remember that it will create an operation code OP_RETURN as we discussed above.

#bitcoin #blockchain #what-is-bitcoin #blockchain-development #blockchain-use-cases #blockchain-developer #btc #bitcoin-spotlight

Adding Messages On The Bitcoin Blockchain - A How-To Guide
25.90 GEEK