Skip to content

A stack-based virtual machine for executing smart contracts.

Notifications You must be signed in to change notification settings

alex-connolly/FireVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FireVM

A stack-based virtual machine for executing smart contracts, created using Axia's vmgen.

FireVM provides a strict superset of the functionality offered by Ethereum's EVM. This means that all contracts which can be executed on the Ethereum blockchain can be executed on any chain using FireVM (although a translation mechanism is necessary).

Advantages

Compressed Bytecode

FireVM employs several strategies designed to minimise the size of the bytecode which must be stored on-chain.

EVM parameters are padded to 32 bytes, such that a boolean is stored as 0x0000000000000001 or 0x0000000000000000. This is unnecessarily wasteful.

FireVM stores the size of each parameter as a prefix, such that the representation of the boolean above is 0x0101 - one size byte and then one value byte. This assumes a size byte of length 1, but the size byte can modified by altering the first byte of the contract:

01 | size of size byte 01 | size of parameter 01 | actual parameter

While this does introduce some overhead, it is limited to one byte, with this constant addition being quickly overwhelmed as the contract grows larger.

This means that for a size parameter of length n, we have the following formula to calculate the reduction :

reduction := 32 - lengthInBytes - n

Improved Recursive Mapping

Specification

See SPEC.md for full details.

About

A stack-based virtual machine for executing smart contracts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages