Skip to content

bitwindow: bid for FreeBank blocks - #2402

Closed
mblowes wants to merge 12 commits into
LayerTwo-Labs:masterfrom
mblowes:mb/freebank-bmm
Closed

mblowes wants to merge 12 commits into
LayerTwo-Labs:masterfrom
mblowes:mb/freebank-bmm

Conversation

@mblowes

@mblowes mblowes commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

FreeBank has no app of its own, and the BMM engine refused it, so a BitWindow user could run FreeBank but never bid for its blocks.
The FreeBank client now implements BMMNode with Bbc's three node RPCs, and a dialog on the sidechains page holds the engine's own BMM tab.
A bid from a BitWindow wallet won eCash block 970,377 on 2026-09-26, and the engine connected FreeBank block 159.

mblowes and others added 12 commits September 25, 2026 02:16
FreeBank had no RPC connection in BitWindow, so its Sidechains row had no
settings button, and never showed Stop, the status dot, the sync bar or
Your balance while the node ran. FreeBankRPC reads all of it through the
orchestrator's generic routes, so any FreeBank build works.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
FreeBankRPC is now an abstract SidechainRPC with a FreeBankLive
implementation, as every other chain has. BitWindow registers
FreeBankLive.

The deposit modal shows "Unsupported operation: fetching a FreeBank
address. Paste one from your FreeBank wallet." The other unsupported
calls no longer name the app. The class doc is one line and no longer
says it works for any FreeBank build: the row reports balance and sync
only where the orchestrator serves them for FreeBank.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
Brings back corenode.Options, which LayerTwo-Labs#2335 removed: the endpoint wallet
calls go to, getwalletinfo for a fork that predates getbalances, and the
address type getnewaddress asks for. Bbc and Elements pass no options
and keep the behaviour they have.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
A chain lists a helper such as grpcurl among its dependencies, and a
start puts it on disk before the chain names it in its boot arguments.
The desktop app fetches grpcurl as it opens, but headless drivechaind
never did, so a chain that reaches the enforcer through grpcurl fell
back to whatever PATH held. A failed download only warns.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
FreeBank is back on its C++ chassis: freebankd is a Core 0.16 fork with
a legacy wallet, released as the same freebank-<version> tarballs the
download block already matches.

- Restore sidechain/freebank from before LayerTwo-Labs#2302 and route "freebank" to
  it. Its Args pin the node to the mainchain: the enforcer transport,
  the REST port of BitWindow's Core, main as the chain, the fork block
  at the published fork height, and the grpcurl on disk.
- Add own_wallet. A Core fork with it takes no starter and no wallet
  provisioning: freebankd creates its wallet.dat at startup and has no
  createwallet or importdescriptors. The return comes before
  GetOrDeriveSidechainStarter, so the boot never waits on the wallet
  service. Balance and addresses come from the node's own wallet at the
  root endpoint.
- chains_config: port 8454, is_bitcoin_core, own_wallet, the Core
  directories, "Done loading", and grpcurl as a dependency. Migration
  024 carries the change to existing installs.
- Drop the Rust-only pieces: the CUSF conf spec, which would write a
  CUSF freebank.conf into ~/.freebank where freebankd reads its own; the
  bitcoin_balance reader; FreeBank in the explorer rebroadcast; and the
  freebankd arms of the CUSF directory layout.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
FreeBank is a Core fork again, so its log is debug.log in the Core
network dir, its Linux datadir sits directly under $HOME (~/.freebank),
and it takes the per-network subdir the CUSF chains do not have. Port
back to 8454.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
Stop and the sync probe built a bare JSON-RPC proxy for every sidechain.
A Core fork answers a call without its cookie with an empty 401, which
surfaced as "decode response: EOF". On shutdown and Reset that did not
read as a stop that never landed, so the orchestrator waited the whole
grace period before signalling, and every binary after it waited too.
The sync row showed an error for a healthy node.

Both now take the client nodes.New builds, which reads the cookie, and
the probe asks a Core fork only for its height. A stop that finds no
cookie never went out, so it goes straight to the signal. The CUSF
chains get the client they had. Bbc and Elements had the same bugs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
Dependencies now names tools that must be on disk as well as daemons
that must be running. own_wallet and a client's WalletPath "/" only
work together, so each doc comment points at the other.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gqbnw5hYV8j1ekU6P4GgYT
FreeBank was a Node and nothing more: its own refreshbmm made and paid
its bids, so the engine refused it ("produces its own blocks"). The
FreeBank client now implements BMMNode against three node RPCs that
match Bbc's, get_block_template, connect_block and get_bmm_inclusions,
so a BitWindow user can bid for FreeBank blocks from their own wallet,
with the engine's raises and settling.

FreeBank bids with a block's merkle root rather than its hash, because
the hash is fixed only once the winning mainchain block is written into
the header. So ChainHolds walks the chain comparing merkle roots, not
block hashes as Bbc's does. TemplateOnTip reads the parent from the
block hex as Bbc's does.

freebankd answers these from v0.2.16. An older node answers "method not
found", which the client turns into a sentence naming the release it
needs. corenode gains IsMethodNotFound for that.

FreeBank joins the audited BMM transports: connect_block goes through
the Core client, so it keeps its three-minute deadline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ES4QHkwW4ByYRrG4H39PHo
FreeBank has no app of its own, so its bidding lives in BitWindow. A
button beside FreeBank's settings opens a dialog with the engine's own
BMM tab, bound to FreeBank through a lazily registered BMMProvider.

Every block a bid wins carries the name the node writes into its
coinbase (coinbasetag in freebank.conf, read at startup), and explorers
credit the block to it. So the dialog asks for that name first, offered
as bitwindow-xxxx to change, and bidding waits until one is saved.
Saving edits that one line of the conf and restarts the node.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ES4QHkwW4ByYRrG4H39PHo
…dding to the engine

freebankd answers get_block_template with -40 while its own block for the
current mainchain tip is still arriving (for up to 60 s) or while it
reindexes, and with -10 or -28 while it starts. A template error made the
engine skip the whole mainchain block, so a late side block cost a round.
The FreeBank client now reports those codes as sidechain.ErrNotReady, and
CreateBid maps that to FailedPrecondition, which the engine already
retries on the same tip every tick. Other chains are unaffected.

The engine is the only bidder for a node BitWindow drives, so the node is
started with -bmmbidder=engine: from v0.2.16 freebankd then makes no bids
of its own. Older nodes ignore unknown options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ES4QHkwW4ByYRrG4H39PHo
@mblowes

mblowes commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

Tested on eCash beta, with a BitWindow GUI built from this branch (it includes #2392 and #2393) and the orchestrator at a0af19c. It ran headless on a Linux box, with the GUI on Xvfb, a full betanet node at the tip (970,372), and BitWindow's own downloaded enforcer (v0.3.4, 6e5f79f).

  1. orchestrator: run FreeBank as a Core fork again, with its own wallet #2392: Start on the FreeBank row downloads v0.2.15 from GitHub and runs it as a Core fork, with -mainchaintransport=enforcer -mainchainrest=127.0.0.1:18302 -mainchainchain=main -mainchainblockpin=967680:…d04042 -grpcurlbin=… -bmmbidder=engine. It synced from the public seed to block 154, the same as the FreeBank explorer.
  2. bitwindow: give FreeBank its settings button and running state #2393: the row shows the status dot, the balance, Stop and the cog. The cog shows version 0.2.15, the repository and the release/install dates.
  3. This PR:
    • The bid button beside the cog opens the dialog. The name comes pre-filled (bitwindow-3x8b), and the BMM tab stays greyed out until it is saved.
    • Save wrote coinbasetag=bitwindow-3x8b to ~/.freebank/freebank.conf and restarted the node (new PID). The tab is then live.
    • Start auto-bidding against v0.2.15 shows: "get block template: this FreeBank node is too old for bidding from BitWindow (it needs v0.2.16 or later)". No bid was made, and Stop clears the target.

The end-to-end bid, win and connect, with the name showing on the explorer, waits for freebankd v0.2.16, which adds the three RPCs. This stays a draft until then.

FreeBank running Bid dialog: name first Name saved
Start against v0.2.15 Cog

@mblowes

mblowes commented Sep 26, 2026

Copy link
Copy Markdown
Contributor Author

End to end on eCash beta: a bid from BitWindow won, and the engine connected the FreeBank block. Ready for review.

Setup:

  • The BitWindow GUI from this branch, with the orchestrator at a0af19c.
  • A full betanet node, and BitWindow's own enforcer (v0.3.4, 6e5f79f).
  • freebankd v0.2.16 (bb427a9), which adds get_block_template, connect_block and get_bmm_inclusions.

The run:

  1. Bidding started from the FreeBank dialog, paid from BitWindow's Core wallet. The engine first needs a 420,000-sat BMM coin in that wallet, as for every chain.
  2. The node's "side block for this eCash tip is pending" (-40) came back as FailedPrecondition, and the engine retried on the same tip instead of skipping it. That is the a0af19c change.
  3. The first bid missed: 1,504 sats, 624f8276…. The next eCash block arrived about 25 s later, and the bid cost nothing.
  4. The second bid won: 1,504 sats, 77de4c7372ff4da414e7a0fef21a0566dbf19337ab0a5626e1d8786e6e91f2a4, against a 900-sat rival bid. It was mined in eCash block 970,377.
  5. The engine connected FreeBank block 159 (035e3782c176db57d87e64d6af20a9e090ca4cd5a03cd762d7b5ad62a43bc4c7) through connect_block. The round went from won to connected.
  6. The block's coinbase carries the name saved in the dialog: …0e62697477696e646f772d33783862 = bitwindow-3x8b. The public seed, running v0.2.15, and the FreeBank explorer both have it: https://explorer.ecxfreebank.com/block/035e3782c176db57d87e64d6af20a9e090ca4cd5a03cd762d7b5ad62a43bc4c7
  7. The engine then bid for the next block on its own (0cacb895…).

Won and connected

Notes:

  • freebankd v0.2.16 is still a dev build. Its formal release follows this test. Against an older node, the dialog shows "needs v0.2.16 or later", as in the earlier comment.
  • The engine-wide ideas from the FreeBank review stay out of this PR: settling against all of OurBids, crediting the txid that was actually mined, switching to inclusions[0], and re-checking ChainHolds before counting profit. They would change BMM for every chain, so I'd raise them separately if they are wanted.

@mblowes
mblowes marked this pull request as ready for review September 26, 2026 07:57
@octobocto octobocto changed the title bitwindow: bid for FreeBank blocks from BitWindow bitwindow: bid for FreeBank blocks Sep 27, 2026
@mblowes

mblowes commented Sep 27, 2026

Copy link
Copy Markdown
Contributor Author

Closing: this landed on master as 22b6ea9, 16550a3, c8654f4 and 888a1fb (plus 87c9a04 on top), and shipped in 0.2.233. Thanks, Bjørn.

@mblowes mblowes closed this Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant