20

Some mining pool admins put custom data in block headers, like prayers. How do they do that? Where can I see that data for myself?

3
  • fair enough, can we now get one high-level answer that clarifies there are (at least) two ways that people have put messages and other custom data into the block chain? Sep 14, 2011 at 22:54
  • 1
    You can't embed ANYTHING in the block header. You can embed data in the block itself. The two methods are via the coinbase transaction or via a "dummy transaction". Neither of which put anything in the block header. Oct 25, 2011 at 14:13
  • People have written messages in the blockchain using etchablock.com - see blockexplorer.com/tx/… for an example. Feb 12, 2012 at 7:00

4 Answers 4

18

When you generate a block, the generation transaction (the one that creates new coins) has an attribute called coinbase. It's a special value you can put anything you want in to make the block unpredictable to others (and this is good).

So, naturally, you can put text in this attribute, although most just put mining-related information that is not human-readable (nonce and extra-nonce).

You can read this coinbase by using a patched bitcoin node that can dump blocks, for example with the "dumpblock" or "getblockbyhash" patches.

Or you can just print every string in the blockchain database directly : strings -n 20 blk0001.dat

Example for the 1st block:

Coinbase: 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

ASCII-translation: ᝣᝣᝣᝣᝣᝣᝣEThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks

This is what is used by the Eligius pool ; it puts prayers in this field.

3
  • Actually, that's not the most efficient way to store information in the blockchain. See my comment.
    – Mononofu
    Aug 30, 2011 at 21:30
  • True, it may not be the most efficient way, but it definitely is the easiest way (both for putting messages and reading them).
    – Artefact2
    Aug 30, 2011 at 21:34
  • That pident.artefact2.com/b/0 link is dead. It tells me "[...] is no longer available on this server and there is no forwarding address. Please remove all references to this resource." Feb 17, 2012 at 19:38
7

Dan Kaminsky explained his method and motivations for inserting images into the blockchain at a talk at Black Hat USA 2011 - the relevant slides (12 -20) from the presentation can be found here.

His basic method was to create transactions with lots of outputs and to include the message in ASCII, in pieces, in the receiving address field of the output scripts. You can see the corresponding hex codes for the ASCII in his message in the raw transaction. You can see that the message is interrupted by the other transaction fields, so you can only see the messages properly if you look with a tool (such as strings) that filters out non-printable characters and displays printable characters in lines. His transaction required a .15 bitcoin fee, about $1.50 at the time.

2
  • Can you provide a little bit of info in the answer besides the link?
    – ripper234
    Sep 2, 2011 at 6:53
  • yes a slight explanation of the method used would be great. Sep 3, 2011 at 4:30
5

There was a very interesting talk at Chaos Communication Camp this year on this topic. IIRC, you can store arbitrary information in bitcoin transactions, since they actually contain "programs" specifying how the transaction should be verified.

Information on the 'scripting' interface can be found here. See section 2.3 for details on imbedding messages.

2
  • The question is about embedding data in block headers, not about transactions.
    – nmat
    Aug 31, 2011 at 1:02
  • 6
    @nmat: Well, if you're going to take it literally, then the answer is that you can't. At least, not by any means that are remotely practical. (The header is too small and most of the fields are compelled.) Aug 31, 2011 at 10:22
-2

The hacker was Dan Kaminsky, and he embedded this image in the blockchain.

This is right now just a technological curiosity, it has no known implication on the legal or technical aspects of Bitcoin. I haven't read his paper, but he must have used a modified miner that searches for hashes that begin with a preset prefix.

Let's clarify: Mining is the process of finding solutions (or hashes) to a cryptography equation. The first to find a solution gets to have his solution added to the blockchain - the permanent transaction record. What Kaminsky did was look for a particular kind of hash instead of just any random hash, that contains the embedded test. Once this was found (just a matter of running a miner for a long enough period), this specific solution, with the embedded text, was added to the blockchain.

6
  • can you write a sentence or two about what that means (ie; how does one embed an image in a list of transactions). trying to get an answer here that shows no one had access to the blockchain to "change transaction data" or something similar. Aug 30, 2011 at 23:49
  • @lemoginger - does my extended answer answer your question?
    – ripper234
    Aug 30, 2011 at 23:55
  • I think so. I actually didn't understand how that worked myself :) Aug 31, 2011 at 0:02
  • Are you sure about this? According to this he did it using transactions with special destination addresses
    – nmat
    Aug 31, 2011 at 0:40
  • 1
    @nmat - not sure at all, I had assumed this was how it was done. (Mother of all ****ups). Please post another answer.
    – ripper234
    Aug 31, 2011 at 0:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.