How the Bitfinity Network EVM Works and Why It Matters

So far, there's been a lot of hype about the Bitfinity Network EVM but not a lot of details. I'm here to start changing that! InfiniSwappers should be prepared to spread the word about how the EVM works and why it matters.

How the Bitfinity Network EVM Works and Why It Matters

So far, there's been a lot of hype about the Bitfinity Network EVM but not a lot of details. I'm here to start changing that, a task that began with my general introduction to the Ethereum Virtual Machine. After all, the best kind of enthusiasm is informed enthusiasm; InfiniSwappers should be prepared to spread the word about how the Bitfinity Network EVM works and why it matters.

Without further introduction then, let's begin!

Solidity - The Language of DeFi

To understand the Bitfinity Network EVM, a great place to start is to learn something about the language it speaks. To allow for the execution of smart contracts written in Solidity, the Bitfinity Network EVM creates a blockchain compatible with Ethereum on the Internet Computer. Remember, a smart contract is a digital agreement that is automatically enforced when certain conditions are met. It eliminates the need for a human third party to oversee the contract and ensures that the rules of the agreement are followed automatically.

But, what exactly is Solidity?

Solidity Programming Language
Solidity is a statically-typed curly-braces programming language designed for developing smart contracts that run on Ethereum.

Simply put, Solidity is a computer language that is used to write smart contracts that run on blockchain platforms. Solidity was created to help people build smart contracts, and it is based on the syntax of the popular JavaScript programming language. Solidity is designed to be a safe and secure language, which means that it's hard to write code that could cause problems or security issues — which is a very needful thing in the world of crypto given the risks inherent in DeFi!

Smart contracts written in Solidity are stored entirely on the blockchain, which means they're stored on many computers all over the world. This fact makes the Internet Computer an ideal blockchain for hosting Solidity smart contracts due to ICP's dramatic storage cost advantages over Ethereum.

Once a smart contract written in Solidity is deployed, it can't be changed, and it will run automatically when certain conditions are met. This makes smart contracts when coded correctly, transparent, secure, and tamper-proof.

Solidity is therefore a popular choice for writing smart contracts because it makes the process of creating complex financial transactions, such as lending platforms and prediction markets, easier and thus less prone to logic and other coding errors.

Solidity also enjoys a large and active community of developers who create tools and resources to make it even easier to build, test, and deploy smart contracts on the blockchain.

The Architecture of the Bitfinity Network EVM

Now that you know about Solidity, it's time to talk more about the architecture of InfinitySwap's version of the EVM and what distinguishes it from competitors. The Bitfinity Network EVM provides a platform for users to issue transactions on a layer 2 (L2) environment on the Internet Computer blockchain. This is made possible by running transactions on a fast virtual machine that has a high throughput and is cost-effective compared to other Ethereum Layer 2s.

The Bitfinity Network EVM's architecture consists of four key components:

  1. EVM API canisters;
  2. the EVM Executor canister
  3. Signature Verifier canisters; and
  4. the Blockchain canister.

The EVM API canisters serve as the entry points to the system, where they receive requests from Ethereum clients and Internet Computer agents. Once received, these requests are batched into a pending transaction pool.

The Role of JavaScript Object Notation

Remember how Solidity was modeled on JavaScript syntax? There's a reason for that — convenience. JavaScript itself has a role to play in the EVM, and thus also in the Bitfinity Network EVM. The Ethereum JavaScript Object Notation (JSON) remote procedure call (RPC) application programming interface (API) is a full implementation of the Ethereum JSON RPC specifications that allows the Bitfinity Network EVM API to receive requests from external Ethereum libraries and other clients.

That's a lot to take in, so let's briefly overview the mechanics of JSON-RPC. In a nutshell, JSON-RPC allows applications to communicate with each other over a network, by sending messages between client and server and invoking procedures or methods on the remote server.

In any JSON-RPC system, the client sends a request to the server in the form of a JSON object, specifying the method to be executed and any arguments needed by the method. The server receives the request, executes the method with the provided arguments, and sends a response back to the client in the form of a JSON object.

JSON-RPC is a lightweight and language-agnostic protocol that can be used with a variety of programming languages and platforms, making it a popular choice for building distributed systems and microservices. It is also widely used in blockchain and cryptocurrency applications, where it serves as a standard communication protocol for interacting with blockchain nodes and smart contracts.

The EVM Executor Canister

Now, after the EVM API canisters batch incoming requests into a pending transaction pool, the EVM Executor canister processes these transactions, updates the global EVM state, and the Blockchain canister accordingly.

The Blockchain Canister

The blockchain canister itself is the structure that contains the Ethereum chain blocks. It persists in the Internet Computer's stable canister storage, which has a current size limit per canister of 48GB; however, there are plans to increase the state storage to 1TB in the coming year, which would allow InfinitySwap to persist the entirety of its chain’s data in a single canister.

The Signature Verifier Canisters

Next, the Signature Verifier canisters are used to verify the signature of an Ethereum transaction, a computationally expensive task performed in a dedicated pool of canisters to avoid too much computation in the EVM API canisters.

Bitfinity Network EVM Enhancements and Optimizations of the EVM

The Bitfinity Network EVM is faster than the main Ethereum network EVM implementation as it optimizes transaction throughput by performing signature verification and the batching of transactions. These optimizations have a high overhead due to cryptographic and IO operations. The Bitfinity Network EVM is fully on-chain, with code and data executed in web assembly. Web assembly, as you may know, is a single-threaded execution environment, and parallel computation is achieved through a multi-canister architecture. This is what makes the Bitfinity Network EVM blazingly fast.

The Bitfinity Network EVM matters because it is a revolutionary development of the best existing features of the EVM, plus so much more! The Bitfinity Network EVM is well-tested, with high coverage across core modules. The Retest integration test suite is used to ensure the correctness of the JSON RPC interface and EVM's execution. The Bitfinity Network EVM uses existing libraries, such as REVM, Retest, the canister-sdk, and the IC's stable-storage libraries to make the best use of existing Ethereum libraries.

The Bitfinity Network EVM has plans to integrate Ethereum and other EVM-compatible chains by running light-clients on the Internet Computer, which will require changes to the networking protocol to interface with full nodes on other chains and sync the full blockchain.

The Bitfinity Network EVM supports bridging tokens ICRC-1 and ERC777/ERC20 tokens, as well as Bitcoin as an ICRC-1 token. With an Ethereum light client, the Bitfinity Network EVM could bridge ERC20 and other tokens, creating an ICRC-1 token, or even directly creating ERC777 tokens that represent ownership of Ethereum assets!

Conclusion: Bitfinity Network EVM is the Next Generation EVM

In conclusion, the Bitfinity Network EVM is an innovative project that creates a fast, cost-effective blockchain that is compatible with Ethereum on the Internet Computer. The Bitfinity Network EVM architecture consists of four components that work together to process transactions and update the global EVM state and Blockchain accordingly. The Bitfinity Network EVM uses existing libraries to make the absolute best use of Ethereum libraries, and the Retest integration test suite ensures the system's correctness.

There is more to be said on block explorers - in short, InfinitySwap uses a modified version of Erigon that pulls blocks from the EVM canister. For the moment, InfinitySwap is colocating the Bitfinity Network EVM's API and execution functions in a single canister, but this may be subject to change. Signature verification is a separate canister, and archived block data is signed (proposing to use canister signatures on the Internet Computer and held off-chain). Then, there's the question of how InfinitySwap enables Internet Computer agents to sign Ethereum transactions, which also requires a few tricks involving registering an Ethereum private key.

But those are topics for future articles!

Connect with InfinitySwap

Bitfinity Wallet |AMM | Twitter | Website | Telegram | Discord | Github