Skip to content

Instantly share code, notes, and snippets.

View dapplion's full-sized avatar

Lion - dapplion dapplion

View GitHub Profile
@dapplion
dapplion / keybase.md
Last active September 26, 2018 16:10

Keybase proof

I hereby claim:

  • I am dapplion on github.
  • I am dapplion (https://keybase.io/dapplion) on keybase.
  • I have a public key ASDW5WWJDYWzTPeMQwHNbYRtlMcOtAkiFHU7Nw7ehNQfkwo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am dapplion on github.
  • I am dapplion_ (https://keybase.io/dapplion_) on keybase.
  • I have a public key ASDNplOZCZzrupzeMCR_SC_i15hCM2-qFmaFXt7X2iNMSwo

To claim this, I am signing this object:

@dapplion
dapplion / timeout-promise-patched.js
Last active December 3, 2019 21:09
@aragon/apm file that causes the aragonCLI node process to never finish. This patch clears timeout after the Promise.race
/**
* Original code from https://github.com/aragon/apm.js/blob/3d818929ce19410ea6a29e12964b19c08312b7a7/src/utils/timeout-promise.js
*/
function original(promise, ms) {
// Create a promise that rejects in <ms> milliseconds
const timeout = new Promise((resolve, reject) => {
const id = setTimeout(() => {
reject('Timed out in ' + ms + 'ms.')
}, ms)
})
@dapplion
dapplion / in3-test-web3.js
Created February 14, 2020 06:47
Expand original in3 example interacting with contracts but through web3. Extends https://gist.github.com/simon-jentzsch/48fd7a5e9fd59e6d3a0c00815d37d24d
// import in3-Module
const In3Client = require("in3").default;
const Web3 = require("web3");
// use the In3Client as Http-Provider
const web3 = new Web3(
new In3Client({
proof: "standard",
signatureCount: 1,
requestCount: 2,
@dapplion
dapplion / in3-test-ens.js
Created February 14, 2020 07:43
Test in3 interacting with ENS registar to get a resolver address
const In3Client = require("in3").default;
// use the In3Client
const in3 = new In3Client({
proof: "standard",
signatureCount: 1,
chainId: "mainnet",
replaceLatestBlock: 50
});

Phase 0 for Humans [v0.10.0]

Warning: This a work in progress document with many broken links, some unfinished sections, and commands for including code segments. The entirety of the document is subject to change without warning.

Introduction

This document is an aid to the specification of the state transition function and accompanying data structures for Phase 0 - The Beacon Chain -- the core system level chain at the heart of Ethereum 2.0.

The primary Phase 0 specification is particularly terse, only defining much of the functionality via python code and comments. This document aims to provide a more verbose version of the specification, primarily aimed at helping onboard new contributors to E

Command Line Reference

This reference describes the syntax of the Lodestar CLI commands and their options.

Global Options

Option Type Description Default
--rootDir string Lodestar root directory
--testnet string Use a testnet configuration
--preset string Specifies the default eth2 spec type mainnet
@dapplion
dapplion / learnProofsEth1.ts
Created August 21, 2020 17:06
Learn how eth1 deposits proofs are different depending on when they are computed
import {createIBeaconConfig, IBeaconConfig} from "@chainsafe/lodestar-config";
import {params} from "@chainsafe/lodestar-params/lib/presets/mainnet";
import {TreeBacked, List, toHexString} from "@chainsafe/ssz";
import {Root, ValidatorIndex, DepositData} from "@chainsafe/lodestar-types";
import {IDepositEvent} from "./eth1";
import {computeDomain, DomainType, computeSigningRoot} from "@chainsafe/lodestar-beacon-state-transition";
import {interopKeypair} from "@chainsafe/lodestar-validator";
import {initBLS, Keypair, PrivateKey} from "@chainsafe/bls";
async function learnProofs(): Promise<void> {
@dapplion
dapplion / benchmark-binary.equals.ts
Last active October 15, 2020 08:25
Benchmark Javascript binary equals
// Generate random data
const num = 1000000;
const dataArr: {a: Uint8Array; b: Uint8Array}[] = [];
const len = 32;
for (let i = 0; i < num; i++) {
const nums: number[] = [];
for (let j = 0; j < len; j++) {
nums[j] = j;
}
const a = new Uint8Array(nums);
@dapplion
dapplion / donors.csv
Last active July 22, 2021 12:36
Donors to the DAppNode Gitcoin campaign 0x00CF36853AA4024fb5BF5cc377dfd85844B411a0 from block o to block 12830000. To qualify: maxDonationValueUSD > 1
We can't make this file beautiful and searchable because it's too large.
address,firstDonationTimestamp,totalDonationCount,maxDonationValueUSD,totalDonationValueUSD
0xa1e8153d5eb68e5b7cd5262be22fc6f13a3f1a8e,1523867187,4,28904.00944969315,32548.650612839876
0xe8c904dc650e6fcb3fe39cc82b40bd897c83d8fa,1587738531,4,22089.433833908097,30450.04342692288
0x839395e20bbb182fa440d08f850e6c7a8f6f0780,1523523132,10,21369.247300392406,28563.818893363685
0x2586e4b30c581ee20af694495dbcf98daecde75e,1574452127,3,12500,25000
0xd152f549545093347a162dce210e7293f1452150,1611950239,4,12808.593738103727,15802.282990294374
0xf2354570be2fb420832fb7ff6ff0ae0df80cf2c6,1608731262,1,11111.393325278,11111.393325278
0x3342e3737732d879743f2682a3953a730ae4f47c,1617646594,1,8784.74944742474,8784.74944742474
0x087b33c9a4bdb2fa55a742c51ab44ec66f35bc95,1580640579,1,8583,8583
0x9e86dab80c154c2b4f39ac6600baa341e3517825,1604122887,1,4094.270932530857,4094.270932530857