Skip to content

Instantly share code, notes, and snippets.

View 0fuz's full-sized avatar

0fuz 0fuz

View GitHub Profile
@0fuz
0fuz / polygon_flashbots.ts
Created November 26, 2022 07:43
An example of sending bundle to polygon chain
import {ethers, providers, Wallet} from "ethers";
import {FlashbotsBundleProvider, FlashbotsBundleResolution} from "@flashbots/ethers-provider-bundle";
import {parseUnits} from "ethers/lib/utils";
export async function timeout(ms: number) {
return new Promise(res => setTimeout(res, ms))
}
const polygonRpc = 'https://rpc.ankr.com/polygon'
const privateKey = '0x123123...'
@0fuz
0fuz / avax_state_sync_node.md
Created August 25, 2022 08:39
Avalanche state-sync node

Positive

  • ~40GB space needed for state
  • Actual X,P,C chains state for recent 100blocks.
  • Really cheap (~30$) to start own state-sync-node compared to BSC full-node (700$+).

Negative

  • Pending transactions is rare event. ~1-10% pending txes will be catched.
  • Not enough to become validator

System requirements:

@0fuz
0fuz / eth_bsc_wallet_template.go
Last active April 16, 2022 13:59
eth_bsc_wallet_template
import (
"context"
"crypto/ecdsa"
"crypto/elliptic"
"encoding/json"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/ethereum/go-ethereum/log"
"io/ioutil"
@0fuz
0fuz / bsc_ethers_wallet_template.md
Last active June 7, 2022 11:43
Template of using ETH wallet for transfering native and ERC20 funds. Same for EVM-compatible chains like BSC,FTM,MATIC.
npm init -y
npm i ethers

Set provider

let provider = new ethers.providers.JsonRpcProvider("https://bscrpc.com", 56) // bsc
// let provider = new ethers.providers.WebSocketProvider("wss://..........", 56) // bsc
@0fuz
0fuz / gist:43960fd99507c587b45c77daba91e90c
Last active April 26, 2022 17:09
Setup guide: BSC snapshot + AWS + geth full sync
  1. Create an EC2 instance for snapshot downloading
  2. Create and attach EC2 volume gp3, min 1.5tb, better 2tb, 8000 IOPS, 250MB/s
  3. Prepare attached volume to usage: