Skip to content

Instantly share code, notes, and snippets.

@ZenGround0
ZenGround0 / MessageContract.md
Last active November 4, 2022 12:23
A statement of purpose and system overview of the Filecoin Message Contract

Contract as a Deal Client for Archiving Filecoin Blockchain Message Data

Motivation

  1. Use web3 infrastructure to solve the filecoin message archive problem currently solved with web2 clouds
  2. Provide an EVM contract template for contract as a client data storage on the filecoin network
  3. Identify sticking points in the current model of data preparation, data transfer and deal negotiation for contract as a client storage deals. For example learn how the ask protocol should change to support this model.
  4. Demonstrate a new model for FIL+ auditing with significantly better fraud resilience properties

The core idea is that as system and protocol developers we will benefit from building a small application to understand how to adapt the network to similar applications. The nice thing is that fil infrastructure has a concrete application today which serves PLs broader goal of using our own tech.

@ZenGround0
ZenGround0 / devnet-boost.fish
Last active June 19, 2024 01:44
Fish scripts for an easy local devnet (mostly plagiarized and adapted from scripts of @jennijuju)
function devnet-boost
set -x BOOST_EXEC_PATH /Users/zenground0/pl/repos/boost
set -x LOTUS_EXEC_PATH /Users/zenground0/pl/repos/lotus
cd $LOTUS_EXEC_PATH
set -x FULLNODE_API_INFO (./lotus auth api-info --perm=admin | sed 's/^[^=]*=//')
set -x MINER_API_INFO (./lotus-miner auth api-info --perm=admin | sed 's/^[^=]*=//')
set -x PSD_WALLET (./lotus wallet new)
echo "Sending 100 FIL to $PSD_WALLET"
./lotus state wait-msg (./lotus send $PSD_WALLET 100)
@ZenGround0
ZenGround0 / miner-power-lf-ab.csv
Created October 9, 2020 19:54
Balance and power info for all miners with power
miner_addr locked_fund available_balance percentage_power
f02767 24696253356480328192907 3448319756017030661503 0.7425%
f03482 1865243360901916413517 284784336988146748135 0.0810%
f024468 0 6487534081779092886 0.0001%
f01287 7776632751493145606495 37962621493834690048 0.3178%
f08403 0 8749842251001152016 0.0005%
f07709 0 28493585174620871928 0.0085%
f010048 159954177664607847768 1532512088095547333 0.0094%
f014701 234878149345434458855 2197893315693632270 0.0063%
f010558 208996663265050539014 9403947183209253002 0.0006%
addr,power_summary,power_percentage,debt,locked_funds,debt_minus_locked_funds,debt_minus_locked_funds_in_rounded_FIL
f01155,(454.9 TiB / 489.9 PiB),0.0906%,738165819535979446420,163461236877981722109,574704582657997724311,575FIL
f015902,(1.312 TiB / 489.9 PiB),0.0002%,15892725699167755436,0,15892725699167755436,16FIL
f08385,(288 GiB / 489.9 PiB),0.0000%,1124620050307575561,0,1124620050307575561,1FIL
f02419,(2.312 TiB / 489.9 PiB),0.0004%,178541895364964059964,0,178541895364964059964,179FIL
f022970,(384 GiB / 489.9 PiB),0.0000%,157040318843098910,0,157040318843098910,0FIL
f015799,(32 GiB / 489.9 PiB),0.0000%,15771041290578916234,0,15771041290578916234,16FIL
f08399,(1.156 TiB / 489.9 PiB),0.0002%,4363625856165831805,0,4363625856165831805,4FIL
f015805,(1.344 TiB / 489.9 PiB),0.0002%,16892993524550778769,0,16892993524550778769,17FIL
f022791,(384 GiB / 489.9 PiB),0.0000%,2328995567473538653,0,2328995567473538653,2FIL
@ZenGround0
ZenGround0 / gist:da85b63fd2fc725dc8cddf6a04399321
Last active October 9, 2020 17:27
miner-debt-refined.txt
f01155,500174711422976(454.9 TiB) / 551568221367435264(489.9 PiB) ~= 0.0906%,738165819535979446420
f015902,1443109011456(1.312 TiB) / 551568221367435264(489.9 PiB) ~= 0.0002%,15892725699167755436
f08385,309237645312(288 GiB) / 551568221367435264(489.9 PiB) ~= 0.0000%,1124620050307575561
f02419,2542620639232(2.312 TiB) / 551568221367435264(489.9 PiB) ~= 0.0004%,178541895364964059964
f022970,412316860416(384 GiB) / 551568221367435264(489.9 PiB) ~= 0.0000%,157040318843098910,
f015799,34359738368(32 GiB) / 551568221367435264(489.9 PiB) ~= 0.0000%,15771041290578916234
f08399,1271310319616(1.156 TiB) / 551568221367435264(489.9 PiB) ~= 0.0002%,4363625856165831805
f015805,1477468749824(1.344 TiB) / 551568221367435264(489.9 PiB) ~= 0.0002%,16892993524550778769
f022791,412316860416(384 GiB) / 551568221367435264(489.9 PiB) ~= 0.0000%,2328995567473538653
f022912,3710851743744(3.375 TiB) / 551568221367435264(489.9 PiB) ~= 0.0006%,12613886471293363612
@ZenGround0
ZenGround0 / miner-debt.txt
Created October 9, 2020 16:20
All miners in debt at block ~130000
miner f021483 397208579410456432
miner f021428 17236087276879207763
miner f08109 15263818717091973697
miner f014632 4154068213564960491
miner f01001 3492002270556227911190
miner f022313 610473114191155236
miner f09731 17380000573712836851
miner f015903 15776832867967329746
miner f021580 167815608280463667
miner f07956 11719853651097569161
@ZenGround0
ZenGround0 / power-for-debts.txt
Created October 9, 2020 16:18
Filecoin miners in debt as of block ~130000
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
0(0 B) / 551568221367435264(489.9 PiB) ~= 0.0000%
@ZenGround0
ZenGround0 / upgrade-validation-with-ent.md
Last active November 25, 2020 01:09
Use ent for post-upgrade validation

Run a lotus node and sync the filecoin blockchain up to the height you want to validate

One way to see how far you've synced is to inspect the output of ./lotus sync wait

Get the inspection-cid

"inspection-cid" is the cid of the block header at inspection-epoch, the epoch whose parent state you want to validate.

By Using the lotus daemon

  1. ./lotus chain head to get your node's current head if inspection-epoch is head height. A list of cids is output, copy one of them.
  2. ./lotus chain list --height=<inspection-epoch> --count=1 if head is above inspection epoch. A list of cid to miner mappings is output, copy one of them.

By Using filfox

Navigate to https://filfox.info/en/tipset/<inspection-height>

@ZenGround0
ZenGround0 / sectors.sh
Created September 27, 2020 17:06
Convert power into number of sectors by dividing by 32GiB
#!/bin/bash
echo "$1 / 34359738368" | bc -l | sed 's!\.0*$!!'
@ZenGround0
ZenGround0 / tipget
Created September 27, 2020 01:07
parse (base32) cids from output and join with comma
grep $1 -ooE "[a-z2-7]{62}" | tr '\n' ','