flux-node-signer
Signs for fluxnodes from a workstation. It holds a delegate key an owner has named for their nodes, reads the chain, and builds, signs and sends fluxnode transactions. It reaches no node: what it needs from a node is handed to it.
What it does
An owner names a key for a node (an outpoint) as a delegate, with one of two permissions:
| Permission | May |
|---|---|
| start | start the node when it has left the list |
| bind | that, and set the node's keys |
Setting a node's keys starts nothing. A node whose keys are bound and which is not on
the list is started by its own machine when that is ready. A node that has been on the
list and left it is started by its owner or a delegate: start below.
| Command | What it does |
|---|---|
generate-delegate-key |
makes a key and writes it encrypted (age, by passphrase) |
delegate-link |
makes the link a provider gives an owner, whose wallet gives the key the bind permission from it |
view |
reports where each outpoint stands for a delegate key: not named, unbound, pending or bound, and what the key may do there |
bind |
binds nodes' keys from their links, with a version 7 keys transaction a bind delegate's key signs |
start |
starts nodes that are off the list, with a start any delegate's key signs: version 7 for a node with keys set, and version 6 for one with none until the identity enforcement height |
derive-pubkey, check-delegates, find-start-tx, test-connection |
helpers |
delegate-link, view, bind and start print one JSON document on standard
output and their errors on standard error, so a program can call them. The same
operations are a library: flux_node_signer.signer (delegate_link, view, bind,
start) over the formats in flux_node_signer.identity.
A provider's work, end to end
The chain is reached through the public Flux API, or with --transport rpc through a
fluxd's JSON-RPC: FLUX_RPC_HOST, FLUX_RPC_PORT, FLUX_RPC_USERNAME,
FLUX_RPC_PASSWORD, or the --rpc-* options.
-
Make the delegate key, once:
flux-node-signer generate-delegate-key --name delegate
-
Give each owner a delegate link for their nodes. The owner's wallet reads it, shows the key's fingerprint, and gives the key the bind permission for those outpoints. The owner compares the fingerprint with the one you show them.
flux-node-signer delegate-link --key-file delegate.key.age <txid>:<n> [<txid>:<n> ...]
{ "line": "FLUXBND1 <delegatekey> <proof> <txid>:<n>", "delegatekey": "<66 hex>", "fingerprint": "9c34 af45 edef 87cd e432 209c 54cd 5d05", "proof": "<128 hex>", "outpoints": ["<txid>:<n>"] }
-
See which outpoints name the key, and the state of each node's keys:
flux-node-signer view --delegate-key <66 hex> <txid>:<n> [<txid>:<n> ...]
Each entry's
standingisnot-named,unbound,pending(a keys transaction has set keys the node's machine has not confirmed with yet) orbound, and itspermissionisstart,bindor null. -
Bind each node's keys. A node's link is the line fluxd gives in
getfluxnodestatus(identity_link_text, or by field inidentity_link). The input is a JSON list:[ {"link": "FLUXID1 <txid>:<n> <identitykey> <proof> <drawkey> <nodekey> [<vouch>]", "collateral_pubkey": "<66 hex>"}, {"link": {"outpoint": "<txid>:<n>", "identitykey": "...", "proof": "...", "drawkey": "...", "nodekey": "..."}, "redeem_script": "<hex>"} ]
flux-node-signer bind nodes.json --key-file delegate.key.age [--dry-run]
For each entry the tool checks the link's proof, reads the outpoint's state, and states the basis the chain will hold it to:
new(the outpoint is off the list and has never had keys),vouched(the link is vouched by the key the chain shows for the node) orreplaces(another machine takes the node over). It signs nothing for a link whose proof fails, for an outpoint the key has no bind permission for, or for keys the chain already has. Areplacesbinding is refused unless--allow-replaceis given. Each result carries theoutcome, thebasis, the keys transaction'stxidand its hex. The command exits 2 when any entry was refused.Nothing more is sent for a new node: its machine starts it and confirms with the keys. The chain takes a signed transaction for 100 blocks from the height it was signed at, so one that is not mined in that time is built again.
-
Start a node that has left the list, by any delegate's key:
[{"outpoint": "<txid>:<n>", "node_key": "<hex>", "collateral_pubkey": "<66 hex>"}]
flux-node-signer start nodes.json --key-file delegate.key.age [--dry-run]
The start carries no keys.
node_keyis the node key the node's keys were set with (thenodekeyof the link they were bound from); for keys in force the tool checks it against the proof on record. A node with no keys set is started by a version 6 start until the identity enforcement height, and from it not at all: bind its keys first.
A multisig collateral is named by its redeem_script in place of collateral_pubkey.
Installation
Prerequisites
- Python 3.13+
- uv package manager
- Access to a Flux RPC node
Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
Install flux-node-signer
# From PyPI
pip install flux-node-signer
Or install from source:
# Clone the repository
git clone https://github.com/RunOnFlux/flux-node-signer.git
cd flux-node-signer
# Install with uv
uv sync
# Or install in development mode
uv sync --dev
Verify Installation
# Activate the virtual environment
source .venv/bin/activate
# Test the CLI
flux-node-signer --help
Quick Start
flux-node-signer test-connection --rpc-user <username> --rpc-password <password>
flux-node-signer start nodes.json --key-file delegate.key.age --dry-run
flux-node-signer start nodes.json --key-file delegate.key.age
nodes.json is the list of step 5 above. --dry-run builds and signs and sends
nothing: each result carries the transaction's hex and id.
CLI Commands
start
flux-node-signer start [OPTIONS] INPUT_FILE
Starts each node of a JSON list that is off the list, signed by a delegate's key.
Each entry has outpoint (<txid>:<n>), node_key (hex), and collateral_pubkey
or, for a multisig collateral, redeem_script.
The tool reads each outpoint from the chain and builds the start the chain takes for it:
| The chain shows for the outpoint | The start |
|---|---|
| keys in force or pending | version 7, with no keys in it |
| no keys, below the identity enforcement height | version 6 |
| no keys, from the enforcement height | none: bind the node's keys first |
| the node is on the list | none: nothing to do |
Options: --key-file/-k (required), --passphrase/-p, --dry-run, and the
--rpc-* options. Each result carries the outcome, the transaction's version,
txid and hex. The command exits 2 when any entry was refused.
The chain is reached through the public Flux API by default (--transport api,
--api-url), or through a fluxd's JSON-RPC (--transport rpc and the --rpc-*
options). view, bind and delegate-link take the same options.
A node's keys and delegates are read with getidentitykey and
listfluxnodedelegates. Where the chain reached offers neither (a fluxd from before
node identity, or an API that does not pass them through), start takes the node to
have no keys set and builds the version 6 start without checking the delegate, and the
chain judges it; bind and view say that they need a chain that answers.
derive-pubkey
Derive public key from a WIF private key.
flux-node-signer derive-pubkey WIF_PRIVATE_KEY
This utility helps you convert your private keys to public keys. Very useful when you have:
- Collateral private key → need collateral public key
- Fluxnode private key → need fluxnode public key
Example:
$ flux-node-signer derive-pubkey KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
✓ Derived public key:
0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798
test-connection
Test RPC connection to Flux daemon.
flux-node-signer test-connection [OPTIONS]
Getting Your Keys
This section explains how to get all the required parameters for the start command.
1. Collateral Transaction Hash & Index
From your wallet that sent the collateral:
# Find your collateral transaction
flux-cli listtransactions
# Get details
flux-cli gettransaction <txid>
Or from Zelcore: Check your transaction history for the 1000/12500/40000 FLUX send.
- collateral_txhash: The transaction ID (64 hex characters)
- collateral_index: Usually
0or1(which output in the transaction)
2. Collateral Public Key
You need the public key for the address that holds the collateral.
Option A: From Zelcore Zelcore doesn't easily show public keys, so you'll need the private key:
- Export the private key from Zelcore for your collateral address
- Use our utility:
flux-node-signer derive-pubkey <your_collateral_private_key_WIF>
Option B: From flux-cli If you have the collateral address in flux-cli wallet:
# Get the address that holds collateral
flux-cli getaddressesbyaccount ""
# Get the private key (KEEP THIS SECURE!)
flux-cli dumpprivkey <your_collateral_address>
# Derive public key
flux-node-signer derive-pubkey <WIF_from_above>
3. Delegate Private Key
This is a new key you generate just for signing START transactions. You can:
Option A: Generate with flux-cli
# Generate a new key pair
flux-cli getnewaddress
# Export the private key
flux-cli dumpprivkey <new_address>
Option B: Use your collateral private key (simpler but less secure) You can use the same WIF as your collateral private key. This is fine for testing.
The delegate_key parameter expects WIF format directly (e.g., KwDi...)
4. Fluxnode Public Key
Each fluxnode needs its own identity key.
Option A: From your fluxnode If you're running a fluxnode:
# On the fluxnode server
flux-cli getfluxnodestatus | grep pubkey
Option B: Generate new keys
# Generate a new address
flux-cli getnewaddress
# Dump the private key
flux-cli dumpprivkey <address>
# Derive the public key
flux-node-signer derive-pubkey <WIF_private_key>
For multi-node benchmarks, generate one key pair per node.
Summary: What You Actually Need
# 1. Find your collateral transaction
collateral_txhash="abc123..." # From wallet/blockchain
# 2. Get your RPC credentials
rpc_user=$(grep rpcuser ~/.flux/flux.conf | cut -d= -f2)
rpc_password=$(grep rpcpassword ~/.flux/flux.conf | cut -d= -f2)
# 3. Delegate key (can be same as collateral for simplicity)
delegate_key="L..." # Export from Zelcore or flux-cli
# 4. Fluxnode privkey (generate new for each node)
fluxnode_privkey="K..." # Generate with flux-cli getnewaddress
# 5. Build the start (the node key is the fluxnode key's public half)
node_key=$(flux-node-signer derive-pubkey $fluxnode_privkey)
echo "[{\"outpoint\": \"$collateral_txhash:0\", \"node_key\": \"$node_key\", \"collateral_pubkey\": \"<66 hex>\"}]" > nodes.json
flux-node-signer start nodes.json \
--key-file delegate.key.age \
--rpc-user $rpc_user \
--rpc-password $rpc_password \
--dry-run
Configuration
Environment Variables
Create a .env file:
FLUX_RPC_HOST=127.0.0.1
FLUX_RPC_PORT=16124
FLUX_RPC_TIMEOUT=30
FLUX_OUTPUT_FORMAT=rich
See examples/.env.example for all options.
RPC Authentication
The tool requires username/password authentication for all RPC connections.
Get credentials from your flux.conf:
grep rpcuser ~/.flux/flux.conf
grep rpcpassword ~/.flux/flux.conf
Pass via CLI:
flux-node-signer start nodes.json --key-file delegate.key.age --rpc-user <user> --rpc-password <pass>
Or use environment variables:
export FLUX_RPC_USERNAME=myuser
export FLUX_RPC_PASSWORD=mypassword
flux-node-signer start nodes.json --key-file delegate.key.age # reads FLUX_RPC_USERNAME and FLUX_RPC_PASSWORD
Transaction Format (version 6)
The version 7 keys, start and delegate transactions, a node's link and the delegate link are
built in flux_node_signer.identity.
Structure
Header (4 bytes) # nVersion | (fOverwintered << 31)
├─ nType: int8_t (0x02) # FLUXNODE_START_TX_TYPE
├─ nFluxTxVersion: int32_t # 0x0101 (NORMAL | DELEGATES)
├─ collateralIn: COutPoint # 36 bytes (hash + index)
│ ├─ hash: uint256 # 32 bytes, little-endian
│ └─ n: uint32_t # 4 bytes, little-endian
├─ collateralPubkey: CPubKey # Compact size + 33 bytes
├─ pubKey: CPubKey # Fluxnode key, compact size + 33 bytes
├─ sigTime: uint32_t # 4 bytes, little-endian
├─ fUsingDelegates: bool # 1 byte (0x01)
├─ delegateData: # CFluxnodeDelegates
│ ├─ nDelegateVersion: int8_t (0x01)
│ ├─ nType: int8_t (0x02) # SIGNING type
│ └─ (no keys for SIGNING)
└─ sig: vector<unsigned char> # Compact size + 65 bytes
Byte Order
- All integers: Little-endian
- Transaction hash: Reversed (little-endian)
- Public keys: No reversal
Signing Process
- Serialize transaction without signature
- Compute transaction hash (double SHA256)
- Build message:
"Zelcash Signed Message:\n" + tx_hash_hex - Hash message with SHA256
- Sign with secp256k1 recoverable signature (65 bytes)
Development
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov
# Run specific test file
uv run pytest tests/test_transaction.py
# Run specific test
uv run pytest tests/test_crypto.py::TestWIFDecoding::test_decode_mainnet_compressed
Linting and Formatting
# Format code
uv run ruff format
# Lint code
uv run ruff check
# Type checking
uv run ty check
uv run pyright
Project Structure
flux-node-signer/
├── src/
│ └── flux_node_signer/
│ ├── __init__.py # Package exports
│ ├── __main__.py # CLI: the version 6 commands and the helpers
│ ├── delegate_cli.py # CLI: delegate-link, view, bind, start
│ ├── signer.py # A delegate's work: view, bind, start, delegate link
│ ├── identity.py # Version 7 formats: links, delegates, transactions
│ ├── chain.py # What is read from the chain, and sending to it
│ ├── transaction.py # Version 6 start transaction
│ ├── crypto.py # Signatures, hashes, key encoding
│ ├── key_manager.py # Encrypted key files
│ ├── rpc_client.py # fluxd JSON-RPC client
│ ├── api_client.py # Flux API client
│ ├── models.py # Pydantic models
│ ├── config.py # Configuration
│ └── exceptions.py # Custom exceptions
├── tests/
│ ├── test_identity.py # Version 7 formats against the specification's vectors
│ ├── test_signer.py # Bindings and starts against a table of chain states
│ ├── test_delegate_cli.py # The JSON commands
│ ├── test_transaction.py # Version 6 transaction tests
│ ├── test_crypto.py # Crypto tests
│ └── test_rpc_client.py # RPC tests
├── examples/
│ ├── .env.example # Environment config
│ ├── config.example.toml # TOML config
├── pyproject.toml # Project config
└── README.md # This file
Library Usage
Binding nodes' keys as a bind delegate:
import asyncio
from pathlib import Path
from flux_node_signer.chain import RpcChain
from flux_node_signer.crypto import decode_wif
from flux_node_signer.identity import NodeLink
from flux_node_signer.key_manager import DelegateKeyManager
from flux_node_signer.rpc_client import FluxRPCClient
from flux_node_signer.signer import Collateral, bind
async def main():
delegate_key, _ = decode_wif(DelegateKeyManager.load_key(Path("delegate.key.age")))
chain = RpcChain(
FluxRPCClient(host="127.0.0.1", port=16124, username="user", password="pass")
)
# The line fluxd gives in getfluxnodestatus as identity_link_text
link = NodeLink.parse(
"FLUXID1 <txid>:<n> <identitykey> <proof> <drawkey> <nodekey>"
)
collateral = Collateral(pubkey=bytes.fromhex("<the collateral's public key>"))
done = await bind(chain, delegate_key, link, collateral, send=False)
print(done.json()) # outcome, basis, txid and the signed transaction
asyncio.run(main())
view, start and delegate_link are in the same module and return the documents
the commands print.
A version 6 delegated start:
import asyncio
from flux_node_signer import (
FluxnodeStartTransaction,
FluxRPCClient,
FluxAPIClient,
decode_wif,
)
async def main():
# Decode delegate key
delegate_privkey, _ = decode_wif(
"KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn"
)
# Build transaction
tx = FluxnodeStartTransaction(
collateral_txhash="1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d0",
collateral_index=0,
fluxnode_pubkey=bytes.fromhex(
"0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
),
)
# Sign transaction
tx.sign(delegate_privkey)
# Option 1: Send via public API (default, no credentials needed)
api_client = FluxAPIClient()
txid = await api_client.send_raw_transaction(tx.to_hex())
print(f"Transaction sent via API: {txid}")
# Option 2: Send via direct RPC (requires credentials)
rpc_client = FluxRPCClient(
host="127.0.0.1", port=16124, username="myuser", password="mypassword"
)
txid = await rpc_client.send_raw_transaction(tx.to_hex())
print(f"Transaction sent via RPC: {txid}")
if __name__ == "__main__":
asyncio.run(main())
Troubleshooting
"RPC authentication required"
You must provide RPC credentials. Get them from your flux.conf:
grep rpcuser ~/.flux/flux.conf
grep rpcpassword ~/.flux/flux.conf
Then use:
flux-node-signer start nodes.json --key-file delegate.key.age --rpc-user <user> --rpc-password <pass>
"TX decode failed"
This usually means:
- Incorrect byte order (transaction hash must be reversed)
- Invalid public key format (must be compressed, 33 bytes)
- Incorrect serialization
Use --dry-run to see the transaction without sending it, and fluxd's
decoderawtransaction to read it:
flux-node-signer start nodes.json --key-file delegate.key.age --dry-run
"bad-txns-in-belowout"
The collateral transaction output doesn't exist or is already spent.
Verify with:
flux-cli getrawtransaction <txhash> 1
"Invalid signature"
Check:
- Delegate key is correct WIF format
- Public keys match the delegate key
- Transaction is signed before sending
Security Considerations
Private Key Handling
- Never commit private keys to version control
- Use
.envfiles (add to.gitignore) - Consider using encrypted storage
- Rotate keys periodically
RPC Security
- Use RPC over localhost when possible
- Enable RPC authentication
- Use TLS for remote connections
- Firewall RPC port
Transaction Validation
- Always verify transaction details before signing
- Use
--dry-runand--decodefor testing - Double-check collateral amounts
- Verify fluxnode public keys
Examples
See the examples/ directory for:
.env.example- Environment configurationconfig.example.toml- TOML configuration
License
MIT License - see LICENSE file for details
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Ensure all tests pass
- Submit a pull request
Support
- GitHub Issues: https://github.com/RunOnFlux/flux-node-signer/issues
- PyPI: https://pypi.org/project/flux-node-signer/
Acknowledgments
- Built for the Flux ecosystem
- Uses secp256k1 cryptography via coincurve
- Transaction format follows Bitcoin-style serialization
- Inspired by fluxd's activefluxnode implementation
Metadata
Release files for flux-node-signer 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flux_node_signer-0.4.1.tar.gz | 48.9 kB | Without provenance | Details for flux_node_signer-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flux_node_signer-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for flux_node_signer-0.4.1-py3-none-any.whl |
Total release size: 96.7 kB
Release files / flux_node_signer-0.4.1.tar.gz
| Download URL | flux_node_signer-0.4.1.tar.gz |
|---|---|
| Size | 48.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8b504740dc9b098d5a423c90d87f7e4538ac0a76546b6a0000a9ba8b893c1ba
|
|
BLAKE2b-256 checksum How to use checksums |
7b58f9c1c593d4298e1acf818645122aa8db0d5876ccf5dd160343f9defbacc6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / flux_node_signer-0.4.1-py3-none-any.whl
| Download URL | flux_node_signer-0.4.1-py3-none-any.whl |
|---|---|
| Size | 47.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba2fe37ba606b5891bd1f9e6ec85cffcb80e20ace45a372d9cdd00f5bc4719f0
|
|
BLAKE2b-256 checksum How to use checksums |
5114fd63b96d51d254fd7bbdc94100304aa0b1c91ea871874a0a35200e25fa00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.3 {"installer":{"name":"uv","version":"0.13.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for flux-node-signer 0.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.