Skip to content

Instantly share code, notes, and snippets.

View lucaspere's full-sized avatar
😶‍🌫️
Always Thinking

Lucas Pereira lucaspere

😶‍🌫️
Always Thinking
View GitHub Profile
@lucaspere
lucaspere / ethTxLegacy.ts
Created May 3, 2025 15:08
Demonstration of manually signing a legacy Ethereum transaction in TypeScript using RLP, Keccak256 and secp256k1, comparing against the viem library.
import { secp256k1 } from "@noble/curves/secp256k1";
import keccak256 from "keccak256";
import { assert } from "node:console";
import RLP, { Input } from "rlp";
import * as viem from "viem";
import { privateKeyToAccount } from "viem/accounts";
const messageToSign = {
nonce: 0,
gasPrice: viem.parseGwei("20"),
@lucaspere
lucaspere / AdvacedRegistry.sol
Created April 19, 2025 20:43
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
import "contracts/BaseRegistry.sol";
error MaximumPontuationExceeded();
error InvalidWithdrawalValue();
error InsufficientBalance(uint balance, uint value);
error FailTransferEther();
@lucaspere
lucaspere / main.go
Last active March 23, 2023 11:43
Destructuring of Dynamic Structure Fields
package main
import (
"bytes"
"fmt"
"log"
"strings"
)
var output bytes.Buffer