Skip to content

Instantly share code, notes, and snippets.

View run-faucet.sh
#!/usr/bin/env bash
[[ -z $1 ]] && { echo "Pass [mordor|kotti] as ARG1"; exit 1; }
set -e
[[ -d $HOME/.faucet ]] && { echo "Backing up exiting .faucet datadir" && mv $HOME/.faucet $HOME/.faucet.bak; }
onexit()
{
View lotus-openrpc-spec.json
{
"info": {
"title": "Lotus RPC API",
"version": "1.2.1"
},
"methods": [
{
"deprecated": false,
"description": "```go\nfunc (c *FullNodeStruct) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) {\n\treturn c.Internal.BeaconGetEntry(ctx, epoch)\n}\n```",
"externalDocs": {
View openrpc_doc.json
{
"info": {
"title": "Lotus RPC API",
"version": "1.2.1"
},
"methods": [
{
"deprecated": false,
"description": "```go\nfunc (c *FullNodeStruct) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) {\n\treturn c.Internal.BeaconGetEntry(ctx, epoch)\n}\n```",
"externalDocs": {
@meowsbits
meowsbits / geth-jsonrpc-transports-shell.sh
Last active Dec 7, 2020
How to hit geth's JSON RPC over different transports.
View geth-jsonrpc-transports-shell.sh
#!/usr/bin/env bash
# HTTP
curl -X POST $(curl icanhazip.com/v4):8545 --data '{"jsonrpc":"2.0","method":"trace_transaction","params":["0x552280896083bfe801a1f70c84011d1b4195a2c08d2221f80245380775cd6270"],"id":1}' -H "Content-Type: application/json
http --json POST http://localhost:8545 id:=$(date +%s) method='rpc_discover' params:='[]'
# Websocket
echo rpc.discover | websocat -B 650000 -n1 --jsonrpc ws://localhost:8546
# IPC
View geth.3.log
-- Logs begin at Mon 2020-11-16 09:00:20 CST, end at Tue 2020-12-01 07:55:24 CST. --
Dec 01 07:46:02 ubp52 systemd[1]: Starting core-geth classic service...
Dec 01 07:46:02 ubp52 sh[16822]: INFO [12-01|07:46:02.314|internal/debug/flags.go:212] Starting pprof server addr=http://127.0.0.1:6060/debug/pprof
Dec 01 07:46:02 ubp52 sh[16822]: INFO [12-01|07:46:02.314|geth/main.go:317] Starting Geth on Ethereum Classic...
Dec 01 07:46:02 ubp52 sh[16822]: INFO [12-01|07:46:02.314|cmd/utils/flags.go:1910] Enabling metrics collection
Dec 01 07:46:02 ubp52 sh[16822]: INFO [12-01|07:46:02.314|cmd/utils/flags.go:1930] Enabling stand-alone metrics HTTP endpoint address=0.0.0.0:6060
Dec 01 07:46:02 ubp52 sh[16822]: INFO [12-01|07:46:02.315|metrics/exp/exp.go:62] Starting metrics server addr=http://0.0.0.0:6060/debug/metrics
Dec 01 07:46:02 ubp52 sh[16822]: ERROR[12-01|07:46:02.315|metrics/exp/exp.go:65] Failure in running metrics server err="listen tcp
View lotus-openrpc-spec.json
{
"openrpc": "1.2.6",
"info": {
"title": "Lotus RPC API",
"version": "1.1.2+git.3ccacf2e2.dirty/generated=2020-10-30T10:50:39-05:00"
},
"methods": [
{
"name": "Filecoin.BeaconGetEntry",
"description": "```go\nfunc (c *FullNodeStruct) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) {\n\treturn c.Internal.BeaconGetEntry(ctx, epoch)\n}\n```",
View EIP2200-and-tigers-and-bears-oh-my.md

The interrelated stories of at least but not limited to EIP1283, EIP1706, EIP2200, EIP1884, ECIP1061, ECIP1078, and ECIP1086.

EIP1283 comes into existence. Has way of net gas metering. Gets Finalized.

EIP____ ("Constantinople") comes into existence specifying enabling EIP1283 on ETH (and testnets).

EIP1283 enabled on Ropsten and other testnets.

Uh oh! EIP1283 has bugs.

@meowsbits
meowsbits / coregeth_mordor.service.sh
Last active Jun 2, 2020
Example systemd unit file for running Mordor network on core-geth.
View coregeth_mordor.service.sh
#!/usr/bin/env bash
cat <<EOF > /etc/systemd/system/coregeth_mordor.service
[Unit]
Description=CoreGeth Mordor
[Service]
Type=simple
User=root
Restart=always
@meowsbits
meowsbits / geth.core.block_validator.go-block-gaslimit-max-step.diff
Created May 28, 2020
Maximized block gas limit steps for miners with strong opinions.
View geth.core.block_validator.go-block-gaslimit-max-step.diff
diff --git a/core/block_validator.go b/core/block_validator.go
index 37bea2b246..862ee952cc 100644
--- a/core/block_validator.go
+++ b/core/block_validator.go
@@ -107,34 +107,19 @@ func (v *BlockValidator) ValidateState(block *types.Block, statedb *state.StateD
// ceil if the blocks are full. If the ceil is exceeded, it will always decrease
// the gas allowance.
func CalcGasLimit(parent *types.Block, gasFloor, gasCeil uint64) uint64 {
- // contrib = (parentGasUsed * 3 / 2) / 1024
- contrib := (parent.GasUsed() + parent.GasUsed()/2) / vars.GasLimitBoundDivisor
@meowsbits
meowsbits / geth.miner-hashrate-floor-monitor.js
Created May 28, 2020
When and if geth's CPU miner drops below floor hashrate, switch off and restart mining after an interval.
View geth.miner-hashrate-floor-monitor.js
var hashrateFloor = 20000;
for (;true;) {
var sleepInterval = 60;
if (!eth.mining) {
console.log(Date(), "starting miner")
miner.start();
sleepInterval = 60*10;
}
var hashrate = miner.getHashrate();
console.log(Date() , "hashrate", hashrate);