The FinField knitweb domain plugin — weave signed financial facts into the pulse P2P fabric and vote on what is factually correct.
Matched to the nature of the number:
- Exact facts (audited filing values). Every honest node that reads the same
filing mints the byte-identical CID, so correctness is a yes/no question about
one record. It is settled by a personhood-gated binary
vank poll on the fact's knit-CID:
open_fact_polldefines the poll, each peer casts withcast_ballot(web, voter_priv, ticket, scope, knit_cid, correct=...)(their own pairwise key plus the pulse personhood ticket — one person, one vote; re-vote with a higherseq), andfact_verdicttallies deterministically (True / False / None on tie). - Continuous quantities (crypto prices, cross-venue closes, model signals).
Different honest observers legitimately report different numbers, so there is
no single CID to vote yes/no on. Floats never enter records — each observer
publishes their own scaled-integer observation fact, and
float_consensustakes the vank-style weighted median (integer weights, lower middle wins on an even split, so every node computes the same winner). The result is afinfield-consensusfact whosederived_fromlists every counted observation CID.
Anyone runs the same code with their own key: instantiate
FinFieldKnitweb(your_priv), weave the facts you scraped or derived
(emit / weave_factset — every record is invariant-checked and signed by
you), and vote on other people's facts through pulse polls. Records relayed
from peers decode back into FinFacts with from_record (invariant-checked on
the way in). The field converges on truth by tally, not by trusting any single
publisher.
pip install "finknit @ git+https://github.com/FinField/knit" # pulls finfacts
# optional — P2P weaving + polls need the pulse runtime and vank:
pip install "knitweb @ git+https://github.com/knitweb/pulse"
pip install "knitweb-vank @ git+https://github.com/Knitweb/vank"The pure-math layer (weighted_median, float_consensus) is stdlib-only and
works without either optional install.
examples/vote_demo.py is the end-to-end proof: a publisher weaves a real
FinFact (AAPL FY2024 revenue, straight from the 10-K accession), an authority
opens a correct/incorrect poll on its knit-CID, and three independent voters —
each with their own pairwise key and a PersonhoodTicket minted by the real
pulse personhood gate — cast gated, signed ballots. The tally is deterministic
(one person one vote via nullifier dedupe; a re-vote with a higher seq
supersedes), and any peer re-tallies the identical verdict from a
web_snapshot()/import_web() round-trip.
# with knitweb + knitweb-vank pip-installed (or sibling checkouts on PYTHONPATH):
python3 examples/vote_demo.py
# from a source layout, e.g.:
PYTHONPATH=/path/to/pulse/src:/path/to/vank/src python3 examples/vote_demo.pyTrimmed output (fully deterministic — run it twice, byte-identical):
[1] publisher weaves the fact (signed, invariant-checked)
fact us-gaap:RevenueFromContractWithCustomerExcludingAssessedTax FY2024 = 391035000000 USD
source sec-companyfacts accession 0000320193-24-000123
knit-cid bafyreidfcaxtpcysjvkpk6xoloakzcufwsmuivqioblojcurqije4jpdsu
[2] authority opens the correct/incorrect poll on the fact CID
window [1000, 2000) quorum 2 options 2 (0=incorrect, 1=correct)
[3] three voters, each with their own key + gate-minted PersonhoodTicket
voter-1 ... correct=True seq=0 voter-2 ... correct=True seq=0
voter-3 ... correct=False seq=0
interim verdict (2 yes / 1 no): True
voter-3 re-votes correct=True seq=1 -> ... (highest seq wins)
[4] deterministic tally from the woven web
ballots woven 4 | persons counted 3 (one person one vote: nullifier dedupe)
results incorrect=0 correct=3
verdict: True -- the fact is confirmed correct
[5] auditability: any peer re-tallies from a snapshot round-trip
state_root e10092d7b095bacb2ebf4a87fbf65c2e1ce798b1867084573f42c62dca56b8be
import_web(snapshot) -> verdict True (identical), state_root identical: True
from finfacts.model import FinFact, Period, Source
from finknit.vote import float_consensus
day = Period(end="2026-07-03")
obs = [
FinFact(entity_id="ticker:BTC CRYPTO", concept="finfield:close",
value=1089934, scale=2, unit="USD", period=day, # 10899.34
source=Source(kind="coingecko-market", ref="observer-a")),
FinFact(entity_id="ticker:BTC CRYPTO", concept="finfield:close",
value=10900, scale=0, unit="USD", period=day, # 10900
source=Source(kind="coingecko-market", ref="observer-b")),
FinFact(entity_id="ticker:BTC CRYPTO", concept="finfield:close",
value=108991, scale=1, unit="USD", period=day, # 10899.1
source=Source(kind="coingecko-market", ref="observer-c")),
]
fact = float_consensus(obs, weights={"observer-a": 2, "observer-b": 1, "observer-c": 1})
print(fact.decimal, fact.cid) # weighted median at the finest scale
print(fact.derived_from) # CIDs of every counted observationPart of the FinField field: facts · scrapers · agents · signals · crypto