diff --git a/CLAUDE.md b/CLAUDE.md index a1966c6..29ad7f3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -41,15 +41,15 @@ Pipeline (see `docs/architecture.rst`): `Env` → `Controller` (`server/controll Coin abstraction: `lib/coins.py` defines `Coin` and the `Palladium`, `PalladiumTestnet`, `PalladiumRegtest` subclasses. A coin class selects behavior through class attributes: `DESERIALIZER` (block/tx format, in `lib/tx.py`, only the segwit one remains), `DAEMON`, `BLOCK_PROCESSOR`, `SESSIONCLS`, address verbytes, `GENESIS_HASH`, `REORG_LIMIT`, `RPC_PORT`, `PEERS`, header handling, etc. Coins are discovered by walking `Coin` subclasses (`lookup_coin_class` matches `NAME` + `NET`; `COIN` defaults to `Palladium`). Concrete classes must define `TX_COUNT`, `TX_COUNT_HEIGHT`, `TX_PER_BLOCK` (used only for sync ETAs) or lookup raises. -Daemon: Palladium Core is based on Bitcoin Core 0.19: no `getindexinfo`, `txospenderindex` or `submitpackage`. So `MIN_REQUIRED_DAEMON_VERSION`/`REQUIRED_DAEMON_INDEXES` (see `Coin`) are unset, and `blockchain.outpoint.subscribe` / `blockchain.transaction.broadcast_package` return a daemon error to clients. The daemon needs `txindex=1`. +Daemon: Palladium Core has segwit and taproot (BIP341/342, mainnet height 405000; the server is script-type agnostic, indexing by script hash) and bech32/bech32m addresses, but no `getindexinfo`, `txospenderindex` or `submitpackage` RPCs. So `MIN_REQUIRED_DAEMON_VERSION`/`REQUIRED_DAEMON_INDEXES` (see `Coin`) are unset, and `blockchain.outpoint.subscribe` / `blockchain.transaction.broadcast_package` return a daemon error to clients. The daemon needs `txindex=1`. DB schema changed in 2.0 with no migration; changing on-disk format requires a full resync. ## Tests -Integration tests (`tests/integration`): `node/Dockerfile` + `node/palladium.conf` run the Palladium node (official release binaries, signature checked) in regtest, `conftest.py` starts `electrumx_server` on an empty DB against it and the tests mine blocks and check headers, balances, mempool, history, merkle proofs and broadcast through the Electrum protocol. Regtest coinbase maturity is 120 blocks, bech32 hrp is `rplm`. The CI job is `integration`. Bump `VERSION` in the Dockerfile to test against a newer node. +Integration tests (`tests/integration`): `node/Dockerfile` + `node/palladium.conf` run the Palladium node (official release binaries, signature checked) in regtest, `conftest.py` starts `electrumx_server` on an empty DB against it and the tests mine blocks and check headers, balances, mempool, history, merkle proofs and broadcast through the Electrum protocol. Regtest coinbase maturity is 120 blocks, bech32 hrp is `rplm` (`plm` on mainnet, `tplm` on testnet: `Coin.BECH32_HRP`). The CI job is `integration`. Bump `VERSION` in the Dockerfile to test against a newer node. -`tests/lib` (Palladium params, addresses, hashes, scripts), `tests/server` (env, daemon, mempool, storage, API), plus fixture-driven `tests/test_blocks.py` / `test_transactions.py` using JSON files named `__.json` in `tests/blocks` and `tests/transactions` (real mainnet data from a synced node; tx vout values in satoshis). `test_storage.py` needs both DB engines installed. Bech32 addresses are not supported by `Coin.address_to_hashX` (base58 only). Fixtures were taken from a synced node (`getblock 0|1`, `getrawtransaction true `, run via `docker compose exec palladiumd palladium-cli ...` in the node's project); vout values converted to satoshis. Ports, SSL, RPC credentials and donation address are documented in `DEPLOY.md`. +`tests/lib` (Palladium params, addresses, hashes, scripts), `tests/server` (env, daemon, mempool, storage, API), plus fixture-driven `tests/test_blocks.py` / `test_transactions.py` using JSON files named `__.json` in `tests/blocks` and `tests/transactions` (real mainnet data from a synced node; tx vout values in satoshis). `test_storage.py` needs both DB engines installed. Fixtures were taken from a synced node (`getblock 0|1`, `getrawtransaction true `, run via `docker compose exec palladiumd palladium-cli ...` in the node's project); vout values converted to satoshis. Ports, SSL, RPC credentials and donation address are documented in `DEPLOY.md`. ## Repository and workflow diff --git a/DEPLOY.md b/DEPLOY.md index 197d219..7031d16 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -238,7 +238,7 @@ From another machine, `nc -zv 50001` must succeed if the server is m | log: connection refused / cannot connect to `palladiumd:2332` | the node is stopped or still starting; check that the node container is running | | log: `401`/authorization errors | wrong `PLM_RPC_USER` / `PLM_RPC_PASSWORD` in `.env`; the credentials must be the ones in the node's `palladium.conf` | | errors mentioning `txindex` | `txindex=1` is missing in `palladium.conf` (an index added later is built while the node runs, which takes time) | -| `blockchain.outpoint.subscribe` or package broadcast return a daemon error | expected: Palladium Core is based on Bitcoin Core 0.19 and does not have these RPCs | +| `blockchain.outpoint.subscribe` or package broadcast return a daemon error | expected: Palladium Core does not have the RPCs they need (`gettxspendingprevout`, `submitpackage`) | | the server stays at an old height | the node is not synced; ElectrumX only follows the node | | clients cannot connect from outside | port not published/forwarded, firewall, or `SERVICES` does not list that protocol | | container stops at once, log says `ERROR: ... is not writable` | the data directory belongs to another user (or to root, if Docker created it): `chown -R $(id -u):$(id -g) ~/.plm-electrumx`, or set `PLM_UID`/`PLM_GID` | diff --git a/README.md b/README.md index 91701eb..e9248a9 100644 --- a/README.md +++ b/README.md @@ -85,12 +85,15 @@ When merging upstream, resolve modify/delete conflicts on these files by keeping ### Palladium specifics -- Palladium Core is based on Bitcoin Core 0.19. It has no `getindexinfo`, `txospenderindex` or - `submitpackage`, so the daemon version/index checks are disabled for `COIN=Palladium`, and +- Segwit and taproot (BIP341/342, active on mainnet from block 405000) are supported: the server indexes + by the hash of the output script, so every script type is handled alike. Addresses (base58, bech32 `plm1`, + bech32m for taproot) are only read by the local `electrumx_rpc query` command. +- Palladium Core has no `getindexinfo`, `txospenderindex` (`gettxspendingprevout`) or `submitpackage` RPCs, + so the daemon version/index checks are disabled for `COIN=Palladium`, and `blockchain.outpoint.subscribe` and `blockchain.transaction.broadcast_package` return a daemon error to clients. - The daemon must run with `txindex=1`. -- Same genesis blocks as Bitcoin (mainnet, testnet3, regtest), 80-byte headers, sha256d PoW, segwit. +- Same genesis blocks as Bitcoin (mainnet, testnet3, regtest), 80-byte headers, sha256d PoW. - Parameters (address prefixes, ports, genesis hashes) were taken from the Palladium Core chain parameters. ## License diff --git a/docs/changelog.rst b/docs/changelog.rst index de930a9..df0518f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -10,9 +10,13 @@ First release of the Palladium fork. Based on a snapshot of upstream ElectrumX 2 * new: ``Palladium``, ``PalladiumTestnet`` and ``PalladiumRegtest`` coins, now the only ones (the default ``COIN`` is ``Palladium``). -* Palladium Core is based on Bitcoin Core 0.19: the daemon version/index checks are disabled, ``txindex=1`` is - required, and ``blockchain.outpoint.subscribe`` / ``blockchain.transaction.broadcast_package`` return a daemon - error to clients. +* Segwit and taproot outputs are supported (the server indexes by script hash); ``Coin.BECH32_HRP`` and a + bech32/bech32m decoder let ``electrumx_rpc query`` read ``plm1``, ``tplm1`` and ``rplm1`` addresses. +* Palladium Core has no ``getindexinfo``, ``txospenderindex`` or ``submitpackage`` RPCs: the daemon version/index + checks are disabled, ``txindex=1`` is required, and ``blockchain.outpoint.subscribe`` / + ``blockchain.transaction.broadcast_package`` return a daemon error to clients. +* new: integration tests (``tests/integration``) against a Palladium node in regtest mode, run in Docker, with + a ``integration`` job in CI. * removed: all other coins, their transaction deserializers, session/daemon/block processor classes, tests, pip extras and ``contrib`` files. * new: ``Dockerfile`` and ``docker-compose.yml`` to run next to the Palladium node container, with automatic