Blockchain Internals

Ozone chain is an open source platform based on blockchain technology that enables developers to build and deploy decentralized applications including smart contracts.

Fundamentals of Ozone Chain

Ozone chain is a platform that facilitates peer-to-peer communication, smart contracts and applications via its own native currency called OZO. The primary purpose of Ozone is to facilitate and monetize the working of Ozone Chain to enable developers to build and run distributed applications (called Dapps).

The implementation

Ozone chain is based on a java implementation of the Ethereum protocol, and provides almost a replica of Ethereum features and benefits. Ozone chain provides an additional layer on top of Ethereum that enables it to perform transactions within a private network but also makes it more flexible by using different consensus algorithms. Ozone chain was designed as a private implementation of Ethereum that supports the enterprise requirements of transaction privacy and contract privacy.

Merkle trees

A Merkle tree is a binary tree of cryptographic hash pointers, hence it is a binary hash tree. In Ozone chain, the merkle trees are constructed by hashing paired data, particularly the transactions at the leaf level, then again hashing the hashed outputs all the way up to the root node, called the Merkle root.

In Ozone chain, there are three Merkle roots in total as follows:

  • stateRoot: It helps maintain the global state.

  • transactionsRoot: It tracks and ensures integrity of all the transactions in a block.

  • receiptsRoot: It is the root hash of the receipts trie corresponding to the transactions in a block.

The Merkle tree is tamper-proof. Merkle tree is hashed in with other metadata and included in the header of the subsequent block. Tampering at any level in the tree would not match with the hash stored at one level up in the hierarchy, and also till the root node. It becomes impossible for an adversary to change all the hashes in the entire tree. Thus it guarantees the integrity of the order of transactions.

Ethereum Virtual Machine

Ozone chain is a Turing complete blockchain framework, as it gives a foundation to programming languages using which Smart contracts can be written to solve any reasonable computational problem. Ozone chain is controlled by the Ethereum Virtual Machine (EVM), a consensus-based virtual machine that decodes the compiled contracts in bytecodes and executes them on the Ozone chain network nodes. It also uses algorithms to prevent denial-of-service attacks that are widely observed in cryptocurrency markets.

The Ozone chain blockchain network can be modelled as a group of EVMs, or nodes, connected to every other node in a peer-to-peer mechanism. Each node consists of a copy of the entire blockchain data store and competes with other nodes to produce the next block by validating transactions. If a new block is added, the blockchain gets updated and is propagated to the entire network so that every node is in sync.

Smart Contracts

Ozone chain has support for turing-complete languages through the EVM which makes it easy for the developers to create blockchain applications. The scripts written in a Turing-complete language are automatically executed in case a predefined event occurs. The Smart contract would run on the EVM on each and every node in the Ozone chain network making it censorship resistant.

Ozone chain smart contracts are written in Sollidity though other languages like Viper and LLL are supported. Solidity is a high-level language that gets run on the EVM after being translated to bytecode, a low-level language that the EVM understands.

Instead of using Solidity, Ozone chain also supports writing the whole contract in low-level assembly language using opcode. Though, assembly language is far more complex and difficult to write and maintain.

Smart contracts in Ozone chain permit trusted transactions and agreements to be carried out among disparate, anonymous parties without the need for a central authority, legal system, or external enforcement mechanism. They render transactions traceable, transparent, and irreversible.

Consensus protocol

Ozone chain implements the QBFT Proof of authority (PoA) consensus protocol. PoA consensus works when participants know each other and there is a level of trust between them. For example, in a permissioned consortium network. PoA consensus protocols have faster block times and a much greater transaction throughput.

PoA consensus method gives a small and designated number of blockchain actors the power to validate transactions or interactions with the network and to update its more or less distributed registry. According to the chosen scheme, one or more validating machines are responsible for generating each new block of transactions that will be included in the Blockchain. The new block can be accepted directly without verification, or by unanimous vote of the block generators, or simply by a majority, depending on the configuration chosen for the Blockchain.

Unlike the proof-of-work mechanism, commonly referred to as “mining”, there is no technical competition between validators here. This consensus mechanism requires almost no computing power, and therefore almost no electricity for its operation.

Since the PoA requires only a limited number of actors, the network can afford to update the blockchain more frequently by reducing the time between each block (blocktime) and process more transactions (blocksize) for processing fees close to zero (Transaction fees).

Node Types

Each node of the network consists of a copy of the entire blockchain data store. If a new block is added, the blockchain gets updated and is propagated to the entire network so that every node is in sync. Ozone chain network nodes are categorized into two types:

  • Validator nodes: The validator nodes or mining nodes are the ones which form the core of Ozone chain network. They have the responsibility of receiving transactions from client, bundling those transactions into a block, and generate a block. The newly generated block is then broadcast to all the validator and non-validator nodes connected to this node.

  • Non-validator nodes: The non-validator nodes sync with validator nodes and passively receive block data and append them to their respective ledgers. They do not take part in generating blocks.

Network Topology

Ozone chain network is a group of nodes, connected to every other node in a peer-to-peer fashion in a mesh topology. Each node is connected to the other node through a quantum tunnel that secures the bi-directional communication using lattice-based post-quantum cryptography.

Syncing nodes

The Merkle root is a single hash summarizing all of the transactions contained in the block in a way that guarantees their integrity. The advantage of having the Merkle root on the block header is that a client can synchronize the blockchain in a faster way by retrieving the block headers, rather than the entire transaction history, from the network peers. This is generally called light synchronization and ozone chain supports this.

Database efficiency

Merkle tree structure in Ozone chain is fully deterministic: two Patricia trees with the same (key/value) bindings will always have the same root hash, providing increased efficiency for common database operations such as inserts, lookups, and deletes.

Internally the EVM uses three different types of memory location for saving smart contracts and related data: storage, memory, and stack for efficient data access.

Gas

Gas is the fuel that powers an Ozone chain network. In this private blockchain network, to incentivize validators to work on validating the transaction, the transaction creator assigns a particular amount of gas to the transaction, which has to be paid to the validator who produces the block containing the transaction. Ozone chain has set a minimal gas price of 5 gwei for every unit of gas used.

If the gas used by the transaction is less than or equal to the gas limit, the transaction succeeds. If the total gas exceeds the gas limit, then all changes are reverted, except that the transaction is still valid and the fee can still be collected by the validator.

JSON-RPC

Ozone chain provides JSON-RPC APIs for other applications to communicate with it. Ozone chain nodes serve JSON-RPC APIs using HTTP, WebSocket, and other protocols. The APIs provided by JSON- RPC are divided into these categories: admin, debug, eth, miner, net, plugins, trace, txpool, and web3.

Last updated