3

On the bitcoin blockchain, you can write a string as an OP_RETURN value and then when the block is seen on a block explorer, you see the string.

I want to do the same thing. I want to write a string to a private Ethereum blockchain.

Can anyone suggest a way?

Another way to ask: how would you propose to a girl on the Ethereum blockchain?

EDIT: I no longer believe this needs re-opening. I agree that I literally posted the same question twice.

stone.212
  • 1,994
  • 1
  • 19
  • 38
  • Yes this is a straight duplicate. I literally posted twice because I forgot that I had posted once. The answer is to include the data as hex, but view it on the blockchain explorer as ASCII if the explorer has the conversion feature. – stone.212 Nov 11 '17 at 01:13

1 Answers1

1

You could mine a block and add arbitrary string to extraData field. Or you can put your string to the input data of a transaction.

You can find the description of extraData in the yellow paper:

extraData: An arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer; formally Hx.

When using geth with --mine option you can also set the extra data:

--extradata value Block extra data set by the miner (default = client version)

You can see Extra Data on Etherscan https://etherscan.io/block/4518843


You can find the description of the input data in the yellow paper as well:

data: An unlimited size byte array specifying the input data of the message call, formally Td.

You can set it when sending a transaction in JS console in geth inside the transaction object:

data: String - (optional) Either a byte string containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code.

medvedev1088
  • 10,996
  • 5
  • 35
  • 63