Repository navigation
One real mainnet day, netted: 336 payments become 9 transfers - #12
Merged
Merged
Conversation
tools/mainnet_day.py builds a netting window from real Stellar data: every account stellar.expert's directory tags as an exchange, anchor, custodian or wallet (480 accounts, 229 institutions), and each one's USDC payments (Circle's issuer) for one UTC day from Horizon, keeping those between two different institutions. Each row's id is its operation id, so it can be checked on an explorer; amounts are exact stroops. data/mainnet-2026-10-21.csv is that day: 336 payments between 10 institutions, 55.5M USDC. examples/mainnet_day.rs nets it: 336 payments become 9 transfers, while value moved falls only 3.9% because the day's flows were mostly one-way. docs/mainnet-day.md has the method, the numbers and the limits (three busy accounts hit the page cap, so it is a lower bound), and the README summarizes it.
Import CSV reads the format setoff net and read_csv take into the table, in the page. A small parser handles quoted fields, checks the header, and reports each malformed line by number while loading the good ones. A real mainnet day loads data/mainnet-2026-10-21.csv (copied into the site by pages.yml), with a note on where it comes from. Its amounts stay exact stroops in the table, and results are shown in USDC (7 decimals), so a plan line no longer reads as trillions. tests/fixtures/remittance-corridor.csv is the corridor vector as CSV, and a test keeps it identical to the JSON vector. Importing it shows the vector's exact transfers. Closes #8.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8.
What SetOff would have changed on a real day. Every USDC payment between institutions on Stellar mainnet on 2026-10-21: 336 payments between 10 institutions (exchanges, Circle and others), 55.5M USDC in total.
336 payments become 9 transfers. Value moved fell only 3.9%, because that day's flows were mostly one-way (exchanges and Circle), and netting can't offset one-way flows. The gain is operational: 37 times fewer transactions to sign, fee and reconcile.
tools/mainnet_day.py(stdlib only) builds the window:data/mainnet-2026-10-21.csvis the day.examples/mainnet_day.rsnets it.docs/mainnet-day.mdhas the method, the numbers and the limits. It's a lower bound: three very busy accounts hit the per-account page cap, and the directory isn't complete.id,debtor,creditor,asset,amountfiles in the page. Malformed lines are reported by line number, and the rest load. Nothing is uploaded.Done-when from #8
tests/fixtures/remittance-corridor.csvis that vector, and a Rust test keeps it identical to the JSON.The issue says "the same result as the built-in example", but the built-in corridor example has different amounts from the vector. So the check is against the vector's own expected result, which is what the issue is after.
Checked
cargo fmt --check,cargo clippy --workspace --all-targets --all-features, andcargo test --workspace --all-featuresall pass, including the new fixture test.