From On-Chain to Off-Chain: Looking Behind the Scenes of Bitfinity's EVM Components

Discover the hidden secrets of Bitfinity's Blazing fast Bitcoin layer-2 solution. Learn how the off-chain components power it behind the scenes.

From On-Chain to Off-Chain: Looking Behind the Scenes of Bitfinity's EVM Components

Built on the Internet Computer, Bitfinity has grown to be among the key Bitcoin layer two solutions. By accomplishing a 1:1 equivalence with Ethereum through its Ethereum Virtual Machine (EVM), the Bitfinity EVM, it has brought a new development era to Bitcoin.

Redefining Bitcoin Layer-2: How Bitfinity Applies It to Bitcoin
This article explores how Bitfinity implements bitcoin functionality as a sidechain using the Internet Computer (ICP) protocol’s powerful threshold cryptography capabilities.

The EVM canisters can support querying 2 weeks of block data directly on-chain, and the adapted Reth node (off-chain) stores historical data and can be searched. to ensure there is access to past transactions and other historical information.

In this article, we will take you through the off-chain components and see the role each plays in this off-chain data management.

Bitfinity EVM Architecture

Up to now, perhaps you might be wondering why Bitfinity even needs off-chain components. Well, to answer your question, allow me to touch on the on-chain components, just a little! 👌

As we have mentioned above, the on-chain components are responsible for processing transactions and verifying signatures. Transactions on Bitfinity go through a verification queue, where signatures are checked by two main canisters - the EVM canister and the Signature Verification Canister. Note that canisters are similar to smart contracts on other blockchains.

Internet Computer Canisters: Everything You Need to Know
It’s common knowledge that canisters are an enhancement of smart contracts. What canisters or smart contracts are and how they work, however, is far from common knowledge.

Once the signatures have been verified, the transactions are then batched to a block and passed to an EVM-based executor, which executes the block transactions and updates the blockchain state.

But as we know, Bitfinity processes a large number of transactions thanks to its improved throughput of up to 1,000 transactions per second with a finality time of 1-2 seconds. 

Therefore, if the network were to store all this data on-chain, it would be infeasible, as this could run into terabytes of storage. This is where off-chain components come in…

Bitfinity Network Off-Chain Components

Bitfinity's off-chain components help in storing full block data and in searching in this historical data, which helps to manage storage and maintain the availability for blocks. While EVM canisters typically support querying 2 weeks of block data directly on-chain, off-chain components ensure redundancy and provide access to historical data. Additionally, they enable advanced developer capabilities like running an archiver node or debugging the EVM.

Therefore, let us look to each in particular…

Block Extractor 

The first in this list is the block extractor, which stores data from the on-chain network in a cloud-based database, to ensure it is backed up and quickly retrievable.

It continuously polls the Bitfinity EVM, to extract and process blocks in real-time, which guarantees that no transaction data is lost. For data redundancy and availability, multiple instances of the block extractor are run. 

Data redundancy refers to having copies of data in two or more places within a data storage system to ensure availability and prevent data loss in case of hardware failures or other issues.- TechTarget

Adapted Reth Node

As we have mentioned on different occasions, a node is a component of a blockchain network that maintains the latest record of transactions and ensures network rules are adhered to.

This is the same for Bitfinity, which uses the adapted Reth node. The Reth node is a full node that absorbs blocks from the EVM's HTTP (Hypertext Transfer Protocol) interface or the block extractor. 

When we talk about the EVM's HTTP interface, we refer to the Internet Computer HTTPS outcalls (which is a secure version of the HTTP protocol) implementation to the Bitfinity EVM. It allows communication between the on-chain canisters and off-chain components, in this case the adapted Reth node. 

To learn more on how they power the Bitfinity EVM, refer to this comprehensive guide.

How HTTPS Outcalls will Power the Evolution of the EVM
Given that the IC has worked hard to build a network that is more than just a blockchain, but a network that covers the full suite of developer needs such as on-stage storage and off-chain communication, HTTPS outcalls are a core pillar of what makes the IC great.

The node provides a full implementation of the Ethereum JSON RPC API [JavaScript Object Notation (JSON) remote procedure call (RPC) application programming interface (API)].

Well, that's a lot to take in, so to simplify it for you, the adapted Reth node's implementation of the Ethereum JSON RPC API allows the Bitfinity EVM API to interact with Ethereum-based tools and applications.

This way, developers can use their existing Ethereum development tools, such as Hardhat and Remix, to build and deploy applications on the Bitfinity network.

Tools available to build with Solidity on the Bitfinity EVM
There are several tools available to build with Solidity on the Bitfinity EVM, each with its own advantages and disadvantages. Here is a comparison of some of the most popular tools: Truffle (see docs for tutorial) * Development framework for Solidity projects * Includes a built-in Solidity compiler, Ganache test network, and

In addition, given that the node maintains a complete history of EVM data, it can forward transactions to the EVM canister for processing. Detailed instructions to build and run the adapted Reth Node can be found here. 👇

reth/bitfinity.md at bitfinity-archive-node · bitfinity-network/reth
Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust - bitfinity-network/reth

EVM Archiver

Last on the list is an EVM archiver, which also maintains a complete history of the EVM state. But unlike the Reth node, which serves different purposes with the data, the EVM archiver is primarily used for debugging.

Debugging refers to when developers identify and fix errors or bugs in the code, especially within smart contracts. They do this by reviewing the code, verifying transaction details, and analyzing the network's behavior. 

To achieve this, the EVM archiver replicates an environment similar to the EVM on a canister, using a technique known as memory-mapped (MMapped) files. This technique involves mapping a file between the two components' space, which enables direct memory-like sharing between them.

Also, you can run an adapted Reth node (which we discussed as off-chain component #2) as an EVM archiver. Here, it runs a block import process that downloads the blocks from the network and imports them into the database. But as we have noted above, this would be primarily for debugging. More information on it can be found here. 👇

reth/bitfinity.md at bitfinity-archive-node · bitfinity-network/reth
Modular, contributor-friendly and blazing-fast implementation of the Ethereum protocol, in Rust - bitfinity-network/reth

Conclusion

By utilizing a combination of on-chain and off-chain components, Bitfinity has created a scalable infrastructure that can handle high transaction throughput while maintaining data integrity and accessibility.

We all wait for new possibilities for decentralized finance, non-fungible tokens, and other use cases that require the security of Bitcoin and the programmability of Ethereum. As the network grows and more developers adopt the Bitfinity EVM, the importance of these off-chain components will become even more apparent.

Connect with Bitfinity Network

Bitfinity Wallet | Bitfinity Network | Twitter | Telegram | Discord | Github

*Important Disclaimer: The information provided on this website is for general informational purposes only and should not be considered financial or investment advice. While we strive for accuracy, Bitfinity makes no representations or warranties regarding the completeness, accuracy, or reliability of the content and is not responsible for any errors or omissions, or for any outcomes resulting from the use of this information. The content may include opinions and forward-looking statements that involve risks and uncertainties, and any reliance on this information is at your own risk.

External links are provided for convenience, and we recommend verifying information before taking any action. Bitfinity is not liable for any direct or indirect losses or damages arising from the use of this information.