Skip to content

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

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

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

Conversation

@cbrunnkvist

@cbrunnkvist cbrunnkvist commented Jun 20, 2026

Copy link
Copy Markdown

Summary

  • Integrate nano-rspow as default PoW backend (CPU via rayon), falling back to remote RPC
  • NANO_WORK_MODE env: auto (default), local, remote
  • NANO_WORK_URL supplies additional remote endpoints
  • Thresholds sourced from nano_rspow::thresholds (no duplication)
  • Feature-gated via local-pow (default on), opt out with --no-default-features

Files

  • ows/crates/ows-lib/Cargo.toml — add nano-rspow dep + local-pow feature
  • ows/crates/ows-lib/src/nano_rpc.rs — rewrite work_generate, remove FALLBACK_WORK_URL
  • ows/crates/ows-lib/src/ops.rs — use nano_rpc::EPOCH2_SEND/RECEIVE thresholds

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