Awesome
<img src="./assets/huff.png">awesome-huff
What the heck is Huff?
Huff is a low-level programming language designed for developing highly optimized smart contracts that run on the Ethereum Virtual Machine (EVM). Huff does not hide the inner workings of the EVM. Instead, Huff exposes its programming stack and provides useful tools like constants and macros.
Initially developed by the Aztec Protocol team, Huff was created to write Weierstrudel, an on-chain elliptical curve arithmetic library that requires incredibly optimized code which neither Solidity nor Yul could provide. Huff was later rewritten by Jet Jadeja in Typescript, and finally it has been rewritten in Rust as huff-rs
which is the version we use today.
Huff can be used to write highly-efficient smart contracts for use in production, or it can serve as a way for beginners to learn more about the EVM.
Join the movement on Twitter
- Follow @huff_language to keep up with the latest news and announcements - notifications on, anon!
- Follow @Zac_Aztec and the Aztec Protocol team, the original creators of Huff.
- Follow Jet Jadeja The young prince of the Huff empire.
- And a few other Huff chads: @vex_0x, @refcells, @Maddiaa0, @d1ll0nk, @jtriley, @0xKaden, @merkleplant_eth, @real_philogy, DeGatchi, @exp_table, @big_tech_sux
Drop a gm in the Discord
- Huff is still young, but it already has a thriving community. People on the Huff discord are helpful, friendly, and chill.
Start here
- Huff landing page The landing page for all things Huff. Here you can find links to Github, Twitter, and huff-docs.
- The Huff Docs ➸ START HERE ➸ Here you'll find installation guides, reference, tutorials and everything you need to know about Huff. What are you waiting for, anon?
- EVM Through HUFF A video walk-through of SimpleStore.huff to get you started.
- Huff GitHub List A curated Github list of Huff language resources, libraries, tools, and more by @pcaversaccio.
Official huff-language Github repo
This is your main GH org for all things Huff: https://github.com/huff-language.
- huff-rs You'll be installing this, the new compiler built in Rust, developed by the community and recently released to the public. After installing
huffc
it's time to start hacking! Write your first Huff function, anon. Start with something simple like adding two numbers. See the tutorials in the docs. - huff-project-template A template for bootstrapping new Huff projects. Includes Foundry
HuffDeployer
. - huffmate A library of modern, hyper-optimized, and secure Huff contracts. Currently the gold standard of Huff libraries.
- vscode-huff A VSCode extension for Huff with syntax highlighting. Also available from within your VSCode in the Extensions Marketplace.
- huff-examples Currently has wip versions of ERC20 and ERC721.
- huff-breakage 💎HIDDEN GEM💎 A repo containing incorrect, breaking, and footgunned Huff contracts. You'll learn a lot about Huff by reading what not to do in this excellent resource by @refcells.
- huff-debug An easy hevm debug integration for hardhat-huff projects.
- foundry-huff Foundry support for Huff. Includes HuffDeployer to compile and test Huff contracts.
- hardhat-huff Huff support for Hardhat.
Huff tooling
- Bytepeep Bytepeep is a minimal bytecode peephole optimizer by @0xKaden.
- Murph Transpile EVM bytecode into Huff.
- vim-huff Huff syntax highlighting for vim
- hufflime A Sublime Text package for Huff syntax highlighting.
- huff-stacker Automatically generate stack comments for huff macros.
- Huff-Console Console logging functionality for debugging Huff contracts during development. Allows you log out the stack, memory and calldata easily and dynamically by Michael Amadi.
- Huffpoint Create breakpoints in your Huff code to use with Foundry debugger.
Huff articles
- Testing and deploying Huff contracts How to write tests and deploy your Huff contracts by PraneshASP.
- The HyVM — a VM on the EVM A blogpost from the creators of HyVM, a vm that can execute EVM bytecode.
- Which Smart Contract Language Is Right for Me? A comparison of EVM languages benchmarked against Huff. Written by some gigachads.
- Entering the Huff Ecosystem A deep dive into TSOwnable-huff by the author, @merkleplant_eth.
- Huff vs Yul for EVM Smart Contracts A well written and informative introduction to Huff by @jtriley
- Huff Challenge #1 A walkthrough and solution for the first official Huff challenge by @seshanth_.
- Huff Challenge #2 A walkthrough and solution for the second official Huff challenge by @seshanth_.
- Huff Challenge #3 A walkthrough and solution for the third official Huff challenge by @PraneshASP.
- Huff Challenge #4 A walkthrough and solution for the fourth official Huff challenge by @PraneshASP.
- Huff Challenge #5 A walkthrough and solution for the fifth official Huff challenge by @PraneshASP.
- From Zero to Nowhere An informative, 4 part series and deep dive into Huff written by the team that developed Huff.
Huff videos
- Scraping Bits Podcast - Huffoor DeGatchi hosts discussions ranging from gas optimization to security.
- EVM Through HUFF: Devtooligan Demo of Huff, a walk through of SimpleStore.huff and a bytecode optimization challenge produced by @SpearbitDAO.
- Devs Do Something - Zac Williamson Guest @Zac_Aztec, creator of Huff, talking about Huff, Aztec, Noir, and Building with ZK Tech.
- Devs Do Something - Vex Guest @vex_0x, one of the core contributors to huff-rs. Lots of great discussion around the history and core concepts of Huff.
- Devs Do Something - DeGatchi Discussion with @DeGatchi on topics including reverse engineering and MEV.
- Devs Do Something - devtooligan Discussion of Huff, Audits, & Following Curiosity with @devtooligan.
- Huff Basics - OpenZeppelin A 2020 introduction to Huff by OpenZeppelin. This discusses the original version of Huff created by Aztec.
- The Bytecode - philogy Guest @philogy, meth-weth code walkthrough.
Projects using Huff in the wild
- HyVM Run arbitrary code on the EVM, part of nested.fi.
- Weierstrudel This is the project that Huff was written for (written for the original version of Huff) and is used by the Aztec Protocol.
Huff projects you can learn from and contribute to
- huffmate A library of modern, hyper-optimized, and secure Huff contracts. Currently the gold standard of Huff libraries.
- 8-bit-array An implementation of an array in huff. It can store up to 32 8-bit values in a single storage slot.
- TSOwnable-huff An Ownable Implementation using Two-Step Transfer Pattern written by @merkleplant_eth.
- huffbound A Soulbound token contract implementation using Huff by PraneshASP.
- huff-clones Rewrite of clones-with-immutable-args in Huff.
- erc721h Gas optimized version of ERC721A in Huff.
- huff-ethernaut-magic-number Ethernaut MagicNumber Solver.
- huff-goo-issuance GOO(Gradual Ownership Optimization) issuance implementation using Huff by 0xasp_.
- huff-safe Safe multi-sig rewritten in huff.
- grim-reaper Gas optimized liquidation bot for Aave V3 in Huff.
- huff-learning Some math and other functions implemented in Huff.
- huff-math 👷🚧 Implementation of basic math operations using Huff by PraneshASP.
- huff-merkle Merkle distributor written in Huff.
- proxies A few Ethereum delegate-call proxies written in raw bytecode via Huff.
- quicksort-huff DsSort implemented in Huff.
- huff-snark-verifier Generate an optimized Groth16 SNARK verification smart contract for use on EVM-based blockchains.
- huff-tools A WIP set of tools for use with the huff language. Contains useful SafeMath functions by @0xKaden.
- huff-vrgda Huff Implementation of VRGDAs.
- meth-weth 👷🚧 WETH implementation in Huff by philogy.
- doppelganger Huff smart contracts for deploying arbitrary bytecode to deterministic CREATE2 addresses.
- hufflove Rewrite of commonly used contracts by @takez0_o.
- huff-binarySearch Binary Search implemented in Huff.
- huff-single-byte-dispatcher A jumptable-based function dispatcher in Huff by @merklefruit.
- Damn-Vulnerable-DeFi-V3-CTF Damn Vulnerable DeFi solutions with Huff.
- Ethernaut-CTF Ethernaut solutions with Huff.
- Yul2Huff Simple tool to convert Yul expressions to Huff.
- huff-puzzles Learn Huff in increments by solving puzzles that start easy and get harder by @RareSkills.
- SaltMiner A utility for finding the salt for a CREATE2 address for a UniV4 Hook.
- Secp256k1-huff Secp256k1 elliptic curve library written in Huff by @Jesserc_.
- MinimalAccount First (and most optimized) ERC-4337 smart contract account written in Huff.
- HuffBits A library for performing bitwise manipulations of data written in Huff by furnic.
- HorseRiders A Complex Math and Fast Fourier Transform library in Huff made by folks at BlocSoc IITR
- Uniswap-V2-Huff Uniswap V2 Pair contract and it's libraries Written in Huff Language by Michael Amadi.
- Secp256r1/P256-Verifier-Huff Optimized Secp256r1/P256 Verifier Huff Implementation by Michael Amadi.
- Zyclone Optimized token mixer for Ethereum utilizing zkSNARKs. 500% cheaper than Tornado cash by Michael Amadi, Tanim0la and Jesserc.
- UniswapX-Filler An Optimized UniswapX Filler contract written in Huff language by Michael Amadi.
- Optimized-MiMC-Sponge-Hash An optimized implementation of the MiMC Sponge hash algorithm written in huff language by Michael Amadi.
- Huffs Implementation of popular (and unpopular) solidity contracts and libraries in Huff Language by Michael Amadi.
- Dynamic-Huffidity Huffidity (Appending huff bytecode to solidity runtime code and jumping to it for efficient computation), but let's you jump back to Solidity runtime execution from Huff runtime execution restrictions by Michael Amadi.
- MiMC-Hash-Huffidity Using Dynamic Huffidity to embed MiMCSponge Hash bytecode by tornado cash to a solidity contract by Michael Amadi.
- ERC7399-Huff-Reference ERC7399 Flash Loans Huff Reference Implementation by Michael Amadi.
- Bit Magic Speedrun Bit manipulation tricks and techniques.
We heard you like ERC20 implementations
- huffmate ERC20 This is the current gold standard of Huff ERC20 (includes EIP-2612 Permit) and passing all Solmate tests.
- erc20-huff An ERC20 with Foundry tests.
- huff-pg An ERC20 implementation with SafeMath.
- huff-examples-ERC20 Currently has wip versions of ERC20 and ERC721.
- Solmate ERC20 ERC20 implemented on Huff fully complete with all functionality
Know your roots, anon
- AztecProtocol/huff This is the original version of Huff, developed by the Aztec Protocol team.
- Weierstrudel This is the project that Huff was written for. Good luck with that math, anon.
- Oliver An elliptic curve point multiplication on the Baby-JubJub curve also developed by the Aztec Protocol team.
- huffc The Jet Jadeja rewrite in Typescript that was deprecated on 4-Jul-2022.
Advanced EVM articles
- EVM Deep Dives: The Path to Shadowy Super A great series by @noxx3xxon with a very deep dive into the evm.
- DeGatchi articles Lots of alpha from DeGatchi, check out Reversing The EVM: Raw Calldata and A Low-Level Guide To Solidity's Storage Management.
- Jean Cavalerra - All About... Jean goes super deep on a lot of topics - must read for anyone serious about low-level EVM.
EVM opcodes
- evm.codes WITH HUFF PLAYGROUND check it out! This is a fork of evm.codes with Huff language support in the playground. Prototype, practice, and learn Huff with real time feedback and interactive debugger.
- evm.codes The ultimate resource for evm opcodes. The playground will soon have Huff support!
- evm-puzzles 10 puzzles to get you thinking like an evm.
- more-evm-puzzles 10 more puzzles!