Auditor
Get ledger
GET /ledger
Description
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; andpreviousHash
in the block header matches with the hahs of the previous block header for every block; andthe Trustee attestations match with the ledger Check out the code samples for Auditors for more details.
Parameters
blockNumber
query
false
none
oldblockHeight
query
false
none
start
query
false
none
end
query
false
none
Example 1
GET /ledger?blockNumber=3
Example 2
GET /ledger?start=1&end=2
Responses
200
Succeeded
Inline
400
Bad Request
Missing or incorrect use of query parameters
401
API key is missing or invalid
200 OK
Successfully retrieved the ledger blocks.
Schema
ok
boolean
true
none
none
blocks
true
none
none
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]
andend
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
Description
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.
Parameters
No parameter for this endpoint.
Responses
200
Succeeded
Inline
200 OK
Successfully retrieved the trustee attestations.
Schema
ok
boolean
true
none
none
attestations
true
none
none
Example
Get ledger digest*
GET /digest
Description
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.
Parameters
No parameter for this endpoint.
Responses
200
Succeeded
Inline
200 OK
Schema
ok
boolean
true
none
none
digest
true
none
none
Example
Schemas
BlockNumber
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.
Schema
integer
Non-negative
BlockHeight
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.
Schema
integer
Non-negative
Block
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
Schema
header
true
none
data
false
none
ApiResponse
Example
Schema
ok
boolean
true
The request is successful or not
message
string
true
none
TrusteeId
ID of a trustee. It contains only alphanumerical characters, underscores (_) and dashes (-). It has length inclusively between 3 and 30.
Example
Schema
string
[a-zA-Z0-9-_]{3,30}
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
Schema
ledgerDigest
true
none
A succinct representation of the ledger
signature
true
none
A digital signature against ledgerDigest
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
Schema
ledgerId
true
none
The PAD instance's name
height
true
none
Block height of the ledger
currentHash
true
none
Hash of the block at height
on the ledger
timestamp
true
none
Time at which this digest is generated
PadName
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
Schema
string
/[a-z][a-z0-9.-]{3,29}/
Sha256
A Sha256 hash value as a hexidecimal string.
Example
Schema
string
/[0-9a-fA-F]{64}/
DateTime
A timestamp in ISO 8601 format.
Example
Schema
string
-
Signature
A digital signature. It consists of the metadata of the signer, including its ID, and the signature payload encoded in base64.
Schema
Schema
signerMetadata
false
none
payload
false
none
Participant
Metadata of a participant in PAD. It can currently be used to describe a trustee or a validator.
Example
Schema
id
true
/[0-9a-zA-Z-_]{3,30}/
fullName
string
true
/Trustee-[0-9a-zA-Z_]+/
or /Validator-[0-9a-zA-Z_]+/
role
enum
true
none
Enumerated Values
role
Trustee
role
Validator
role
Server
ValidatorId
ID of a validator. It contains only alphanumerical characters, underscores (_) and dashes (-). It has length inclusively between 3 and 30.
Example
Schema
string
[a-zA-Z0-9-_]{3,30}
Base64
A base64-encoded binary data.
Example
Schema
string
none
Last updated