GET /ledger
Retrieve the ledger as raw HyperLedger Fabric blocks in one of the three modes:
Get a block with its block number (blockNumber)
Get latest blocks after a block height (oldBlockHeight)
Get blocks between two block numbers, inclusively (start, end)
One can verify the integrity of the ledger by verifying that:
dataHash in the block header matches with the hash of the block data; and
previousHash in the block header matches with the hahs of the previous block header for every block; and
the Trustee attestations match with the ledger Check out the code samples for Auditors for more details.
Name
In
Type
Required
Description
Example 1
GET /ledger?blockNumber=3
Example 2
GET /ledger?start=1&end=2
Status
Meaning
Description
Schema
Missing or incorrect use of query parameters
API key is missing or invalid
Successfully retrieved the ledger blocks.
Schema
Name
Type
Required
Restrictions
Description
Example
400 Bad Request
Query parameter is missing or misused. Suppose the ledger current height is h, then:
blockNumber should be in [0, h-1];
oldBlockHeight should be in [0, h];
start should be in [0, h-1] and end should be in [start, h-1].
Only one of blockNumber, oldBlockHeight or start/end should be used.
Example 1
Example 2
401 Unauthorized
API key is missing or incorrect.
Example
Get Trustee attestations
GET /attestations
Retrieve all the latest Trustee attestations in the instance. An attestation is a signed digest of the ledger (with a timestamp). See the Auditor code samples for how to verify integrity of the ledger by Trustee attestations.
Note that the trustee attestations may attest to the ledger at different height, since Trustees update their attestations once in a while.
No parameter for this endpoint.
Status
Meaning
Description
Schema
Successfully retrieved the trustee attestations.
Schema
Name
Type
Required
Restrictions
Description
Example
Get ledger digest*
GET /digest
Retrieve the current digest of the ledger. A digest is a succinct representation of the ledger, which consists of the ledger ID (same as the instance ID in current implementation), the block height, the hash of the latest block and the timestamp at which the digest is created.
*For reference only. The preferred way is to compute the digest with ledger blocks. Check out the Auditor sample code for this.
No parameter for this endpoint.
Status
Meaning
Description
Schema
Schema
Name
Type
Required
Restrictions
Description
Example
ID of a block. It is an incremental index starting from 0. For example, if a ledger has height 10, then it has blocks 0, 1, ..., 9. The next block has block number 10.
Number of blocks on the ledger. For example, the digest of a ledger shows that the block height is 10, that means the ledger has 10 blocks.
It is also used to describe the status of a trustee/validator. When a trustee has finished processed a ledger of block height 10, the "block height of trustee" is 10. This indicates the trustee has processed 10 blocks from the ledger. In the mean time, the ledger itself could have a block height greater than 10.
Blocks are put sequentially as a blockchain to form a ledger. It consists of the header (which contains the chaining information) and optionally the data (from which data requests and trustee and validator responses can be extracted).
Example 1
Example 2
Name
Type
Required
Description
Example
Name
Type
Required
Description
The request is successful or not
ID of a trustee. It contains only alphanumerical characters, underscores (_) and dashes (-). It has length inclusively between 3 and 30.
Example
TrusteeAttestation
A trustee's succinct view of the ledger, along with a digital signature of it. The succinct view consists of the PAD instance ID, height and latest block hash of its ledger, and the latest timestamp when the attestation is created.
A collection of trustee attestations proves to a user that she and the trustees are seeing the same ledger.
Note that the ledger digest is represented as a string (instead of an object). This ensures that there is a unified way to verify the signature.
Example
Name
Type
Required
Restrictions
Description
A succinct representation of the ledger
A digital signature against ledgerDigest
A succinct representation of the ledger, which consists of the PAD instance name, the height and the then block hash of its ledger, and the timestamp when this digest is generated.
Example
Name
Type
Required
Restrictions
Description
Block height of the ledger
Hash of the block at height on the ledger
Time at which this digest is generated
ID of a PAD instance. Its length must be inclusively between 4 and 30. It should contains only lowercase letters, digits, periods (.) or dashes (-). It must start with a lowercase letter.
It is seldom used as a request parameter because the API key in the request already identifies a PAD instance.
Example
A Sha256 hash value as a hexidecimal string.
Example
A timestamp in ISO 8601 format.
Example
A digital signature. It consists of the metadata of the signer, including its ID, and the signature payload encoded in base64.
Schema
Name
Type
Required
Description
Metadata of a participant in PAD. It can currently be used to describe a trustee or a validator.
Example
Name
Type
Required
Description
/Trustee-[0-9a-zA-Z_]+/ or /Validator-[0-9a-zA-Z_]+/
Enumerated Values
ID of a validator. It contains only alphanumerical characters, underscores (_) and dashes (-). It has length inclusively between 3 and 30.
A base64-encoded binary data.
Example