pyrxd.devnet — Local regtest dev node

One-command local Radiant regtest node for development.

Wraps a radiant-core regtest node running in docker so a developer can stand up an isolated chain, mine blocks, and fund an address without learning the node’s RPC surface. This is the dev-facing promotion of the in-test _RegtestNode helper (tests/test_htlc_regtest_e2e.py).

Everything here targets regtest only — an ephemeral, throwaway chain bound to the local docker host. The RPC credentials are deliberately fixed (it is a localhost-only regtest sandbox reached via docker exec, never exposed), so separate CLI invocations (up, mine, fund, down) reconnect to the same node with no state file to keep in sync.

Prerequisites: docker on PATH and the radiant-core regtest image present locally (see RegtestNode.IMAGE).

exception pyrxd.devnet.DevnetError[source]

Bases: RuntimeError

A devnet operation failed (docker missing, node not up, RPC error).

class pyrxd.devnet.DevKey[source]

Bases: object

A freshly generated, pre-funded regtest key handed to the developer.

address: str
wif: str
funded_rxd: float
__init__(address, wif, funded_rxd)
Parameters:
Return type:

None

class pyrxd.devnet.RegtestNode[source]

Bases: object

A self-managed, isolated radiant-core regtest node (docker).

The node is identified by a fixed container name so that up / mine / fund / down invoked as separate processes all operate on the same chain. up is the only call that creates the container; the others attach to the running one and raise DevnetError if it is absent.

IMAGE = 'radiant-core:v3.1.1-amd64'
CONTAINER = 'pyrxd-devnet'
RPC_USER = 'pyrxd'
RPC_PASSWORD = 'pyrxd'
WALLET = 'devnet'
classmethod build_image(version='v3.1.1', *, no_cache=False)[source]

Build the regtest image from an OFFICIAL Radiant-Core release binary.

Wraps the published radiant-<version>-linux-x64 daemon (SHA-256-verified against the release checksum file) in a small ubuntu:22.04 image tagged radiant-core:<version>-amd64. Builds from the Dockerfile embedded in this module, so it works for a pip install pyrxd developer with no repo checkout as well as from a clone. Returns the built image tag.

This is the dev-facing replacement for the previously ad-hoc image that was built outside the repo; pyrxd regtest setup calls it.

Parameters:
Return type:

str

cli(*args, wallet=False)[source]

Run radiant-cli inside the container; parse JSON when possible.

Parameters:
Return type:

object

is_running()[source]

True if the devnet container exists and is running.

Return type:

bool

start(*, fresh=False, initial_blocks=101)[source]

Start the regtest node, create the dev wallet, and mature a coinbase.

Idempotent unless fresh is set: if the container is already running it is left untouched (the chain state is preserved). fresh=True tears the existing container down first for a clean chain.

Parameters:
  • fresh (bool)

  • initial_blocks (int)

Return type:

None

stop()[source]

Remove the devnet container (no-op if absent). Wipes the chain.

Return type:

None

new_address()[source]

A fresh address from the dev wallet.

Return type:

str

mine(n=1, address=None)[source]

Mine n blocks to address (a fresh wallet address by default).

Returns the new chain height.

Parameters:
  • n (int)

  • address (str | None)

Return type:

int

fund(address, amount_rxd, *, confirm=True)[source]

Faucet: send amount_rxd RXD to address from the dev wallet.

Mines one block to confirm the payment unless confirm is False. Returns the funding txid.

Parameters:
Return type:

str

new_funded_key(amount_rxd=100.0)[source]

Generate a wallet key, fund it, and return its address + WIF.

The WIF is directly importable into pyrxd (PrivateKey(wif)), giving a developer a spendable, pre-funded regtest identity in one step.

Parameters:

amount_rxd (float)

Return type:

DevKey

info()[source]

Connection + chain summary for display.

Return type:

dict