1 of 21

The Art of Huff

by jtriley.eth

2 of 21

huff gud

3 of 21

Thank you!

4 of 21

Huff Lore

5 of 21

2019: Zac Creates Huff

> be zk chad�> need elliptic curve scalar multiplication�> precompile isn’t cheap enough�> writes a whole assembler to do it in raw opcodes�> mfw it’s faster than the precompile

6 of 21

2022: Recovery of the Ancient Huff Texts

Early contributors:

  • d1ll0nk
  • jetjadeja
  • refcells
  • virtual_jpeg
  • vex_0x
  • maddiaa0
  • exp_table

7 of 21

2023: The Huff Renaissance

  • Huff Style Guides
  • Awesome-Huff
  • Artemis-Huff-Port
  • Huffathon
  • Snark Verifiers
  • Elliptic Curve Ops
  • Fast Fourier Transform

8 of 21

Huff Gameplay

9 of 21

EVM Bytecode

10 of 21

EVM Mnemonics

11 of 21

Barebones Huff

  • right -> left
  • top -> bottom
  • macros copypasta body
  • literals are push opcodes
  • opcodes are lowercase

12 of 21

Sugary Huff

  • create jump label w colon
  • use jump label by name
  • use const w brackets

13 of 21

Juicy Huff

  • template arguments to macros copy-pasta
  • use tmpl args w angle brackets

14 of 21

Frothin’ Huff

  • jumptables group jump dests
  • copy jumptable to memory
  • dispatch by memory index

15 of 21

okbutytho

  • mev contract optimization
  • stateless defi periphery
  • most important of all: education!

16 of 21

Simple Example

17 of 21

Solidity Version

18 of 21

Huff Version

19 of 21

Comparison

20 of 21

Thank you!

21 of 21

Thursday,

Nov 16, 2023

Istanbul, Türkiye