This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {randomBytes} from "node:crypto"; | |
import {compress} from "snappyjs"; | |
import {phase0, ssz} from "@lodestar/types"; | |
import {BitArray} from "@chainsafe/ssz"; | |
// To run: | |
// $ ../../node_modules/.bin/ts-node --esm test/unit/network/snappy.test.ts | |
/* eslint-disable no-console */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ssz } from "@lodestar/types"; | |
import { createBeaconConfig } from "@lodestar/config"; | |
import { fromHexString, toHexString } from "@chainsafe/ssz"; | |
import bls from "@chainsafe/bls"; | |
// To run, first install dependencies: | |
// $ npm install @lodestar/types @lodestar/config @chainsafe/ssz @chainsafe/bls | |
// | |
// Then | |
// $ node signature_verify.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage | |
// node slot_finder.mjs chiado | |
const genesisTimestamp = getGenesis(); | |
const interval = 8192 * 5; | |
const now = Math.floor(Date.now() / 1000); | |
const futureDate = new Date(); | |
futureDate.setMonth(futureDate.getMonth() + 2); | |
const futureTimestamp = Math.floor(futureDate.getTime() / 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
# make the API request | |
url = "http://localhost:4000/eth/v1/beacon/states/head/validators" | |
response = requests.get(url) | |
# check if request was successful | |
if response.status_code != 200: | |
print(f"Error: API request returned status code {response.status_code}") | |
exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { execSync } from "node:child_process"; | |
const URL = "https://nodewatch.chainsafe.io/query"; | |
// From https://github.com/gnosischain/configs/blob/main/mainnet/config.yaml | |
const known_versions = { | |
"0x00000064": "gnosis-phase0", | |
"0x01000064": "gnosis-altair", | |
"0x02000064": "gnosis-bellatrix", | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {execSync} from "node:child_process"; | |
// Usage | |
// ``` | |
// node ttd.mjs https://rpc.eu-central-2.gateway.fm/v3/gnosis/archival/chiado | |
// ``` | |
const rpcUrl = process.argv[2] ?? "https://rpc.gnosischain.com/"; | |
const blocksPerDay = 17280; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { execSync } from "node:child_process"; | |
// Usage | |
// ``` | |
// node ttd.mjs "Oct 29 2022 14:00:00 GMT+0000" latest https://rpc.eu-central-2.gateway.fm/v3/gnosis/archival/chiado | |
// ``` | |
const ttdTargetDateStr = process.argv[2]; | |
const blockNumberReference = process.argv[3] ?? "latest"; | |
const rpcUrl = process.argv[4] ?? "https://rpc.gnosischain.com/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I contributed to the Semaphore Trusted Setup Multi-Party Ceremony. | |
The following are my contribution signatures: | |
Circuit: semaphore16 | |
Contributor # 245 | |
Hash: e62246a7 79cc0f04 aaa08808 3b9b07d8 | |
689eba3d ca17a156 653f5f57 20439ac0 | |
be869762 878167e3 042faaab d58f4fe8 | |
6c6c14dc 0ecacfa4 a91dad0a 9e52cc5a | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const d = 38; // Mainnet specs = 2**40 / 4 | |
const chunkCount = 200_000 / 4; // Mainnet size, GWei = uint64, 4 on each 32 bytes chunk | |
const syncCommitteeSize = 2 ** 9; // Mainnet specs | |
const indexes: number[] = []; | |
for (let i = 0; i < syncCommitteeSize; i++) { | |
// Does not consider the possibility of two indexes fiting in the same chunk. Tho this is very rare. | |
indexes.push(Math.floor(chunkCount * Math.random())); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {ssz} from "@chainsafe/lodestar-types"; | |
let i = 0; | |
const heapUsed = process.memoryUsage().heapUsed; | |
while (true) { | |
getBigStateTreeBacked(); | |
global.gc(); | |
console.log(i++, (process.memoryUsage().heapUsed - heapUsed) / 1e6, "MB"); | |
} |
NewerOlder