Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
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 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.
Initially developed by the Aztec Protocol team, Huff was created to write Weierstrudel. Weierstrudel is an on-chain elliptical curve arithmetic library that requires incredibly optimized code that neither Solidity nor Yul could provide.
While EVM experts can use Huff to write highly-efficient smart contracts for use in production, it can also serve as a way for beginners to learn more about the EVM.
For usage examples, see the huff-examples repository.
Make sure you have the following programs installed:
This is how to create the contract bytecode to output Hello, World! in Huff.
Install Huff globally:
yarn global add huffc
Note: You may need to add yarn to your system's path to access globally installed packages. See the yarn docs on global for more details.
Create a file called hello-world.huff
and enter the following content:
#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.
}
Use huffc
to compile the contract and output bytecode:
huffc hello-world.huff --bytecode
This will output something like:
6100168061000d6000396000f36c48656c6c6f2c20776f726c6421600052601a6000f3
Run huffc --help
to view a full list of arguments:
huffc --help
> Usage: huffc [options]
>
> Options:
> -V, --version output the version number
> -V, --version Show the version and exit
> --base-path <path> The base path to the contracts (default: "./")
> --output-directory <output-dir> The output directory (default: "./")
> --bytecode Generate and log bytecode (default: false)
> -o, output The output file
> -p, --paste Paste the output to the terminal
> -h, --help display help for command
FAQs
A low level programming language for the Ethereum Virtual Machine
The npm package huffc receives a total of 36 weekly downloads. As such, huffc popularity was classified as not popular.
We found that huffc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.