/distributed-compliance-ledger

DCL is a public permissioned ledger framework for Zigbee compliance certification of device models. The ledger is based on Cosmos SDK and Tendermint.

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Distributed Compliance Ledger

License Unit Tests

If you are interested in how to build and run the project locally, please look at README-DEV

Please note, that the only officially supported platform now is Linux. It's recommended to develop and deploy the App on Ubuntu 18.04 or Ubuntu 20.04.

Please note, that there were breaking changes in DCL 0.6 (migration to the latest Cosmos SDK), so the current master and DCL releases 0.6+ are not compatible with pools and Test Nets running DCL 0.5.

Overview

DC Ledger is a public permissioned Ledger which can be used for two main use cases:

  • ZB/Matter compliance certification of device models
  • Public key infrastructure (PKI)

More information about use cases can be found in DC Ledger Overview and Use Case Diagrams.

DC Ledger is based on Tendermint and Cosmos SDK.

DC Ledger is a public permissioned ledger in the following sense:

In order to send write transactions to the ledger you need:

  • Have a private/public key pair
  • Have an Account created on the ledger via ACCOUNT transaction (see Use Case Txn Auth).
    • The Account stores the public part of the key
    • The Account has an associated role. The role is used for authorization policies.
  • Sign every transaction by the private key.

Main Components

Pool of Nodes

  • A network of Tendermint-based validator nodes (Validators and Observers) maintaining the ledger.
  • Every validator node (dcld binary) runs DC Ledger application code (based on Cosmos SDK) implementing the use cases.
  • See the proposed deployment in deployment and deployment-detailed.
  • See recommended design for DCL MainNet deployment on AWS in aws deployment

Node Types

  • Full Node: contains a full replication of data (ledger, state, etc.):
    • Validator Node (VN): a full node participating in consensus protocol (ordering transactions).
    • Sentry Node: a full nodes that doesn't participate in consensus and wraps the validator node representing it for the rest of the network as one of the ways for DDoS protection.
      • Private Sentry Node: a full node to connect other Validator or Sentry nodes only; should not be accessed by clients.
      • Public Sentry Node: a full node to connect other external full nodes (possibly observer nodes).
    • Observer Node (ON): a full node that doesn't participate in consensus. Should be used to receive read/write requests from the clients.
  • Light Client Proxy Node: doesn't contain a full replication of data. Can be used as a proxy to untrusted Full nodes for single-value query requests sent via CLI or Tendermint RPC. It will verify all state proofs automatically.
  • Seed Node: provides a list of peers which a node can connect to.

See

Clients

For interactions with the pool of nodes (sending write and read requests).

Every client must be connected to a Node (either Observer or Validator).

If there is no trusted node for connection, a Light Client Proxy can be used. A Light Client Proxy can be connected to multiple nodes and will verify the state proofs for every single value query request.

Please note, that multi-value queries don't have state proofs support and should be sent to trusted nodes only.

Please make sure that TLS is enabled in gRPC, REST or Light Client Proxy for secure communication with a Node.

How To

CLI

  • The same dcld binary as a Node
  • A full list of all CLI commands can be found there: transactions.md.
  • CLI can be used for write and read requests.
  • Please configure the CLI before using (see how-to.md).
  • If there are no trusted Observer or Validator nodes to connect a CLI, then a Light Client Proxy can be used.

Light Client Proxy

Should be used if there are no trusted Observer or Validator nodes to connect.

It can be a proxy for CLI or direct requests from code done via Tendermint RPC.

Please note, that CLI can use a Light Client proxy only for single-value query requests. A Full Node (Validator or Observer) should be used for multi-value query requests and write requests.

Please note, that multi-value queries don't have state proofs support and should be sent to trusted node only.

See Run Light Client Proxy for details how to run it.

REST

gRPC

Tendermint RPC and Light Client

  • Tendermint RPC is exposed by every running node at port 26657. See https://docs.cosmos.network/v0.44/core/grpc_rest.html#tendermint-rpc.
  • Tendermint RPC supports state proofs. Tendermint's Light Client library can be used to verify the state proofs. So, if Light Client API is used, then it's possible to communicate with non-trusted nodes.
  • Please note, that multi-value queries don't have state proofs support and should be sent to trusted nodes only.
  • There are currently no DC Ledger specific API libraries for various platforms and languages, but they may be provided in the future.
  • The following libraries can be used as light clients:

Instructions

After the CLI or REST API is configured and Account with an appropriate role is created, the following instructions from how-to.md can be used for every role (see Use Case Diagrams):

  • Trustee

    • propose new accounts
    • approve new accounts
    • propose revocation of accounts
    • approve revocation of accounts
    • propose X509 root certificates
    • approve X509 root certificates
    • propose revocation of X509 root certificates
    • approve revocation of X509 root certificates
    • publish X509 certificates
    • revoke X509 certificates
    • propose pool upgrade
    • approve pool upgrade
  • CA

    • propose X509 root certificates
    • publish X509 certificates
    • revoke X509 certificates
  • Vendor

    • publish vendor info
    • publish device model info
    • publish device model version
    • publish X509 certificates
    • revoke X509 certificates
  • Certification Center

    • certify or revoke certification of device models
    • publish X509 certificates
    • revoke X509 certificates
  • Node Admin

    • add a new Validator node
    • publish X509 certificates
    • revoke X509 certificates

Run a local pool of nodes in Docker

See Run local pool section in README-DEV.md.

Deploy a persistent pool of nodes

A recommended way for deployment and client connection: diagram, diagram-detailed and diagram-aws.

  • If you want to deploy your own network or a standalone node follow the Running Node

Upgrade all nodes in a pool to a new version of DCL application

DCL application can be simultaneously updated on all nodes in the pool without breaking consensus. See Pool Upgrade and Pool Upgrade How To for details.

Useful Links