Author

Topic: Write text/image in blockchain of bitcoin (Read 249 times)

sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
April 03, 2018, 04:45:53 PM
#10
Cool!
Can i write text more than 20 characters?
Using this method, no -- not in one output anyways.
P2PKH addresses are  a 20-byte hash of the public key so you're limited to 20 bytes for each output.
If you wish to insert data of more than 20 bytes, you'll have to do it with multiple outputs (i.e encode your message in different fake addresses) in the same transaction. For example, see this transaction

However, as Murch says, you'll be bloating the UTXO set by using this method; the public key isn't "valid" but the UTXOs are, so even though you can't spend the outputs of the transaction, miners and nodes still have to keep track of the UTXO because they can't tell the difference.

If you want something better, then use OP_RETURN like advised, more data can be stored (80 bytes vs 20 bytes) and since the ouptut is provably unspendable, it can be pruned from the UTXO set.
staff
Activity: 3458
Merit: 6793
Just writing some code
Yes. Also you can use the script of the transaction to embed some text as Satoshi Nakamoto have done in the genesis block of Bitcoin.

Code:
PUSHDATA(65)
[0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee]
CHECKSIG

Read more here:
https://en.bitcoin.it/wiki/Script
That's not how Satoshi put text in the genesis block. The text was put in the coinbase (aka scriptSig of the coinbase transaction), not in an output. Many miners still do this today, usually to identify who mined the block.
legendary
Activity: 2618
Merit: 2304
If you do this, you'll be bloating the utxo set... The outputs you create can never be spent so they'll be in each node's utxo set forever...

An alternative is using op_return to avoid utxo bloating: https://en.bitcoin.it/wiki/OP_RETURN
You're right. It's a proper way to write some text in the blockchain of Bitcoin.

Quote
OP_RETURN marks transaction as invalid. A standard way of attaching extra data to transactions is to add a zero-value output with a scriptPubKey consisting of OP_RETURN followed by exactly one pushdata op. Such outputs are provably unspendable, reducing their cost to the network. Currently it is usually considered non-standard (though valid) for a transaction to have more than one OP_RETURN output or an OP_RETURN output with more than one pushdata op.
legendary
Activity: 3584
Merit: 5243
https://merel.mobi => buy facemasks with BTC/LTC
If you do this, you'll be bloating the utxo set... The outputs you create can never be spent so they'll be in each node's utxo set forever...

An alternative is using op_return to avoid utxo bloating: https://en.bitcoin.it/wiki/OP_RETURN
legendary
Activity: 2618
Merit: 2304
Can i write text more than 20 characters?
Yes. Also you can use the script of the transaction to embed some text as Satoshi Nakamoto have done in the genesis block of Bitcoin.

Code:
PUSHDATA(65)
[0496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858ee]
CHECKSIG

Read more here:
https://en.bitcoin.it/wiki/Script
newbie
Activity: 13
Merit: 0
Maybe you have some online-service for make hex-code and bitcoin address?

Here you go.
To convert a string to hex, use this website.
Make sure the string you're converting to hex is 20 characters (spaces count as characters), so they can be 40 characters (20 bytes) when you convert to hex, which is equivalent to the Hash160 of the public key.
For example if we use
Code:
test post pls ignore
as our text we want to insert in the blockchain, we'll use the website above and we get
Code:
7465737420706f737420706c732069676e6f7265
as the hexadecimal.

Next we need to convert the Hash160 above to a bitcoin address. For that we'll use this website
When we paste the code above to the Hash160 field, we get the following bitcoin address:
Code:
1BcSvC4eTCXHFDXWrqi9TrZBg4WxDSok78

To get our message into The blockchain, we simply send some bitcoins to the address generated.
Send a minute amount of bitcoins because you can't recover them at all.

So to test this, I sent 600 sats to the address, you can see the Transaction here
If you want to see your message, you have to select "show scripts and Coinbase"
Then look at the output script for the transaction, you'll see
Code:
DUP HASH160 PUSHDATA(20)[7465737420706f737420706c732069676e6f7265] EQUALVERIFY CHECKSIG
Something looks familiar, it's our message in hex:
Code:
7465737420706f737420706c732069676e6f7265
To convert it to string to read what it says, use this website And paste it there.
It gives us back our message
Code:
test post pls ignore

Cool!
Can i write text more than 20 characters?
sr. member
Activity: 322
Merit: 363
39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD
Maybe you have some online-service for make hex-code and bitcoin address?

Here you go.
To convert a string to hex, use this website.
Make sure the string you're converting to hex is 20 characters (spaces count as characters), so they can be 40 characters (20 bytes) when you convert to hex, which is equivalent to the Hash160 of the public key.
For example if we use
Code:
test post pls ignore
as our text we want to insert in the blockchain, we'll use the website above and we get
Code:
7465737420706f737420706c732069676e6f7265
as the hexadecimal.

Next we need to convert the Hash160 above to a bitcoin address. For that we'll use this website
When we paste the code above to the Hash160 field, we get the following bitcoin address:
Code:
1BcSvC4eTCXHFDXWrqi9TrZBg4WxDSok78

To get our message into The blockchain, we simply send some bitcoins to the address generated.
Send a minute amount of bitcoins because you can't recover them at all.

So to test this, I sent 600 sats to the address, you can see the Transaction here
If you want to see your message, you have to select "show scripts and Coinbase"
Then look at the output script for the transaction, you'll see
Code:
DUP HASH160 PUSHDATA(20)[7465737420706f737420706c732069676e6f7265] EQUALVERIFY CHECKSIG
Something looks familiar, it's our message in hex:
Code:
7465737420706f737420706c732069676e6f7265
To convert it to string to read what it says, use this website And paste it there.
It gives us back our message
Code:
test post pls ignore
hero member
Activity: 672
Merit: 526
There is no such service. Besides, it would be very expensive to write something extensive. You will lose money and still be harmful to the entire network. What you can do is write using the options of signing an address using the option on wallets.
newbie
Activity: 13
Merit: 0
How I can write text or images in blockchain of bitcoin?

Example: https://bitcoinsays.com/930a2114cdaa86e1fac46d15c74e81c09eee1d4150ff9d48e76cb0697d8e1d72

Quote
How to put your own message in the blockchain
It's pretty easy to put your own 20-character message into the blockchain. The following steps explain how.
1. Take your 20-character string and convert it to hex. E.g. in Python:
'//righto.com/bc'.encode('hex')
2. Convert the resulting hex string to an address. An easy way is online: https://blockchain.info/q/hashtoaddress/your hex value yields 1AXJnNiDijKUnY9UJZkV5Ggdgh36aWDBYj.
3. Send bitcoins to that address and your message will show up in the blockchain when your transaction gets mined. Important: those bitcoins will be lost forever, so send a very small amount, like 10 cents. My test message can be seen at the end of blk00113 here.

I`m not coder, it`s very hard for me Smiley
Maybe you have some online-service for make hex-code and bitcoin address?
Jump to: