submitProof

Create a proof for a version of the database and pin it to the blockchain

Definition

The submitProof command submits a proof to the blockchain for the specified version and will return a receipt.

The submitProof command has the following form:

  {
    "submitProof" : <number>,
    "collections": <array>,
    "filter":<document>,
    "anchorType":<ETH|ETH_MAINNET|BTC|BTC_MAINNET|HEDERA|HEDERA_MAINNET|CHP>
   }

The command accepts the following arguments:

FieldTypeMandatoryDescription
submitProofnumberyesThe version number to be proved.
collectionsarraynoAn array of collection names as strings. If omitted then all collections are proven.
filterdocumentnoA MongoDB-compatible filter that selects the specific documents within a collection that will be proved
anchorTypestringnoDetermines the blockchain that will be used to anchor the proof. Default is ETH_MAINNET
nChecksnumbernoDetermines the number of times ProvenDB will recalculate the proof hash. These sanity checks protect against any inconsistencies generated by the underlying MongoDB database

Anchor Types

We currently support the following anchor types:

Anchor TypeDescription
ETHPost proof to the Ethereum Testnet
ETH_MAINNETPost proof to the Etheruem Mainnet
BTCPost proof to the Bitcoin Testnet
BTC_MAINNETPost proof to the Bitcoin Mainnet
HEDERAPost proof to the Hedera Testnet
HEDERA_MAINNETPost proof to the Hedera Mainnet
CHPPost proof to the legacy Chainpoint network (not recommended)

Output

The returned document contains a subset of the following fields:

FieldTypeDescription
oknumberstatus of the command.
versionnumberThe version the proof was submitted for.
dateTimedateThe date of the request.
hashstringThe hash value for the version.
proofIdstringThe unique proof identifier in Chainpoint format.
statusstringThe status of the request (will initially be Pending).

Example

The following command will submit a proof for all collections in version 10100:

> db.runCommand({submitProof:10100})
{
        "ok" : 1,
        "version" : NumberLong(10100),
        "dateTime" : ISODate("2019-02-22T06:41:29Z"),
        "hash" : "873954bcbb302192b77212b5e4ba492621b249a14b459a76bdfbf50cde501805",
        "proofId" : "e2626d60-366c-11e9-b4b3-017096a8589e",
        "status" : "Pending"
}

In the following example, we submit a proof for the collections accounts and auditLog only:

> db.runCommand({submitProof:5104,collections:['accounts','auditLog']})
{
	"ok" : 1,
	"version" : NumberLong(5104),
	"dateTime" : ISODate("2019-05-27T06:16:13Z"),
	"hash" : "f891a5271d51dd39b6c32038e70dc0e80d506d672f58384ada4129e4e56a6662",
	"proofId" : "ed7d2ae0-8046-11e9-a57b-01b1df67102a",
	"status" : "Pending"
}```

# Notes

See the concepts manual [Concepts](doc:concepts) for details about provenDB proofs.  In short, a provenDB proof is a hash of the logical documents which make up a database version which is anchored to the blockchain.

 

What’s Next