Feature/add wallet rpc endpoints #747
Open
+238
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request: Add 6 new LOW RISK HTTP JSON-RPC endpoints
Summary
This PR adds 6 new LOW RISK HTTP JSON-RPC endpoints for public blockchain data access, enabling blockchain explorers, dashboards, and client applications to interact with neptune-core via HTTP.
What's Added
Working Endpoints (5/6)
node_cookieHint- Returns cookie file location for authentication setupchain_blockDigest- Get block hash by flexible selector (Tip/Genesis/Height/Digest)chain_latestTipDigests- Get N most recent block hashes from tipchain_blockDigestsByHeight- Get all blocks at specific height (handles forks)chain_confirmations- Get confirmation count since last wallet updateNeeds Debugging (1/6)
chain_blockInfo- Returns internal error (comprehensive block information)Implementation Details
Follows neptune-core style guide conventions
Security-first approach
Files Modified
neptune-core/src/application/json_rpc/core/api/ops.rs- Added 6 new RPC methodsneptune-core/src/application/json_rpc/core/model/message.rs- Added request/response typesneptune-core/src/application/json_rpc/core/api/rpc.rs- Added trait methodsneptune-core/src/application/json_rpc/server/service.rs- Implemented endpointsTesting Results
5/6 endpoints working (83% success rate)
Tested and Verified
Needs Debugging
Technical Notes
BlockHeight Serialization
BlockHeight uses numeric values, not hex strings:
BlockSelector Format
Response Format
All endpoints return proper JSON-RPC 2.0 format:
jsonrpc: "2.0"idfieldresultfielderrorfield with code and messageBenefits
For Blockchain Explorers
For Wallet Applications
For Developers
Security Considerations
All implemented endpoints are classified as LOW RISK:
Safe to expose publicly
No authentication required
Next Steps
Immediate (Ready for Production)
Future Improvements
Usage Examples
Quick Test Script
Conclusion
This PR adds valuable HTTP JSON-RPC functionality to neptune-core, enabling:
The implementation follows neptune-core conventions perfectly and is ready for production deployment of the 5 working endpoints. The one failing endpoint can be debugged separately without blocking the deployment.