namecoin/namecoin-core

RPC to verify a name (non-)existence proof

Opened this issue · 3 comments

Once namecoin/meta#69 is fleshed out, and code for verifying proofs is written, it would be good to have a RPC call to generate such a proof.

I suggest a simple syntax: name_checkproof d/myname {"base_state": <HEX STRING>, "proof": <ANOTHER HEX STRING>}

This would do the following:

  1. check that base_state equals current state (else fail with an error)
  2. verify proof against the current state (else fail with another error)
  3. else return OK

It's necessary to differentiate between the two failure conditions because an invalid proof means the person who provided it to you violated the protocol, while a stale proof might be due to any number of reasons.

In the future, if the proof scheme changes (hope not), an optional parameter to specify version could be added. The options parameter could be used for this, like in other RPC calls.

We also have the failure mode of not being synced. In that case, we should always fail at step 1. However, it would be good to have an option to override this (only check internal consistency), or alternatively have a third mode of failure ("stale but internally consistent").

What usecase do you have in mind for this? If someone is running Namecoin Core, they would not need proofs at all anyway?

During IBD or in SPV mode, they would. Also, it seems reasonable to add it just for testing purposes etc. Why have the ability to generate a proof if you can't verify it?

(In practice, the two methods will share a lot of code)