Anchor Service
Anchor Service continuously anchors hashes to blockchains, which is similar to what Chainpoint does, but with much better performance and flexibility. It supports multiple anchor types and proof formats. Digital signing can be also done at the Merkle root level
Protobuf definition: anchor/anchor.proto
Table of Contents
- AnchorService
- Anchor
- AnchorRequest
- Batch
- BatchRequest
- Proof
- ProofRequest
- SubmitProofRequest
- SubscribeBatchesRequest
- VerifyProofReply
- VerifyProofRequest
- Anchor.Status
- Anchor.Type
- Batch.Status
- Proof.Format
- Scalar Value Types
AnchorService
Method Name | Request Type | Response Type | Description |
---|---|---|---|
GetAnchors | google.protobuf.Empty | Anchor stream | GetAnchors gets all anchors |
GetAnchor | AnchorRequest | Anchor | GetAnchor gets an anchor |
GetProof | ProofRequest | Proof | GetProof gets a proof |
SubmitProof | SubmitProofRequest | Proof | SubmitProof submits a proof for the given hash |
VerifyProof | VerifyProofRequest | VerifyProofReply | VerifyProof verifies the given proof. When the proof is unverifiable, an exception is thrown |
GetBatch | BatchRequest | Batch | GetBatch gets a batch |
SubscribeBatches | SubscribeBatchesRequest | Batch stream | SubscribeBatches subscribes to batch status updates |
Anchor
Anchor represents an anchor of a blockchain, through which a hash can be anchored to that blockchain
Field | Type | Label | Description |
---|---|---|---|
type | Anchor.Type | Type is the anchor type | |
status | Anchor.Status | Status is the anchor status | |
error | string | Error is the error message when the anchor status is ERROR | |
supported_formats | Proof.Format | repeated | SupportedFormats are the supported proof formats of the anchor |
AnchorRequest
AnchorRequest represents a request to get information for the given anchor type
Field | Type | Label | Description |
---|---|---|---|
type | Anchor.Type | Type is the anchor type |
Batch
Batch represents a batch of hashes. When hash stream comes in, Anchor Service will try to process them in batches, just like blockchain processes transactions in blocks. This makes utilization of expensive resources, such as making Bitcoin transaction, more economic. Each batch's root hash will be embedded in a transaction made to the blockchain
Field | Type | Label | Description |
---|---|---|---|
id | string | Id is the batch ID | |
anchor_type | Anchor.Type | AnchorType is the batch's anchor type | |
proof_format | Proof.Format | ProofFormat is the batch's proof format, which determines how the merkle tree is constructed for the batch. | |
status | Batch.Status | Status is the batch status. FLOW: created_at -> BATCHING -> flushed_at -> QUEUING -> started_at -> PROCESSING -> submitted_at -> PENDING -> finalized_at -> CONFIRMED / ERROR; * -> ERROR; if a batch has not yet reached PENDING and its anchor has restarted, the batch will be put back to QUEUING | |
error | string | Error is the error message when status is ERROR | |
size | int64 | Size is the number of hashes contained in the batch | |
created_at | google.protobuf.Timestamp | CreateAt is the batch's created at timestamp. FLOW: created_at -> BATCHING | |
flushed_at | google.protobuf.Timestamp | FlushedAt is the batch's flushed at timestamp. FLOW: BATCHING -> flushed_at -> QUEUING | |
started_at | google.protobuf.Timestamp | StartedAt is the batch's started at timestamp. FLOW: QUEUING -> started_at -> PROCESSING | |
submitted_at | google.protobuf.Timestamp | SubmittedAt is the batch's submitted at timestamp. FLOW: PROCESSING -> submitted_at -> PENDING | |
finalized_at | google.protobuf.Timestamp | FinalizedAt is the batch's finalized at timestamp. FLOW: * -> finalized_at -> CONFIRMED / ERROR. NOTE: this is not the real block confirmed time, use the timestamp in the batch data instead | |
hash | string | Hash is the batch's root hash | |
data | string | Data is the batch data in JSON |
BatchRequest
BatchRequest represents a batch request
Field | Type | Label | Description |
---|---|---|---|
batch_id | string | BatchId is the batch ID | |
anchor_type | Anchor.Type | AnchorType is the batch's anchor type |
Proof
Proof represents a blockchain proof of a hash, which is a Merkle path from the hash to the root hash of the proof's batch
Field | Type | Label | Description |
---|---|---|---|
hash | string | Hash is the hash the proof is proving for | |
batch_id | string | BatchId is the proof's batch ID | |
anchor_type | Anchor.Type | AnchorType is the proof's anchor type | |
batch_status | Batch.Status | BatchStatus is the proof's batch status | |
format | Proof.Format | Format is the proof format | |
data | string | Data is the proof data in base64 | |
batch | Batch | Batch is the proof's batch detail |
ProofRequest
ProofRequest represents a proof request
Field | Type | Label | Description |
---|---|---|---|
hash | string | Hash is the hash the proof is proving for | |
batch_id | string | BatchId is the proof's batch ID | |
anchor_type | Anchor.Type | AnchorType is the proof's anchor type | |
with_batch | bool | WithBatch indicates whether to include the proof's batch detail |
SubmitProofRequest
SubmitProofRequest represents a submit proof request
Field | Type | Label | Description |
---|---|---|---|
hash | string | Hash is the hash to be submitted | |
anchor_type | Anchor.Type | AnchorType is the anchor type to be used | |
format | Proof.Format | Format is the proof format to be used | |
skip_batching | bool | SkipBatching indicates whether to skip batching and submit a proof for the hash directly | |
with_batch | bool | WithBatch indicates whether to include the batch detail in the reply |
SubscribeBatchesRequest
SubscribeBatchesRequest represents a subscription request for batch information
Field | Type | Label | Description |
---|---|---|---|
filter | BatchRequest | Filter is the batch filter. When nil, all batches of all anchors will be subscribed; otherwise, only the batches of the given anchor will be subscribed; if batch_id is non-empty, only the matched batch will be subscribed |
VerifyProofReply
VerifyProofReply represents a verify proof reply
Field | Type | Label | Description |
---|---|---|---|
verified | bool | Verified indicates whether the proof is verified | |
error | string | Erorr is the error message when the proof is falsified | |
provenHash | string | ProvenHash is the hash the proof is proving for |
VerifyProofRequest
VerifyProofRequest represents a verify proof request
Field | Type | Label | Description |
---|---|---|---|
anchor_type | Anchor.Type | AnchorType is the proof's anchor type | |
format | Proof.Format | Format is the proof format. If skipping the signature checking is desired, please use the corresponding non-signed format, eg. use CHP_PATH instead of CHP_PATH_SIGNED in request | |
data | string | Data is the proof data in base64 |
Anchor.Status
Status represents an anchor's status
Name | Number | Description |
---|---|---|
ERROR | 0 | Error means the anchor has an error |
STOPPED | 1 | STOPPED means the anchor is stopped |
RUNNING | 2 | RUNNING means the anchor is running |
Anchor.Type
Type represents an anchor type. Please refer to this list for all available anchor types
Name | Number | Description |
---|---|---|
ETH | 0 | Ethereum Rinkeby Testnet |
ETH_MAINNET | 3 | Ethereum Mainnet. Ethereum is the second-largest cryptocurrency |
ETH_ELASTOS | 4 | Elastos, which employs a "main chain-sidechain architecture" |
ETH_GOCHAIN | 9 | GoChain, which is scalable, low cost and energy efficient |
BTC | 1 | Bitcoin Testnet |
BTC_MAINNET | 5 | Bitcoin Mainnet. Bitcoin is the largest cryptocurrency |
CHP | 2 | Chainpoint |
HEDERA | 6 | Hedera Testnet |
HEDERA_MAINNET | 7 | Hedera Mainnet. Hedera is a DAG based blockchain that provides much better TPS than tranditional blockchains |
HYPERLEDGER | 8 | Hyperledger Fabric, which is a modular blockchain framework for private enterprises |
Batch.Status
Status represents a batch's status
Name | Number | Description |
---|---|---|
ERROR | 0 | ERROR means the batch has an error. FLOW: * -> ERROR |
BATCHING | 1 | BATCHING means the batch is batching for more hashes. FLOW: created_at -> BATCHING -> flushed_at |
QUEUING | 2 | QUEUING means the batch is queuing to be processed. FLOW: flushed_at -> QUEUING -> started_at |
PROCESSING | 3 | PROCESSING means the batch is constructing merkle roots and submitting hashes. FLOW: started_at -> PROCESSING -> submitted_at |
PENDING | 4 | PENDING means the batch's root hash is pending to be confirmed. FLOW: submitted_at -> PENDING -> finalized_at |
CONFIRMED | 5 | CONFIRMED means the batch's root hash is confirmed by the anchor's blockchain. FLOW: finalized_at -> CONFIRMED |
Proof.Format
Format represents a proof format
Name | Number | Description |
---|---|---|
CHP_PATH | 0 | CHP_PATH means Chainpoint Path format, which is the format used by Chainpoint |
ETH_TRIE | 1 | ETH_TRIE means Ethereum Trie format |
CHP_PATH_SIGNED | 2 | CHP_PATH_SIGNED means signed Chainpoint Path format |
ETH_TRIE_SIGNED | 3 | ETH_TRIE_SIGNED means signed Ethereum Trie format |