The first part of this series describes Determinism.
In this article, we will explore one fundamental principle that every blockchain follows, determinism. The term determinism means that if we enact the same operational steps in a specific order, we reach exactly the same result as anybody else who follows the exact process. This property makes blockchains powerful.
Many articles about blockchains talk about their benefits, such as decentralization and transparency, without mentioning one key mechanism that makes blockchains capable of doing what they do: determinism. For some, it could be too obvious even to mention, while for many it is a missing concept in the entire blockchain puzzle, preventing them from fully understanding it. This article attempts to shed some light on the workings and importance of determinism in blockchains.
Let's start with the basics.
Determinism is the philosophical belief that all events are determined completely by previously existing causes. It is the concept that events within a given paradigm are bound by causality in such a way that any state (of an object or event) is completely determined by prior states.
Sages are playing Chess
Two wise men of ancient India measured their prowess in a game of chess. The whole empire was rife with anticipation for the game's outcome and wanted to learn from the sages' mastery. Therefore, a detailed record of each move made in the match was documented. Unfortunately, the game could not be finished because of a call to arms in a neighbouring land.
Now imagine a similar chessboard to the one mentioned in our story with all the pieces still in place in a museum today, along with the original record of the game. Since a game of chess has a fixed initial state, and is deterministic up to the last known move, it is possible to use the record of the players' moves to recreate the board state at any point in the game, even many centuries later, and on a different chessboard.
Thanks to this, we can study the techniques of both of the sages, as well as revert the game to any point before it was interrupted, and even continue it in their stead. Because of determinism, the location, playing field or time of the game become immaterial.
Game of Chess that can be reproduced
The term Determinism in Computer Science refers to a system where the future state of the system is entirely determined by the prior state.
Determinism means that we reach exactly the same state like everybody else if we enact the same operational steps in the same order. This property makes a blockchain what it is.
Fundamentally, a blockchain's decentralization and censorship resistance features are possible because every node in the network validates every transaction in a deterministic fashion and all agree on the system's current state.
When new blockchain users create blockchain-based wallets, for example, they have to wait for the application to synchronize with the current state of the blockchain. This synchronization is a required step before they can interact on the blockchain. Having a fully synchronized wallet allows them to send & receive funds with 100% certainty that they follow the rules and create a valid record of all transactions. Then, this transaction record is stored on the blockchain for anybody to validate. It also gives the users full control over their funds, and no 3rd party can freeze or move them. The control over funds is assured by public/private key pair cryptography (no other party can sign a transaction other than the key owner). The process of reaching an equal state on every node thanks to determinism is the protection system against double-spending, which is the fundamental problem that the system as a whole solves. The double-spending problem will be covered in its own article called: “51% Attack.”
Determinism, in the context of blockchains, refers to the fact that every node on the network will produce the same transaction order. Any difference between the nodes for the same operation would lead to a failure in consensus, since storing this data on the distributed ledger would lead to an inconsistent ledger state.
For example, every new full node that joins the blockchain network has to replay all past operations and end up in the same ledger state as existing full nodes. For example, if you decide to run a full node on the RSK blockchain, you will need to synchronize all blocks in all of RSK’s history and check all smart contracts on this chain before you can operate as a node to validate and process new blocks.
To illustrate further, because of the element of determinism, the RSK blockchain does not allow calling 3rd party APIs, such as a stock price feed. Not allowing 3rd party APIs to be directly implemented at the consensus layer is necessary because one can never be sure if this API will always be reachable or running correctly. What if one or many countries terminated this API due to local internet censorship policies? How would you then run an RSK node when this API, which had already been used in some transactions, is not working for certain parties on the network? For example, the API could report that on August 30 2019, two countries entered into a trade agreement - which would then become a part of the validation chain. However, if the API got shut down in another country, nodes located in that country would not report the trade agreement anymore and, as a result, the blockchain would not be possible to validate.
It is possible to use a 3rd party API in a smart contract by plugging in an oracle as an off-chain data source (to bring non-blockchain data to the blockchain smart contract) but 3rd party APIs are not implemented at the blockchain consensus layer. I will describe the concept of oracles and the role they play in the context of smart contracts in the later part called Blockchain contracts.
Extension of the previous topic
Blockchains do not rely on any factors that are unique to each end-user for consensus. For example, a consensus rule that relies on randomness created locally on a full node's machine wouldn't work because the result would be different on each user's computer, causing each user to split off from the network. To reach consensus, the users must all share identical data and be able to use the data to compute the same results using the same protocol with the same consensus rules. That's determinism in a blockchain context.
Determinism is one necessary element for fostering decentralization and enabling censorship-resistant transactions, two core features of any consensus-based blockchain. If past transactions could not produce the same result every time they are executed, regardless of where or by whom the transaction is executed, then achieving consensus would be impossible; blockchains would lose their power of constant tamper-proof data integrity.
Now you understand that our bitcoin is safe on the Bitcoin blockchain, in large part, thanks to the property of determinism. In the next part of this series, we will cover the Proof of Work consensus algorithm.
Congratulations. You made the first step in becoming a blockchain expert.
See You in the next episodes about "Mining", "Miners", and the Proof of Work algorithm.
Until then, stay Sovryn!
Have you enjoyed reading this episode? Head over to the Sovryn Dojo database full of technological episodes about blockchain technology, written in plain English with the aim to foster basic knowledge in blockchain newcomers.