-
Notifications
You must be signed in to change notification settings - Fork 13
Provenance
Provenance API give user access to key->value history, raw transaction data access and transactions existence proofs,
that provide cryptographic proof of transaction existence in ledger.
// Provenance access to historical data and data integrity proofs
type Provenance interface {
// GetProof returns two paths imn Merkle tree - one for transaction in block and one for block in ledger
GetProof(txId []byte, height uint64) (*types.Proof, error)
// GetHistory return full history for given key in db
GetHistory(dbName, key string) ([]*types.HistoricalValue, error)
// GetTransaction returns transaction envelope by its id
GetTransaction(txId []byte) (*types.TransactionEnvelope, error)
}As we can see here, the API is Blockchain DB installation level API, not single DB level API and it exposed by DBConnector
// DBConnector handle connectivity between sdk and Blockchain Database cluster
type DBConnector interface {
...
// GetProvenance returns blockchain db provenance interface
GetProvenance() Provenance
}If not mentioned otherwise, this document describes skip list based proofs for ledger consistency and integrity. For more detailed explanation, see Transaction-Proofs-Skiplist
As mentioned in Transaction document, during provenance data creation phase,
{Key, newValue, BlockTime, BlockNumber, TxTime, TxId, ClientId, IsDelete, IsOk} tuple stored as provenance data for each key in WSet.
GetHistory returns slice of history values based on data stored in provenance tuple
message HistoricalValue {
// DB key
string key = 1;
// Historical value
bytes value = 2;
// Client time for client who submitted transaction
google.protobuf.Timestamp txTime = 3;
// Sequencer time when block was created
google.protobuf.Timestamp blocktime = 4;
// Transaction that did the change
bytes txId = 5;
// Block number that holds changing tx
uint64 blocknumber = 6;
// Is this tx deleted this key
bool isDelete = 7;
}