0.0.2 • Published 3 years ago

huff-language v0.0.2

Weekly downloads
-
License
LGPL-3.0
Repository
github
Last release
3 years ago

Huff: a low level programming language for the Ethereum Virtual Machine

Huff is a domain-specific programming language created for the purpose of writing highly optimized code for the Ethereum Virtual Machine. It enables the construction of EVM assembly "macros" - individual blocks of bytecode that can be rigorously tested and evaluated.

Huff barely hides the inner-workings of the EVM behind syntactic sugar. Rather than having variables, Huff directly exposes the EVM's program stack to the developer to be manually manipulated.

"That sounds terrible! Why learn Huff?"

Huff was orginally developed by Aztec Protocol to create Weierstrudel, an elliptic curve arithmetic library that required extremely optimized code.

Huff is designed for developing extremely optimized smart contract code, where the direct manipulation of the program's bytecode is preferred. Using the Huff runtime testing suite, Huff macros can be rigorously tested without having to split the program into functions and invoke jump instructions.

Beyond writing performant code, learning Huff can help you learn all about the Ethereum Virtual Machine as well as develop your understanding of other EVM programming languages like Solidity and Vyper.

"Where can I find example Huff code?"

ERC20, the ERC20 token standard written entirely in Huff.

Minisig.huff is a minimal multisignature wallet written in Huff.

EVM-Hypervisor is an EVM emulator, allowing you to execute the logic of another contract without using DELEGATECALL.

Proxies.huff, a collection of different Huff proxy implementations.

weierstrudel is an elliptic curve arithmetic library written entirely in Huff, with its contract code totalling over 14kb.