Bitcoin Forum
December 13, 2024, 02:21:34 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Write text/image in blockchain of bitcoin  (Read 254 times)
ptdima (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
April 03, 2018, 12:58:51 PM
 #1

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?
vit05
Hero Member
*****
Offline Offline

Activity: 672
Merit: 526



View Profile
April 03, 2018, 02:03:34 PM
 #2

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.
Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 363

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
April 03, 2018, 03:00:19 PM
Last edit: April 03, 2018, 03:15:12 PM by Xynerise
Merited by ABCbits (3), achow101 (2), Rath_ (2), fronti (1)
 #3

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
ptdima (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
April 03, 2018, 03:56:23 PM
 #4

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?
Coin-1
Legendary
*
Offline Offline

Activity: 2660
Merit: 2332



View Profile
April 03, 2018, 07:26:45 PM
Last edit: April 03, 2018, 07:43:50 PM by Coin-1
 #5

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
mocacinno
Legendary
*
Offline Offline

Activity: 3598
Merit: 5277


https://merel.mobi => buy facemasks with BTC/LTC


View Profile WWW
April 03, 2018, 07:32:00 PM
Merited by ABCbits (1)
 #6

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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Coin-1
Legendary
*
Offline Offline

Activity: 2660
Merit: 2332



View Profile
April 03, 2018, 07:40:13 PM
 #7

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.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3570
Merit: 6927


Just writing some code


View Profile WWW
April 03, 2018, 08:39:00 PM
 #8

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.

amaclin1
Sr. Member
****
Offline Offline

Activity: 966
Merit: 383


View Profile
April 03, 2018, 09:26:50 PM
 #9

https://bitcointalk.org/index.php?topic=1023190.0
https://github.com/petertodd/python-bitcoinlib/blob/master/examples/publish-text.py
Xynerise
Sr. Member
****
Offline Offline

Activity: 322
Merit: 363

39twH4PSYgDSzU7sLnRoDfthR6gWYrrPoD


View Profile
April 03, 2018, 09: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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!