The Flex Ledger vocabulary is used to enable Internet-based applications to build flexible decentralized ledger and consensus systems.
This document describes a number of classes and properties that can be used to enable Internet-based applications to build flexible decentralized ledger and consensus systems.
This entire document is a work in progress and should be considered in beta until it is ratified as an official document via the World Wide Web Consortium.
This is an experimental vocabulary and its use in production systems is not recommended at this time.
An event that is used to provide a snapshot in time that can be used to quickly bootstrap late-joining nodes in a system. Checkpoint events can also be used as known good points to start from instead of having to download the entire ledger history.
The example below describes a checkpoint event with a checkpoint log located
at https://example.org/ledgers/example/checkpoints/132
whose
contents hash to a SHA-256 value of
7fa3b9eaa8d92d2b87abf83d88a92ff23
:
{ "@context": "https://w3id.org/flex/v1", "id": "https://example.org/ledgers/example/6372463", "type": "LedgerCheckpointEvent", "checkpointLog": "https://example.org/ledgers/example/checkpoints/132", "checkpointLogHash": "urn:sha256:7fa3b9eaa8d92d2b87abf83d88a92ff23", "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://example.org/i/master/keys/32", "signatureValue": "Piw90D4cFqT/yKd/JGLv...NGFz==" }, ... // there may be multiple counter-signatures here ] }
An event where the network of nodes curating a particular ledger come to an agreement on the correct state of the ledger. The mechanism used to come to agreement is configurable.
The example below describes a consensus event that includes a link to a previousConsensusEvent, a list of acknowledged events, and a set of signatures by multiple entities proving that the consensus ballot had a finalized outcome:
{ "@context": "https://w3id.org/flex/v1", "id": "https://example.org/ledgers/example/8239849843", "type": ["LedgerConsensusEvent", "ProofOfBallot2015"], "previousConsensusEvent": "https://example.org/ledgers/example/8239848234", "acknowledgedEvents": [ "https://example.org/ledgers/example/8239849838", "https://example.org/ledgers/example/8239849839", "https://example.org/ledgers/example/8239849840", "https://example.org/ledgers/example/8239849841", "https://example.org/ledgers/example/8239849842", ], "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/12", "signatureValue": "4cF/yKd/JPiw90DqTGLv...NGFz==" }, // other signatures on votes in favor follow... ] }
An event noting that the operational rules of the ledger have changed. This event is typically only active after the next ConsensusEvent has taken place.
The example below describes a configuration event for a ledger. The configuration event states that the storage mechanism for the ledger is a sequential list and the consensus algorithm requires one valid signature:
{ "@context": "https://w3id.org/flex/v1", "id": "https://vhda.va.us.gov/ledgers/webville/houses/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": "https://webville.va.us.gov/i/planning-department", "minimumSignaturesRequired": 1 }, "nextEvent": "https://vhda.va.us.gov/ledgers/webville/houses/2", "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-21T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
An event noting that a ledger value has changed. Changes to a ledger can be modifications to the state machine such as the addition of values, removal of values, or modification of values.
The example below describes a storage event containing a financial transaction and a link to the previous ledger event:
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/cryptocurrencies/v1" ], "id": "https://example.org/ledgers/example/5", "type": "LedgerStorageEvent", "previousEvent": "https://example.org/ledgers/example/4", "addsObject": [{ "transaction": [{ "source": "https://example.org/accounts/jane/7", "destination": "https://foo.com/accounts/bob/3", "remoteLedger": "https://foo.com/ledgers/blah/3445", "transfer": { "amount": "23.45", "currency": "USD" } }], ... // there could be hundreds to thousands more of these }] "signature": { "type": "LinkedDataSignature2016", "created": "2017-01-24T02:11:16Z", "creator": "bytecoin:key:23fa73bb201c738d", "signatureValue": "90D4cFqT/yKPiwd/GFzv...NJGL==" } }
A storage mechanism that combines a Merkle Tree with a radix-sorted trie thus creating a quickly searchable hashtree. Merkle-Patricia Tries are fully deterministic meaning that re-creating the tree results in the same root hash and byte-perfect key-value bindings. This data structure provides O(log(n)) efficiency for inserts, lookups and deletes, and are simpler to implement and understand. The Ethereum blockchain uses Merkle-Patricia Tries for storage.
The example below describes a configuration event where the selected storage mechanism is a Merkle-Patricia trie:
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/cryptocurrencies/v1" ], "id": "lux:entry:37823", "type": "LedgerConfigurationEvent", "storageMechanism": "MerklePatriciaTrie", "consensusAlgorithm": { "type": "ProofOfBallot2015", "minimumQuorumPercentage": "0.51", "minimumVotePercentage": "0.67", "approvedSigner": [ "https://regulator-a.gov/i/bank-oversight", "https://regulator-b.gov/i/consumer-protection", "https://bank-x.com/i/housing", "https://bank-y.com/i/corporate-loans", "https://bank-z.com/i/swaps", ] }, "signature": { "type": "LinkedDataSignature2016", "created": "2017-01-24T02:10:21Z", "creator": "lux:keys:d52aff68923f3b2c8183bd", "signatureValue": "FqT/yK90D4cPiwd/GFzv...NJGL==" } }
A storage mechanism utilizing the Merkle Tree data structure, which enables efficient and secure verification of the contents of large data structures. The Bitcoin blockchain utilizes Merkle trees in its implementation.
The example below describes a ledger storage event where the storage mechanism is a Merkle tree:
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/cryptocurrencies/v1" ], "id": "bytecoin:block:23fa73bb201c738d", "type": "LedgerConfigurationEvent", "storageMechanism": "MerkleTree", "consensusAlgorithm": { "type": "ProofOfWork2016", "proofOfWorkAlgorithm": "Bitcoin", "targetDifficulty": "199312067531.243" }, "signature": { "type": "LinkedDataSignature2016", "created": "2017-01-24T02:10:21Z", "creator": "bytecoin:keys:23f3b2c8183bdd52aff689", "signatureValue": "90D4cFqT/yKPiwd/GFzv...NJGL==" } }
A data structure that stores a sequential list of items, also known as a linked list.
The example below describes a ledger configuration event where the storage mechanism is a sequential list:
{ "@context": "https://w3id.org/flex/v1", "id": "https://vhda.va.us.gov/ledgers/webville/houses/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": "https://webville.va.us.gov/i/planning-department", "minimumSignaturesRequired": 1 }, "nextEvent": "https://vhda.va.us.gov/ledgers/webville/houses/2", "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-21T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
A consensus protocol as described in the Stellar Consensus Protocol Whitepaper. The Stellar Consensus Protocol is the first provably safe construction for Federated Byzantine Agreement. Unlike most existing approaches to consensus, it enjoys four key properties: 1) decentralized control, 2) flexible trust, 3) low latency, and 3) asymptotic security. As a Federated Byzantine Agreement protocol, it guarantees safety in the face of non-rational behavior and requires only modest computing resources, lowering the barrier to entry.
The example below describes a consensus mechanism object where the mechanism is a proof of ballot where at least 51% of the voting members are available and the minimum vote required to reach consensus is 67%:
{ "@context": "https://w3id.org/flex/v1", "type": "ProofOfBallot2015", "quorum": "0.51", "minimumVotePercentage": "0.67" }
A consensus protocol that proves that a particular amount of effort has been expended to arrive at a provided answer. For example, Bitcoin's Proof of Work algorithm proves that a statistically significant amount of hashing computations have occurred to arrive at an answer.
The example below describes a consensus mechanism object where the mechanism
is a Bitcoin-style proof of work with a target difficulty of
199312067531.243
:
{ "@context": "https://w3id.org/flex/v1", "type": "ProofOfWork2016", "proofOfWorkAlgorithm": "Bitcoin", // double SHA-256 on block hash + nonce < targetDifficulty "targetDifficulty": "199312067531.243" }
A consensus protocol that demonstrates that a certain number of signatures past a given threshold have been registered.
The example below describes a consensus mechanism object where the mechanism is a proof of signature that requires two signatures from the set of approved signers:
{ "@context": "https://w3id.org/flex/v1", "type": "ProofOfSignature2016", "approvedSigner": [ "https://fema.example.us.gov/i/ofp", "https://tsa.example.us.gov/i/vclaims", "https://dhs.example.us.gov/i/credentialing" ], "minimumSignaturesRequired": 2 }
Denotes that one or more objects have been added as a result of the event. This property is typically used by LedgerStorageEvents.
The example below expresses a ledger storage event where an object describing a real estate loan transfer is added to the ledger.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/real-estate/v1" ], "id": "https://example-consortium.com/private-ledgers/loans/real-estate/2", "type": "LedgerStorageEvent", "previousEvent": "https://example-consortium.com/private-ledgers/loans/real-estate/1", "addsObject": [{ "id": "https://example-consortium.com/private-ledgers/loans/real-estate/transactions/238947234", "transaction": { "source": "lei:HB7FFAZIO0MZ8PP8OE26", // compliant to ISO 17442 standard "destination": "lei:PP8OEHB7FFAZIO0MZ826", "transfer": { "loanId": "lei:FAZIO0PP8OEHB7FMZ826" } } }], "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://regulator-b.gov/i/consumer-protection/keys/2f73", "signatureValue": "Piw90D4cFqT/yKd/JGLv...NGFz==" }, ... // there will be at least 3 more signatures here ] }
Specifies an entity that is authorized to assert consensus under permissioned consensus algorithms. It is important to note that the data, such as public key material, should be stored in the ledger to ensure long-term auditability of the ledger.
The example below describes a ledger configuration event with a proof of
signature consensus algorithm. The proof of signature only requires one
approved signer, which is
https://webville.va.us.gov/i/planning-department
.
{ "@context": "https://w3id.org/flex/v1", "id": "https://vhda.va.us.gov/ledgers/webville/houses/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": "https://webville.va.us.gov/i/planning-department", "minimumSignaturesRequired": 1 }, "nextEvent": "https://vhda.va.us.gov/ledgers/webville/houses/2", "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-21T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
A URL pointing to a log file that when replayed can re-create the current state of the ledger.
The example below expresses a ledger checkpoint event with a checkpointLog
located at https://example.org/ledgers/example/checkpoints/132
.
{ "@context": "https://w3id.org/flex/v1", "id": "https://example.org/ledgers/example/6372463", "type": "LedgerCheckpointEvent", "checkpointLog": "https://example.org/ledgers/example/checkpoints/132", "checkpointLogHash": "urn:sha256:7fa3b9eaa8d92d2b87abf83d88a92ff23", "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://example.org/i/master/keys/32", "signatureValue": "Piw90D4cFqT/yKd/JGLv...NGFz==" }, ... // there may be multiple counter-signatures here ] }
A cryptographic hash of the contents of the checkpointLog that may be used to ensure data integrity.
The example below expresses a ledger checkpoint event with a checkpointLog
located at https://example.org/ledgers/example/checkpoints/132
where the contents of the log should hash to a SHA-256 value of
7fa3b9eaa8d92d2b87abf83d88a92ff23
.
{ "@context": "https://w3id.org/flex/v1", "id": "https://example.org/ledgers/example/6372463", "type": "LedgerCheckpointEvent", "checkpointLog": "https://example.org/ledgers/example/checkpoints/132", "checkpointLogHash": "urn:sha256:7fa3b9eaa8d92d2b87abf83d88a92ff23", "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://example.org/i/master/keys/32", "signatureValue": "Piw90D4cFqT/yKd/JGLv...NGFz==" }, ... // there may be multiple counter-signatures here ] }
Used to specify a particular consensus algorithm, typically used in a ConfigurationEvent.
The example below expresses a proof of signature consensus algorithm. This information is typically expressed in a ledger configuration event.
{ "@context": "https://w3id.org/flex/v1", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": [ "https://fema.example.us.gov/i/ofp", "https://tsa.example.us.gov/i/vclaims", "https://dhs.example.us.gov/i/credentialing" ], "minimumSignaturesRequired": 2 } }
The minimum percentage of members in a particular balloting initiative that are required to vote in order for the vote to count.
The example below expresses a ledger configuration event that specifies a proof of ballot consensus algorithm where the minimum percentage to achieve quorum is 51%.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/cryptocurrencies/v1" ], "id": "https://example-consortium.com/private-ledgers/loans/real-estate/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfBallot2015", "minimumQuorumPercentage": "0.51", "minimumVotePercentage": "0.67", "approvedSigner": [ "https://regulator-a.gov/i/bank-oversight", "https://regulator-b.gov/i/consumer-protection", "https://bank-x.com/i/housing", "https://bank-y.com/i/corporate-loans", "https://bank-z.com/i/swaps", ] }, "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://regulator-b.gov/i/consumer-protection/keys/2f73", "signatureValue": "Piw90D4cFqT/yKd/JGLv...NGFz==" }, ... // there will be at least 3 more signatures here ] }
The minimum number of signatures required to bind a particular decision made in a ledger.
The example below expresses a ledger configuration event specifying a proof of signature consensus algorithm where only one signature is required from the set of approved signers.
{ "@context": "https://w3id.org/flex/v1", "id": "https://vhda.va.us.gov/ledgers/webville/houses/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": "https://webville.va.us.gov/i/planning-department", "minimumSignaturesRequired": 1 }, "nextEvent": "https://vhda.va.us.gov/ledgers/webville/houses/2", "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-21T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
The minimum percentage of votes in an election to carry a particular motion under consideration.
The example below expresses a ledger configuration event specifying a proof of ballot consensus algorithm where 67% of the vote is required to pass a motion.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/cryptocurrencies/v1" ], "id": "https://example-consortium.com/private-ledgers/loans/real-estate/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfBallot2015", "minimumQuorumPercentage": "0.51", "minimumVotePercentage": "0.67", "approvedSigner": [ "https://regulator-a.gov/i/bank-oversight", "https://regulator-b.gov/i/consumer-protection", "https://bank-x.com/i/housing", "https://bank-y.com/i/corporate-loans", "https://bank-z.com/i/swaps", ] }, "signature": [{ "type": "LinkedDataSignature2016", "created": "2018-04-16T19:34:18Z", "creator": "https://regulator-b.gov/i/consumer-protection/keys/2f73", "signatureValue": "Piw90D4cFqT/yKd/JGLv...NGFz==" }, ... // there will be at least 3 more signatures here ] }
The next event in a ledger. It is not always possible to know what the next event is for ledgers of a certain type.
The example below expresses a ledger event where the next event
(https://vhda.va.us.gov/ledgers/webville/houses/2
) is known.
{ "@context": "https://w3id.org/flex/v1", "id": "https://vhda.va.us.gov/ledgers/webville/houses/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": "https://webville.va.us.gov/i/planning-department", "minimumSignaturesRequired": 1 }, "nextEvent": "https://vhda.va.us.gov/ledgers/webville/houses/2", "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-21T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
The previous event in a ledger. This is typically useful when auditing a ledger to ensure that its history is valid.
The example below expresses a ledger event where the previous event
can be accessed at
https://example-consortium.com/private-ledgers/loans/real-estate/1
.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/housing/v1", ], "id": "https://vhda.va.us.gov/ledgers/webville/houses/2", "type": "LedgerStorageEvent", "previousEvent": "https://example-consortium.com/private-ledgers/loans/real-estate/1", "replacesObject": [{ "id": "https://vhda.va.us.gov/properties/3829344", "propertyAddress": { "street": "263 Main Street", "locality": "Webville", "region": "VA", "postalCode": "24736-3726", "country": "US" }, "owner": { "name": "Jane Smith", "postalAddress": { ... } }], "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-22T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
This property is used to specify the type of proof of work algorithm that the ledger expects to be executed in order to reach consensus.
The example below expresses a proof of work consensus algorithm where the
specific algorithm is Bitcoin
. Note that this property requires a
URL and Bitcoin
is an alias for a URL like
https://example.com/algorithms/Bitcoin
.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/cryptocurrencies/v1" ], "type": "ProofOfWork2016", "proofOfWorkAlgorithm": "Bitcoin", "targetDifficulty": "199312067531.243" }
Used to specify the set of objects to remove during a StorageEvent.
The example below expresses a ledger storage event where an object describing a real estate property is removed from the ledger. Note that a removal doesn't remove the object from history, it only removes the object from the active state in the state machine.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/housing/v1", ], "id": "https://vhda.va.us.gov/ledgers/webville/houses/2", "type": "LedgerStorageEvent", "previousEvent": "https://example-consortium.com/private-ledgers/loans/real-estate/1", "removesObject": [{ "id": "https://vhda.va.us.gov/properties/3829344", "propertyAddress": { "street": "263 Main Street", "locality": "Webville", "region": "VA", "postalCode": "24736-3726", "country": "US" }, "owner": { "name": "Jane Smith", "postalAddress": { ... } }], "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-22T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
Used to specify the set of objects to replace during a StorageEvent.
The example below expresses a ledger storage event where an object describing a real estate property is replaced with new information.
{ "@context": [ "https://w3id.org/flex/v1", "https://w3id.org/housing/v1", ], "id": "https://vhda.va.us.gov/ledgers/webville/houses/2", "type": "LedgerStorageEvent", "previousEvent": "https://example-consortium.com/private-ledgers/loans/real-estate/1", "replacesObject": [{ "id": "https://vhda.va.us.gov/properties/3829344", "propertyAddress": { "street": "263 Main Street", "locality": "Webville", "region": "VA", "postalCode": "24736-3726", "country": "US" }, "owner": { "name": "Jane Smith", "postalAddress": { ... } }], "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-22T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
Denotes the type of storage mechanism that should be used for this ledger. These storage mechanisms often have qualities that the ledger depends on for integrity checking, storage efficiency, or other qualities that are important to the ledger application.
The example below expresses a ledger configuration event where the storage mechanism is a sequential list.
{ "@context": "https://w3id.org/flex/v1", "id": "https://vhda.va.us.gov/ledgers/webville/houses/1", "type": "LedgerConfigurationEvent", "storageMechanism": "SequentialList", "consensusAlgorithm": { "type": "ProofOfSignature2016", "approvedSigner": "https://webville.va.us.gov/i/planning-department", "minimumSignaturesRequired": 1 }, "nextEvent": "https://vhda.va.us.gov/ledgers/webville/houses/2", "signature": { "type": "LinkedDataSignature2016", "created": "2016-02-21T02:10:21Z", "creator": "https://webville.va.us.gov/i/planning-department/keys/1", "signatureValue": "cNJGLFqT/d/90D4GFzv...yKPiw==" } }
A property that specifies how difficult a particular proof of work should be. The value is dependent on the proofOfWorkAlgorithm property.
The example below expresses a Bitcoin proof of work consensus algorithm where
the target difficulty is 199312067531.243
.
{ "@context": "https://w3id.org/flex/v1", "type": "ProofOfWork2016", "proofOfWorkAlgorithm": "Bitcoin", "targetDifficulty": "199312067531.243" }
This specification, a part of the "Credentials on Public/Private Linked Ledgers" project, has been funded in part by the United States Department of Homeland Security's Science and Technology Directorate under contract HSHQDC-16-C-00058. The content of this specification does not necessarily reflect the position or the policy of the U.S. Government and no official endorsement should be inferred.