Skip to content

Instantly share code, notes, and snippets.

Consensus Engine Analysis Agent

You are an expert blockchain engineer specializing in Ethereum consensus mechanisms, block validation, and state transitions. You have deep knowledge of Ethereum's consensus rules, fork choice algorithms, and the transition from PoW to PoS. Your task is to analyze Reth's consensus engine and create an implementation plan for Zig. Analyze the Reth consensus engine codebase and create a detailed breakdown of subtasks required to implement the consensus layer in Zig. Focus on validation rules, fork handling, and integration with the execution engine.
// evm.ts
// —— Helpers ———————————————————————————————————————————————
type U256 = bigint;
// bytes → bigint via hex string
function fromBytes(bytes: Uint8Array): U256 {
const hex = [...bytes].map(b => b.toString(16).padStart(2, '0')).join('');
return BigInt('0x' + hex);
@zenware
zenware / potato_leek_soup.md
Created January 28, 2025 23:44
Recipe - Potato Leek Soup

Potato Leek Soup

Ingredients

Main Ingredients

Name Quantity
Yukon Gold Potatoes 2.5 lbs.
Leeks 2 large 
@OrionReed
OrionReed / dom3d.js
Last active August 15, 2025 09:46
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@dwf
dwf / flake.nix
Created January 2, 2024 00:33
Minimal example of YAML as flake output
# Copyright 2024 Google LLC.
# SPDX-License-Identifier: Apache-2.0
{
description = "Demo of generating a YAML file as a flake output";
outputs = { self, nixpkgs }: let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
@prestwich
prestwich / monorepo.md
Last active November 25, 2022 17:15
How to break up a monorepo :)

How to break up a monorepo using git subtree:

  1. Set up some basic stuff:
    • These should be independent, not nested
$ NEW_REPO_PATH=
$ OLD_REPO_PATH=

2023:

  1. A Brief History of Commercial Capitalism - Banaji

Started / Continuing

  • The Price of Time - Chancellor

2022:

  1. Making Money - Christine Desan
@hrkrshnn
hrkrshnn / generic.org
Last active March 19, 2025 23:52
Some generic writeup about common gas optimizations, etc.

Upgrade to at least 0.8.4

Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!

The advantages of versions 0.8.* over <0.8.0 are:

  • Safemath by default from 0.8.0 (can be more gas efficient than some library based safemath).
  • Low level inliner from 0.8.2, leads to cheaper runtime gas. Especially relevant when the contract has small functions. For
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Token {
address public owner;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
string public symbol = "TOKEN";
uint256 public decimals = 18;