Skip to content

Instantly share code, notes, and snippets.

View 0xqd's full-sized avatar
🚀
Buidl web3

jn 0xqd

🚀
Buidl web3
View GitHub Profile
  • Panoramix is probably the most well-known one thanks to etherscan.io integrating it. It'll return "python-like" code that is actually quite nice to read. Unfortunately it often ends up having "timeouts" causing the decompiled code to just abruptly stop.
  • Dedaub's Decompiler is my personal favorite. When it produces something, it does produce "solidity-like" code that is well readable. But sometimes it just fails to yield anything at all. And even when it does work it struggles whenever memory handling gets involved, requiring some educated guessing.
  • ethervm.io's Decompiler is another online service which similar to Panoramix always delivers a result, but it also has the tendency to skip big parts of the code due to "could not resolve jump destination" errors and the like.
  • Heimdall does not have an online s
@0xqd
0xqd / concurrent_hashmap.rs
Created April 28, 2024 21:02
Rust concurrent hashmap
// lessons: implement as &self, so we can use with Arc normally
use std::collections::HashMap;
use std::hash::Hash;
use std::sync::RwLock;
struct Entry (RwLock<i32>);
// The example is non hash, we can cast hashed_key to usize
struct ConcurrentHashMap {
inner: Box<Vec<RwLock<HashMap<i32, Entry>>>>,
@0xqd
0xqd / expanded_withdrawal.rs
Created April 12, 2024 16:46
expanded_withdrawal.rs
mod withdrawal {
use crate::{constants::GWEI_TO_WEI, serde_helper::u64_hex, Address};
use alloy_rlp::{
RlpDecodable, RlpDecodableWrapper, RlpEncodable, RlpEncodableWrapper,
};
use reth_codecs::{main_codec, Compact};
use std::{mem, ops::{Deref, DerefMut}};
/// Withdrawal represents a validator withdrawal from the consensus layer.
pub struct Withdrawal {
/// Monotonically increasing identifier issued by consensus layer.
@0xqd
0xqd / keybase.md
Created April 7, 2024 15:04
keybase.md

Keybase proof

I hereby claim:

  • I am 0xqd on github.
  • I am nxqd (https://keybase.io/nxqd) on keybase.
  • I have a public key ASBtX0iHAefesUGfxLC3navhkdZpJEqhuaH7tHmw3tdR4Ao

To claim this, I am signing this object:

@0xqd
0xqd / log.rs
Created April 5, 2024 08:58
Cargo expand of reth_primitives::Log
mod log {
use crate::{Address, Bloom, Bytes, B256};
use alloy_primitives::Log as AlloyLog;
use alloy_rlp::{RlpDecodable, RlpEncodable};
use reth_codecs::{main_codec, Compact};
/// Ethereum Log
pub struct Log {
/// Contract that emitted this log.
pub address: Address,
/// Topics of the log. The number of logs depend on what `LOG` opcode is used.
@0xqd
0xqd / HallOfBlame.md
Created July 3, 2023 17:12 — forked from yorickdowne/HallOfBlame.md
Great and less great SSDs for Ethereum nodes

Overview

Syncing an Ethereum node is largely reliant on IOPS, I/O Per Second. Budget SSDs will struggle to an extent, and some won't be able to sync at all.

This document aims to snapshot some known good and known bad models.

For size, 2TB come recommended as of mid-2022. 1TB can work for now but is getting tight.

High-level, QLC and DRAMless are far slower than "mainstream" SSDs.

@0xqd
0xqd / circulation.js
Created December 10, 2021 06:05
circulation
let globalCache = {
circulatingSupply: "0",
};
const REGISTRY = {
vegaTokenAddr: "0x4EfDFe8fFAfF109451Fc306e0B529B088597dd8d",
deployedBucketAddresses: {
Private: "0x4464B3917d9A249ff99D8Aa89E5a35D373Af2305",
Advisors: "0x4d91BaCD3F2CC3BCB18F0027381C7F1c44363C88",
Development: "0x1dAA4943280C85be711A6bDbACb7b73c66601B6d",
@0xqd
0xqd / keybase.md
Created April 14, 2021 04:02
Keybase verification

Keybase proof

I hereby claim:

  • I am rhacker on github.
  • I am nxqd (https://keybase.io/nxqd) on keybase.
  • I have a public key ASAPBlscWn09Z8RLHhVlUQA2XNwfQWTT1yY0jyC2AY2_lwo

To claim this, I am signing this object:

@0xqd
0xqd / idea.vmoptions
Last active August 14, 2023 12:04
Better performance vmoptions for 2020.1 intellij
-Xms1024m
-Xmx3072m
-Xss64m
-Dfile.encoding=UTF-8
-Djava.net.preferIPv4Stack=true
-Dsun.io.useCanonCaches=false
-XX:+AggressiveOpts
-XX:+AlwaysPreTouch
-XX:+CMSClassUnloadingEnabled
-XX:+CMSIncrementalMode
@0xqd
0xqd / how-to-set-up-stress-free-ssl-on-os-x.md
Created October 26, 2018 10:33 — forked from jed/how-to-set-up-stress-free-ssl-on-os-x.md
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying