Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpc/pool: use urkel proofs for namestate in spv mode #647

Merged
merged 3 commits into from
Aug 4, 2022

Conversation

pinheadmz
Copy link
Member

@pinheadmz pinheadmz commented Oct 18, 2021

Closes #646
Also see kyokan/bob-wallet#409

Restores SPV node RPC functionality for getnameinfo getnameresource verifymessagewithname and getnamebyhash.

Each of these rpcs now accepts an extra boolean parameter safe. When true, the node gets historical data from the "safe height" which is the last tree root commitment with more than 12 confirmations. This is obviously historical data that any full node will have locally, but is also data that can be retrieved from the p2p network by an SPV node. This is the exact same mechanism used by SPV (and hnsd) for light client name resolution.

Example:

Full Node

# get current info
hsd-rpc getnameinfo chaos

# get info committed at last tree interval
hsd-rpc getnameinfo chaos true

SPV Node

# ALWAYS NULL
hsd-rpc getnameinfo chaos

# get info committed at last tree interval (gets proof from p2p network)
hsd-rpc getnameinfo chaos true

Here's the tradeoffs for using "safe height":
👍 SPV nodes can getnameinfo and getnameresource without relying on a centralized API
👎 This data may be outdated since it can only be verified with the most recent urkel tree root commitment
👎 Getting Urkel proofs from the p2p network may be slow and the RPC may time out

@coveralls
Copy link

coveralls commented Oct 18, 2021

Coverage Status

Coverage increased (+0.1%) to 67.28% when pulling 2170fe5 on pinheadmz:spv-namestate into a747dc8 on handshake-org:master.

@nodech nodech added enhancement general - improving existing feature net/p2p part of the codebase node-rpc part of the codebase spv part of the codebase, SPV Only labels Dec 2, 2021
@pcfreak30
Copy link

This is working fine for my needs. I acknowledge the risks of cached data from this.

@pinheadmz pinheadmz marked this pull request as ready for review July 27, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement general - improving existing feature net/p2p part of the codebase node-rpc part of the codebase spv part of the codebase, SPV Only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SPV nodes could use Urkel proof requests for RPC getnameinfo and getnameresource
4 participants