back

What are the Stateful Precompiles and how are they used in the Hubblenet?

Twitter
https://pbs.twimg.com/media/FyZ4VOhaMAAvox3?format=jpg&name=large

Hubblenet leverages a unique feature, unlocked exclusively on app-chains: Stateful Precompiles.

What are Stateful Precompiles and how are they used in Hubblenet?

Stateful Precompiles add state access to Ethereum's precompiles concept.

Before digging into Stateful Precompiles, let’s address the concept of Precompiles on Ethereum.

On Ethereum’s precompiles are used to efficiently implement cryptographic operations within the Ethereum Virtual Machine (EVM) rather than re-implementing these operations in Solidity.

Eg of these cryptographic operations are hash functions and signature verification.

Usually, precompiles are stateless, meaning they don't have the ability to read or write data from the Ethereum blockchain's state (the collective information of all accounts and smart contracts on the network).

Precompiles simply perform a specific function when called by a smart contract, and then return the result.

Stateful Precompiles go a step further, providing direct reads and writes to LevelDB, the database that powers Ethereum and most other EVM-based chains.

This allows these functions to interact with the data stored on the blockchain, opening up a new range of possibilities for complex operations that can now be performed efficiently within the EVM.

In Hubble Exchange, stateful precompiles are used to move the most computationally complex parts of a multi-collateral and cross-margin exchange to a more efficient processing layer.

They help in ensuring that the gas requirements for various operations, like placing orders, matching orders, performing liquidations, remain constant even as new markets or collaterals are added, thus contributing to the overall performance and efficiency of Hubblenet.

It's important to note that adding state access to precompiles needs careful design and implementation, as it involves interacting with the blockchain's state, which is crucial to the security and integrity of the network.

Recent Reads