Skip to content

feat: local PoW via nano-rspow with remote fallback#2

Draft
cbrunnkvist wants to merge 5 commits into
mainfrom
feat/nano-local-pow-default
Draft

feat: local PoW via nano-rspow with remote fallback#2
cbrunnkvist wants to merge 5 commits into
mainfrom
feat/nano-local-pow-default

Conversation

@cbrunnkvist

@cbrunnkvist cbrunnkvist commented Jun 20, 2026

Copy link
Copy Markdown

Adds local Nano PoW support through nano-rspow, with remote RPC fallback when local work is not recommended or local generation fails.

NANO_WORK_MODE options:

  • auto: default; use local PoW only when nano-rspow recommends it.
  • local: force local PoW and fail if local generation cannot produce work.
  • remote: force remote RPC PoW and skip local generation.
  • retune: clear the nano-rspow tuning and recommendation cache, then behave like auto.

NANO_WORK_URL continues to support additional remote work endpoints separated by commas or semicolons. The public hex-difficulty work_generate API remains compatible, while internal OWS code can continue using the threshold-based helper and nano-rspow threshold constants.

Integrate nano-rspow as the default PoW backend for Nano blocks,
replacing the previous 100% remote RPC approach.

- Add nano-rspow (CPU via rayon) behind 'local-pow' feature (default on)
- PoW mode defaults to 'auto': local first, remote RPC fallback
- NANO_POW_MODE env var: 'auto' (default), 'local', 'remote'
- NANO_WORK_URL continues to provide additional remote endpoints
- Remove hardcoded FALLBACK_WORK_URL (rpc.nano.to)
- Downstream can opt out with --no-default-features
- Remove hardcoded SEND_DIFFICULTY/RECEIVE_DIFFICULTY hex constants
- Re-export EPOCH2_SEND/EPOCH2_RECEIVE from nano_rspow::thresholds
  (with fallback consts when local-pow feature is disabled)
- work_generate now accepts u64 threshold, converts to hex for RPC
- Rename NANO_POW_MODE to NANO_WORK_MODE to align with NANO_WORK_URL
@cbrunnkvist cbrunnkvist changed the base branch from main to feat/nano-chain-docs June 20, 2026 09:57
@cbrunnkvist cbrunnkvist changed the base branch from feat/nano-chain-docs to main June 20, 2026 09:57
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