This content originally appeared on Level Up Coding - Medium and was authored by Henrique Centieiro
From wedding proposals to political messages, people have been writing uncensorable messages all over the Ethereum blockchain. Learn how to write these messages and immortalize them on the blockchain!
Let’s continue to have fun with Etherum and learn how to write and read a message on the Ethereum blockchain.
As we all know, Ethereum is a decentralized network of computers. Currently, there are over 11 000 Ethereum nodes that replicate all the data on the Ethereum ledger. This means that any message, transaction, smart contract, or DNS domain on the Etehreum blockchain is replicated 11 000, ensuring the immutability and resiliency that make blockchain such an awesome technology. This is also what makes blockchains like Ethereum censor resistant. No one, not even a big despotic country, can block or censor a public blockchain. This is also why so many people write political messages on the blockchain. There are even projects that were developed to preserve history from being deleted by censorship by using blockchain.
Messages that, if written on social media or on a website, could lead that message to be deleted or, even worse, lead to the prosecution of that person. However, because blockchains are decentralized, they cannot be controlled or deleted.
The very first political message recorded on the blockchain was written by Satoshi Nakamoto - “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks” - and it was recorded on the genesis block (the very first block) of the Bitcoin blockchain.
Nowadays, anyone can write one of these immutable messages on the blockchain.
Where can we find the Ethereum message field?
Every Etehreum transaction has a bunch of fields similar to what you can see below. In the transaction data, the field “input” is where we can find a message.
These messages are used for different purposes. First, they can be used to provide any additional information on a transaction. Second, they can be used by smart contracts as an additional field to allow the smart contract to execute some function or be used to send tokens on the Ethereum blockchain. Finally, they can also be used to record really any message that you may want to immortalize.
Let’s see an example:
I have created a transaction and embedded a “secret” message there. All the transactions have a transaction hash that identifies the transaction and in this case the hash is “0x813850ba423fe4a7e38d89c0c4a1d0a166f58f9d369778086b3b1a28edf92bc0” (you can click to see in on Etherscan, an Ethereum block explorer). This transaction was included on block 11792873, and it contains a message written by myself. Let’s look at the transaction:
You can notice that the transaction value is zero. This is because the sender only had to pay gas to process a transaction, but he doesn’t need actually to send any value.
The message is in the input field and it is 0x49204c4f564520554e424c4f434b434841494e but… WTF, how am I supposed to read those random characters?
The message is written in hex and not human-readable, but we can easily convert it. If you have a python command prompt, try the following commands to convert a hex string to UTF-8 text:
import codecs
codecs.decode(“hex string”, “hex”).decode(‘utf-8’)
If you don’t have python on your computer, you can just use an online hex to text converter to convert the message to text ?
Back to python, we could write a few code lines to automate this but simply copy the input field without the 0x and run the command for the sake of the example. Let’s decode the input of the above block:
Yay, so the message that I permanently wrote on the blockchain is “I LOVE BLOCKCHAIN”! ?
Messages in the Ethereum blockchain are immutable, meaning that no one can ever change it, and it is censorship-resistant. As a result, people have been writing love messages, marriage proposals and political messages all over the Ethereum blockchain.
How to write a new message on the Ethereum Blockchain
To write a message on the Ethereum blockchain, you need to have an Ethereum wallet with some Ether to pay the gas fee, and you need to connect to a wallet interface such as MEW — My Ether Wallet:
Then, you need to insert your message in hexadecimal value starting with 0x (you can convert your text message to hex in one of the many online converters). Then, click send, and your message will live forever in the blockchain!
Digesting the simple steps to write a message:
- Get an Ethereum wallet compatible with My Ether Wallet (Metamask is pretty easy to use)
- Transfer a little bit of Ether to your wallet to pay for gas fees (a few USD worths of Ether is enough)
- Open My ether Wallet and connect to your wallet
- Send a new transaction with zero amount and write the message in hexadecimal (can use the online converter)
To check this message, you could also visit a block explorer such as Etherscan.io and check the message:
ERC20 token transfers also use messages
I randomly selected another transaction that has an ERC20 token transfer to a smart contract. So this kind of message looks something like this:
To read this hexadecimal message, we would have to break it into smaller groups. The 0x, as we already know, means that this is a hex message. The subsequent 8 bytes “a9059cbb” is the function identifier. After that, every 32 bytes is a section of the message corresponding to the address and the amount. A smart contract would interpret this message as transfer(address,uint256)
The message would look something like this
MethodID: a9059cbb
Address: 000000000000000000000000a440e021f3f18294595489292987e0dc273c1fc5
Amount: 000000000000000000000000000000000000000000000000001047ab243800
Aight! I hope it was useful! If you have any questions, please let me know in the comment section!
? Follow my Medium, and please also check my ? blockchain courses:
? The First Ever Dogecoin Course
?? Fintech, Cloud and Cybersecurity Course
?? Unblockchain Course — The Brain-Friendly Blockchain Course
How to create a permanent uncensorable message on the Ethereum blockchain was originally published in Level Up Coding on Medium, where people are continuing the conversation by highlighting and responding to this story.
This content originally appeared on Level Up Coding - Medium and was authored by Henrique Centieiro
Henrique Centieiro | Sciencx (2021-07-27T14:41:11+00:00) How to create a permanent uncensorable message on the Ethereum blockchain. Retrieved from https://www.scien.cx/2021/07/27/how-to-create-a-permanent-uncensorable-message-on-the-ethereum-blockchain/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.