Add the eCash.com (ECX) fork plugin - #457
Open
j0ntz wants to merge 2 commits into
Open
Conversation
Chains that fork from Bitcoin can mark their transactions with an nLockTime value that their own nodes treat as final and the parent chain rejects as non-final. Coins can now declare that value through CoinInfo.replayProtectionLocktime, and makeTx writes it into the PSBT while holding input sequence numbers below 0xffffffff so the locktime is actually enforced.
Open
6 tasks
Contributor
Author
j0ntz
force-pushed
the
jon/ecash-ecx-fork
branch
from
August 18, 2026 00:30
48aa9b1 to
cccede1
Compare
j0ntz
marked this pull request as ready for review
August 18, 2026 00:30
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
ECX is the ecash.com hard fork of Bitcoin, which credits every Bitcoin address 1:1 at the fork block and is unrelated to the Bitcoin ABC eCash chain this repo already ships as XEC. It reuses Bitcoin's key and address formats and Bitcoin's coin type, so a Bitcoin wallet can split into it and find the forked coins, and it marks every transaction with the fork's replay protection locktime.
j0ntz
force-pushed
the
jon/ecash-ecx-fork
branch
from
August 18, 2026 08:02
cccede1 to
22d81a8
Compare
Contributor
|
maybe a better pluginId is ecashbitcoin |
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.


CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneDescription
Adds
ecashcom, a UTXO plugin for eCash (ECX), and the generic transaction-building support its replay protection needs. Recreates #456 with the fork research written down and several defects corrected.Asana: https://app.asana.com/0/1215088146871429/1217562074592399
What ECX is
ECX is a hard fork of Bitcoin by Layer Two Labs that activates drivechains (BIP300/BIP301). Every Bitcoin address is credited ECX 1:1 at the fork block; Bitcoin itself is untouched. The fork point is Bitcoin block ~963,648, targeted for 2026-08-22 ~15:00 UTC (ecash.com's own banner currently says ~973,728, so the exact height is still moving). It is a different chain from the eCash this repo already ships as
ecash/XEC, which is the Bitcoin ABC project. They share a brand name and nothing else, which is the main reason this plugin needs care.Sources: ecash-com/fast-facts, ecash.com, drivechain.info/dev.txt.
Replay protection, and why the sequence number matters
The fork's opt-in replay protection is a magic locktime: a transaction with
nLockTime == 499999999(LOCKTIME_THRESHOLD - 1) is treated as final by eCash nodes (a change inIsFinalTx), while Bitcoin reads that value as a block height roughly 500 million blocks away and rejects the transaction as non-final. The asymmetry is one directional: it stops an ECX transaction from replaying onto Bitcoin, and the Bitcoin side is protected by splitting order instead.The protection only holds while at least one input sequence is below
0xffffffff, because a transaction whose inputs are all final has its locktime ignored. SomakeTxnow does both: it writes the locktime into the PSBT and drops the sequence to0xfffffffewhen RBF is off. With RBF on, the existing0xfffffffdalready satisfies the requirement, and the tests cover both paths plus a control asserting coins without a replay locktime are untouched.The mechanism is expressed as a generic
CoinInfo.replayProtectionLocktime, so any future fork using the same trick just sets the field.Key derivation
Keys and addresses are byte-for-byte Bitcoin: P2PKH
0x00, P2SH0x05, bech32bc, WIF0x80, xpub/xprv0x0488B21E/0x0488ADE4. Confirmed independently by the xpub magics in ecash-com/blockbook's ECX coin config.The plugin therefore uses coin type
0. That is not a shortcut: ECX has no SLIP-44 index of its own, and the forked coins live on Bitcoin's derivation paths, so any other coin type would derive addresses that hold nothing and make the Bitcoin split useless. ECX is registered in Bitcoin'sforkslist for all four formats.Naming
The XEC plugin already displays as "eCash". Layer Two Labs disambiguates its own chain as "eCash.com" (the label and alias in their Blockbook coin config, where the alias is literally
ecashcom), so this plugin uses that name and that pluginId. Two wallet rows both reading "eCash" is the alternative.What the fork has not published, left empty rather than guessed
The chain is not live yet. Nothing below is filled in with a plausible-looking value:
addressExplorerandtransactionExplorerare empty strings andblockExploreris omitted. Every ECX service still runs against the drynet dry-run networks, including in Layer Two Labs' own wallet: ecash-wallet-mobile'sNetworkRegistry.swiftships.ecashwithexplorerTxTemplate: "https://explorer.drynet3.drivechain.dev/tx/{txid}", and they added a remote-config key (remote.svc.explorer.<network>.template) so they can push a real URL after launch. No ecash.com explorer host resolves, and none appears anywhere in the site's JS bundle. An empty string is the "no explorer" signal the app already handles, so the explorer rows stay hidden until a host exists.blockbookServersis empty and a wallet cannot sync. This is structural, not a delay: the fork's own stack is Electrum and Esplora (their wallet uses BDK'sElectrumClient/EsploraClient, and their backends doc states there is no bitcoind-RPC client). Blockbook exists only as ecash-com/blockbook branchecash-com, whoseecashcomcoin config still carries TODO binary URLs and an emptyexplorer_url. Someone has to deploy one from that config.maximumFeeRate. It is derived from a USD price, ECX does not trade (ecash.com is still running a/list-ecxpage soliciting listings), and a made-up price yields a cap that guards nothing. The field is omitted, so the signing library's own default applies. The sat/byte fee levels are Bitcoin's, carried over because the fork keeps Bitcoin's block size, supply and divisibility.eand the fork has not published one, so only thesatsunit carries a symbol.0x00BFBF3F) instead of the locktime. The locktime is corroborated by their shipping wallet (case .ecash: return UInt32(499_999_999) // LOCKTIME_THRESHOLD - 1), but reverify against the launch branch and drivechain.info/dev.txt before go-live.real eCash mainnet: 964_000, and ecash.com's banner currently says ~973,728.Changes vs PR #456
explorer.ecash.comURLs (a host that does not resolve) and a placeholder USD price for the fee cap. Both are gone, with the reason recorded in code.test/common/utxobased/info/all.spec.tsand the signing tests in a per-coin file, matching this repo's layout, rather than inMetadata.spec.ts.Testing
npm run lint,npm run types,npm test(1276 passing, 8 pending), andverify-repo.shall pass.499999999and sequence0xfffffffe; same with RBF on (0xfffffffd); Bitcoin unchanged (locktime0, sequence0xffffffff); registry assertions for the XEC/ECX split and plugin-id uniqueness.edge-react-guiviaupdotand driven on the iOS simulator: ECX appears as a creatable asset ("ECX / eCash.com"), the wallet creates, and its scene opens. Screenshots are attached below.SPECIAL_CURRENCY_INFOentry hits it) but PR Add ECX eCash fork support #456 would have shipped into it.