A blockchain is a cryptographically secured distributed append-only datastore which persists data in a linked list of blocks. Most have heard of blockchains as the underlying technology for crypto currencies, but its incorruptible nature makes it a useful datastore in environments where hardware can become faulty or bad actors have an interest in changing the data for their own benefit.
A second generation blockchain such as Ethereum allows you to run custom programs (“smart contracts”) on the blockchain to solve much wider problems than just dealing with simple (financial) transactions, which is what first generation blockchains are limited to. An interesting requirement for smart contracts is that they need to be reproducible so that old blocks can be verified, i.e. the data stored in a block is the correct result of applying all transactions from that block against the data from the previous block.
We can easily draw a diagram to represent a developer’s perspective on blockchains that is very similar to Redux. Smart contracts and the consensus mechanism are taking transactions and process them to change the data.
Now imagine a Redux implementation where the Store is really a blockchain store. Or, imagine a second generation blockchain that is as developer-friendly as Redux. Once you have that visualized, you actually have a pretty accurate picture of Interbit, a new private and scalable blockchain we are building at BTL.
The term Covenant might be unexpected. We chose it because “smart contract” is really a misnomer as it’s neither “smart” nor a “contract”. Venkatesh Rao explains the difference in Blockchains Never Forget.
More important for Redux developers is to know that the covenant includes plain Redux reducers, i.e. pure functions that take an action and the current state, and then return the new state. Pure reducers are a perfect fit for covenants because they provide the required reproducibility. The rest of Interbit should be just as familiar. Actions in Interbit are ordinary Redux actions in that they’re a plain object with a type and a payload. And the Interbit store has the same interface as the Redux store so we can subscribe to it, dispatch actions into it, and get the current state using
getState(). The only notable difference is that
dispatch(action) returns a promise that resolves once the action has been reduced and added to a block.
You don’t really need to know anything about the Consensus part because Interbit is dealing with that automatically. It is however an important part of the diagram because if the blockchain network does not reach consensus on an action that was dispatched into the store, the action and the reducer’s result for that action won’t be added to the chain, i.e. they are not persisted in a block.
Author: Christian Pekeler
Christian Pekeler has two decades of experience crafting software for various industries. He is leading BTL’s engineering team that is creating the core technology powering Interbit.