verifyProof

Validate a database proof

Definition

The verifyProof command validates a proof by recalculating the root hash and comparing that to the hash found in the Chainpoint receipt and validating receipt on the blockchain.

The verifyProof command has the following form:

{
    "verifyProof"  : <string>
    "format" : <string>
}

The command accepts the following fields:

FieldTypeMandatoryDescription
verifyProofstringyesThe id of the proof to validate.
formatstringnoValues can be: "json" (default) - proof in JSON text format "binary" - proof in binary format

Output

The returned document contains a subset of the following fields:

FieldTypeDescription
oknumberThe status of the command.
versionnumberThe version when it was proved.
dateTimedateThe date and time the proof happened.
hashstringThe proof hash.
proofIdstringThe proof Id.
proofStatusstringThe proof status: pending, valid, invalid, submitted, failed, purged.
btcTransactionstringThe BTC transaction id.
btcBlockNumberstringThe BTC block number.
proofdocument, binaryThe proof.

Example

Below we query the _provendb_versionProofs collection to find the most recent proof, then run verifyProof to verify that proof

// Find most recent proof
mongo> db.
... ...   getCollection('_provendb_versionProofs').
... ...   find({ status: 'valid' }, { proofId: 1, version: 1 }).
... ...   sort({ version: -1 }).
... ...   limit(1).pretty();
{
	"_id" : ObjectId("5c9433eb41d82814ca398110"),
	"proofId" : "076f78a0-4c3e-11e9-a4bd-01e33ea1e3b0",
	"version" : NumberLong(10883428)
}
// Verify that proof
mongo> db.runCommand({verifyProof:'076f78a0-4c3e-11e9-a4bd-01e33ea1e3b0',
                                          format:'binary'})
{
	"ok" : 1,
	"version" : NumberLong(10883428),
	"dateTime" : ISODate("2019-03-25T22:00:28.899Z"),
	"hash" : "3c4eacc774a1d38f5f24b5d5152b108bfb5bc516824ba73cc5f19db894c60a98",
	"proofId" : "076f78a0-4c3e-11e9-a4bd-01e33ea1e3b0",
	"proofStatus" : "Valid",
	"btcTransaction" : "4582f2a2852dc615523f3960d9c007e53e64ecbc8e7a8e3f8ddef0d90d02de29",
	"btcBlockNumber" : "568217",
	"proof" : BinData(0,"eJyVl89uZUcRxuEleAKWeNzVXd1d5dVISKxYsspmVH+6GUuDPbKdEJaBDdsseADIQEKUDRJiyXsM4mH4jseZML5GClfjO/a5p+t0V33fr+r+/qvncX11tz69++fLu7vXtxfn579ul/ns+uaX5/HSLq9eX19e3Z1/0t7c/eb1+vqn7y+9eWm3L98+b8HLIuZko2yy+67sPTv16lTEt3ePTkNw2WaL6Js0XZRjFFP55gjz4jJfXF3nevvjMsee  .... ==")
}

### execution ended```