The basics of blockchain protocols

Where there are systems, there are protocols – and managing a decentralised ledger requires some of the most dynamic and inventive protocols of them all!
To get you familiar with the concept in this article we will answer:
- What are protocols?
- What are protocols in blockchain?
- What happens when protocol isn’t followed?
What are protocols?
A protocol is a set of rules that govern a system or collection of procedures. More specifically, in computer science, a protocol is a set of rules or procedures that govern the transfer of data between two or more electronic devices. The protocol helps to establish how the information exchanged between two or more devices needs to be structured and how each party will send and receive it. Some examples of key protocols we use every day are the internet protocols: TCP/IP, HTTPS, and DNS.
What are protocols in blockchain?
Protocols in the realm of blockchain are a bit broader than in general computer science. Rather than just outlining the rules for data transfer, a blockchain’s protocol outlines the whole series of rules needed to govern the distributed ledger. Therefore, a blockchain’s protocol is the predefined set of rules which must be agreed upon by all of the participating nodes or peers in the network. Each blockchain that is developed has its own unique protocol in which it defines its objectives and design.
Slightly confusingly, the sections of a blockchain’s protocol (or the whole set of rules) are divided up into 3 distinct categories, which are also referred to as protocols. These should include:
- Networking protocol: This is the blueprint for communicating between nodes on the network. Amongst other things, this protocol determines gossiping transactions, blocks, consensus messages and how to find other nodes/peers (peer discovery). It can be seen as the traditional part of the protocol which stipulates how data should be transferred in a way that can be understood by all the participating nodes.
- Consensus protocol: The consensus protocol outlines how the network agrees upon the next canonical block in the chain. For example, in Bitcoin’s protocol, nodes must always use the longest chain available and check that the block has the correct nonce (aka the proof of work). The consensus protocol for a proof of stake network determines which blocks (transactions) are correct, which validator node can make them, any rewards incentives/disincentives for blockchain security.
- State transition function: The state of a blockchain is whatever the blockchain thinks to be true at that particular moment. This function literally defines the movement of a node from one state to another. More simply, this is the part of the protocol which determines what the blockchain will actually do as a result of a transaction on the network. It’s where the business logic of a blockchain can run and the more exciting behaviours of a blockchain network take place.

The above diagram shows how these protocols work together in a blockchain node.
1. Any transaction is first communicated via the network protocol.
2. The consensus protocol then determines whether the data adheres to the consensus checks. If it does then it will make it into a block.
3. Finally, the information in the transaction is processed by the state transition function, which takes the block information and decides what result or behaviour to perform. This could be something simple, like changing someone’s wallet balance, or more complex behaviours requiring smart contracts.
State Transition Function: where the magic happens
At this point in blockchain history the networking and consensus protocols are fairly standard tools. Obviously they are still incredibly important to the running of the chain, but they do more of the basic functions required to make the blockchain actually work. It’s the state transition function that really stands out within each blockchain and differentiates each one.
In older blockchain’s like Bitcoin, the state transition function merely changed wallet balances in relation to the currency transitions happening on its network. Newer blockchain networks have since taken this precedent and given it new life. Using a concept called smart contracts, the state transition function can now be used to perform just about any action that a non-decentralised programme could. This is where DApps functionality sits. DApp developers can create smart contracts which communicate with this area of the protocol to allow an infinite variety of actions to take place within the blockchain.
CENNZnet’s state transition function has taken this a step further. Rather than have DApp builders create their own complex smart contracts to communicate with the protocol, CENNZnet provides a selection of pre-built core services within the actual protocol. These pre-built services or modules provide a lot of the basic functions that all DApps will need. So rather than having each DApp developer build them individually from scratch, all they need is a much simpler form of smart contract to tap into the ready-made service. You can learn a bit more about these modules in our next article.
What happens when protocol isn’t followed?
In a blockchain, every transaction that takes place must be processed by every participating node. By using the protocols, every node will process the transaction identically. This means that at the end of every transaction the state (record of the blockchain) of each node will be identical. Each node comes independently to the same conclusion, this is the basis of what makes the ledger decentralised and is known as deterministic.
If a node doesn’t follow protocol for a transaction, then it’s state will be different to every other node in the chain. As blockchain records are permanent and cannot be erased, this forever changes the node’s copy of the decentralised ledger and means it can no longer interact with the rest of the chain. This is what’s known as a fork. The node which didn’t follow protocol is now unable to take part in the chain.
This is really important for the safety of the network as it means that nodes who deliberately don’t follow protocol, for personal or malicious purposes, are immediately separated from the blockchain so that they cannot impact the state of the whole chain.