Skip to content

Instantly share code, notes, and snippets.

get l1gas-data for optimism with web3.py

from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://opt-mainnet.g.alchemy.com/v2/YOURAPIKEY'))
assert w3.isConnected()

tx_hash = '0x134b8e636baf60053503b5065b5493e5bdd2d67c0e760c265fcc79ef554be02f'
@r4VP4
r4VP4 / HallOfBlame.md
Created August 29, 2022 12:24 — 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.

@r4VP4
r4VP4 / GethBEHAVE.md
Created August 20, 2022 15:02 — forked from yorickdowne/GethBEHAVE.md
Pruning Geth 1.10.x

Overview

Geth (Go-Ethereum) as of July 2022 takes about 650 GiB of space on a fast/snap sync, and then grows by ~ 14 GiB/week with default cache, ~ 8 GiB/week with more cache.

This will fill a 1TB SSD in a few months, to the point where space usage should be brought down again with an offline prune.

There is an odd behavior with Geth 1.10.20 where initial DB size is large after sync until Geth has been restarted twice. This is expected to be fixed soon, possibly as soon as 1.10.21.

Happily, Geth 1.10.x introduces "snapshot offline prune", which brings it back down to about its original size. It takes roughly 4-6 hours to prune the Geth database, and this has to be done while Geth is not running.

Caveat that while several folx have used offline pruning successfully, there is risk associated with it. The two failure mode

@r4VP4
r4VP4 / README-setup-tunnel-as-systemd-service.md
Created June 24, 2022 04:04 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/[email protected]. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@r4VP4
r4VP4 / hardhat_interact.py
Created May 29, 2022 16:03
web3.py interact with hardhat
"""
there should be an instance with hardhat running at localhost port 8547
"""
import os
from dotenv import load_dotenv
from web3 import Web3
from web3.types import RPCEndpoint
load_dotenv()
@r4VP4
r4VP4 / only_replace_a_key_with_higher_value.py
Created May 14, 2022 07:03
python redis conditional value changing
import concurrent.futures
import logging
import time
from random import randrange
from timeit import default_timer as timer
import redis
from redis_wrapper.definitions import REDIS_CONN0
lredis: redis = redis.Redis(**REDIS_CONN0)
@r4VP4
r4VP4 / contracts...FundMe.sol
Created November 12, 2021 20:49
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.6.9+commit.3e3065ac.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6 <0.9.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract FundMe{
mapping(address => uint256) public addressToAmountFunded;
address[] public funders;
@r4VP4
r4VP4 / contracts...FundMe.sol
Created November 9, 2021 08:59
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.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6 <0.9.0;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract FundMe{
mapping(address => uint256) public addressToAmountFunded;
@r4VP4
r4VP4 / .deps...npm...@chainlink...contracts...src...v0.6...interfaces...AggregatorV3Interface.sol
Created November 6, 2021 19:37
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.7+commit.e28d00a7.js&optimize=false&runs=200&gist=