Git Product home page Git Product logo

huffc's Introduction

The Huff Programming Language

Huff is a low-level programming language, designed for developing highly optimized smart contracts that run on the Ethereum Virtual Machine. Huff does not hide the inner-workings of the EVM, instead, directly exposing its programming stack to the developer for manual manipulation.

Rather than having functions, Huff has macros - individual blocks of bytecode that can be rigorously tested and evaluated using the Huff runtime testing suite.

Originally developed by the Aztec Protocol team, Huff was developed to write Weierstrudel, an on-chain eliptical curve arithmetic library that required code so optimized, that it could not be written in Solidity, or even Yul.

While Huff can be used by EVM experts to design highly-efficient smart contracts for use in production, it can also serve as a way for beginners to learn more about the Ethereum Virtual Machine, projects built on it, and languages made for it.

Example

"Hello World" in Huff:

#define macro MAIN() = takes (0) returns (0) {
    0x48656c6c6f2c20776f726c6421 0x00 mstore // Store "Hello, World!" in memory.
    0x1a 0x00 return // Return 26 bytes starting from memory pointer 0.
}

Setup

To run this project, install it using npm

npm install -g huffc

To compile a contract and output its bytecode, simply run

huffc filename.huff --bytecode

For a full list of arguments, run

huffc --help

huffc's People

Contributors

d1ll0n avatar jetjadeja avatar laurencevs avatar zac-williamson avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.