TL;DR — Yes, and No. It depends on what data you are talking about and how it is stored.
This post is part of a series on Blockchain Architecture by Jared Stauffer. The next post is What Data Should be Stored on Blockchains and Why.
One of the core tenets of blockchains is that they are an immutable, unchangeable, permanent record. The theory goes that you can write some data to the blockchain and it will be there, unchanged (immutable), forever.
But is that blanket statement true? What about smart contracts and how you can write data and then update it?
To answer these questions, we must first understand what data is stored, and how it is stored.
Ethereum data is stored in four ways: transactions, data (or input) in a transaction, inside smart contracts, and events. Which one of these are immutable?
This is the part of blockchain you have likely heard about. Everything that happens in a blockchain happens via a transaction. When a transaction is submitted, if accepted, it becomes part of a block, and forms a permanent part of the blockchain.
Transactions contain information that the person (or entity) submitting the transaction wants recorded on the blockchain. Without getting overly technical, each blockchain transaction contains: to, from, amount, and data. Transactions can also do things like create and interact with smart contracts.
Ethereum Blockchain transactions and all of the information they contain, are immutable. 👍
Part of a transaction is a field simply called input. This field is used to store information in the blockchain and to make function calls to smart contracts.
An example of a call to a smart contract can be seen in this transaction. The link is to a view of a transaction using Etherscan. Since Ethereum is a public blockchain, we can use a block explorer like Etherscan to view the contents of the transaction. In this transaction a contract is being called with a request to transfer 0.19 OMG tokens from the one Ethereum wallet to another. In the transaction input, towards the bottom, click on “Click to see more” and the transaction input field will be revealed. In that field you will see “Function: transfer(address _to, uint256 _value)”, the requested function call to the smart contract.
An example of a transaction made just to store data/text in the blockchain can be seen in this transaction. Open the link, click on “Click to see more”, scroll down to Input Data, select “View Input As” and choose “UTF-8”. You will then see the text stored converted from Hexadecimal to Ascii (regular readable text). The text stored here also has an interesting story behind it, read more here.
Another example of using the transaction input field to store data is Utah County partnering with Titan Seal to store hashed marriage licenses on the Ethereum Blockchain.
Ethereum Blockchain transaction input field data is immutable. 👍
A smart contract is a set of instructions, saved on the blockchain, that can be called to perform certain functions. For example, a smart contract could store voting information. A person could call the smart contract, it would record who called it, and then it could record a vote from them — stored as data inside the smart contract, on the blockchain.
Because a smart contract can be programmed to do whatever you want it to, it can be programmed to update its’ own stored data. Now technically the update is being done to the current state (or block) of the stored data, but it is an update nonetheless.
A smart contract could be programmed to only store data. The developer could simply choose to leave out the function that could change the data.
Therefore smart contract stored data can be immutable, if the developer of the smart contract chooses to make it so.
Ethereum Blockchain smart contract data can be immutable and mutable (changeable). 👍 👎
Smart contracts can emit events. A smart contract event is like a public announcement on the blockchain that something has occurred. For example events are often used to record that a certain amount of cryptocurrency has transferred from one account to another.
Events are used for logging (a common development practice that enables auditing and assists with bug fixes) and as an inexpensive (blockchain transaction cost) way to record and retrieve data from the blockchain.
Events are emitted and cannot be updated.
Ethereum Blockchain events are immutable. 👍
Understanding what parts of a blockchain are immutable is an important part in creating a solution to utilize it. Blockchain immutability refers to transactions and the data they contain. When used correctly, blockchains form a powerful tool to provide transparency and collaboration in ways that were previously not possible.