DewChain-README

Enterprise-grade distributed ledger software solutions provide modularity and versatility for a broad industry use case. Its modular architecture accommodates the diversity of enterprise use cases through REST-APIs.

SignUP

Create a new account using the email, password and full name.

Screenshot 2022-08-09 at 2 34 16 PM

Keys

Generate Asymmetric Key(Public Key and Private Key) for the JSON Web Tokens (JWT Tokens) Algorithm ES256. 🗝️

Cryptography Type: Elliptic Curve Cryptography (ECC) 🔒

Request Body Details

  • email (Email Address). 📨
  • password (Email Password). 📨🔒
  • enc_password (Password for Encrypting ECC Private Key). 🗝️ 🔐

Screenshot 2022-08-09 at 2 48 08 PM

Server Responce

Screenshot 2022-08-09 at 2 47 31 PM

Token

Generate OAuth2 Access Token for API Authentication. 🪪

Token Type: Bearer

Request Body Details

  • username (Please enter your Email Address). 📨
  • password (Please enter your Email Password). 📨🔒
  • client_id (Please enter Encrypted Private Key hear. You can get it from the GET "create_token_key" Endpoint). 🔑
  • client_secret (Please enter the password used for Encrypting Key. Password entered inside "enc_password" request body during GET "create_token_key" Endpoint). 🔐

Screenshot 2022-08-09 at 3 01 37 PM

Server Responce

Screenshot 2022-08-09 at 3 22 39 PM

(Here, the OAuth2 access token is not required for authorization as it is auto-generated and used after authentication using the 'Authorize' button above.)

Screenshot 2022-08-09 at 3 43 46 PM

Step-By-Step Guide of API Authentication :

  • Step 1: Click the Authorize Button above.
  • Step 2: Enter your Email Address and Password inside the "username" and "password" text box.
  • Step 3: Select Request body from "Client credential location" drop-down menu.
  • Step 4: Enter Encrypted Private Key inside "client_id" text box. You can get it from the GET create_token_key Endpoint.
  • Step 5: Enter the password used for Encrypting Key inside "client_secret" text box. Password entered inside "enc_password" request body during GET create_token_key Endpoint.
  • Step 6: Press Authorize Button.

Screenshot 2022-08-09 at 4 09 54 PM

Wallet

Wallet allows Cryptographically Signed / Verify Data and the Block.

Authorization Required!

Screenshot 2022-08-09 at 4 00 17 PM

Parameters

  • public-token-key (Please enter Public Key hear. You can get it from the GET "create_token_key" Endpoint). 🔑
  • enc_password (Password for Encrypting Wallet).👜 🔒

Screenshot 2022-08-09 at 3 55 09 PM

Server Responce

Screenshot 2022-08-09 at 4 27 27 PM

Data Model

Data Model allows for Validating Data Proposal. ✅

Parameters

  • public-token-key (Please enter Public Key hear. You can get it from the GET "create_token_key" Endpoint). 🔑
  • Request Body (Please enter NodeURLs and UserModel for Data Validation.). 📖

Screenshot 2022-08-11 at 4 29 09 PM

application/json

{
  "NodeUrls": {
    "node_url_1": "postgres://postgres:password@localhost:5432/Node_1",
    "node_url_2": "postgres://postgres:password@localhost:5432/Node_2",
    "node_url_3": "postgres://postgres:password@localhost:5432/Node_3"
  },
  "UserModel": {
  "title": "Person",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string",
      "description": "The person's first name."
    },
    "last_name": {
      "type": "string",
      "description": "The person's last name."
    },
    "age": {
      "description": "Age in years.",
      "type": "integer",
      "minimum": 0
    },
    "pets": {
      "type": "object"
    },
    "comment": {
      "type": "string"
    }
  }
}
}

NodeURLs

Use SQL DB as a node.

"NodeURLs": 
{
    "node_url_1": "postgres://postgres:password@localhost:5432/Node_1",
    "node_url_2": "postgres://postgres:password@localhost:5432/Node_2",
    "node_url_3": "postgres://postgres:password@localhost:5432/Node_3"
}

DewChain currently supports the following databases as Nodes:

  • PostgreSQL >= 9.4
  • MySQL
  • MariaDB
Node_URL

DewChain supports specifying Database configuration in a URL form.

The form is:

DB_TYPE://USERNAME:PASSWORD@HOST:PORT/DB_NAME?PARAM1=value&PARAM2=value

If password contains special characters it need to be URL encoded:

>>> import urllib.parse
>>> urllib.parse.quote_plus("kx%jj5/g")
'kx%25jj5%2Fg'

The supported DB_TYPE

postgres:

Typically in the form of ``postgres://postgres:pass@db.host:5432/somedb``

mysql:

 Typically in the form of ``mysql://myuser:mypass@db.host:3306/somedb``

mariadb

Typically in the form of ``mariadb://myuser:mypass@db.host:3306/somedb``

UserModel

We use JSON schema to describe the structure and validation constraints of data.

"UserModel": 
{
  "title": "Person",
  "type": "object",
  "properties": {
    "first_name": {
      "type": "string",
      "description": "The person's first name."
    },
    "last_name": {
      "type": "string",
      "description": "The person's last name."
    },
    "age": {
      "description": "Age in years.",
      "type": "integer",
      "minimum": 0
    },
    "pets": {
      "type": "object"
    },
    "comment": {
      "type": "string"
    }
  }
}

Data

Data is stored Provisionally and Encrypted in the Transaction Pool for future use. 🔒💾

Parameters

  • public-token-key (Please enter Public Key hear. You can get it from the GET "create_token_key" Endpoint). 🔑
  • private_key (Please enter Wallet Encrypted Private Key hear. You can get it from the GET "create_wallet_key" Endpoint). 👜 🗝️ 🔐
  • key_id (Please enter Wallet Key Id hear. You can get it from the GET "create_wallet_key" Endpoint).👜 🔑 🆔
  • enc_password (Please enter the Password used for Encrypting Wallet. Password entered inside "enc_password" request body during GET "create_wallet_key" Endpoint).👜 🔐
  • header (This section is optional. This section stores some essential metadata about the transaction).
  • proposal (Please enter your data in JSON format. PPlease validate the data based on your Data Model.). 📚

(We use Private key for Data Signature)

Screenshot 2022-08-09 at 6 06 28 PM

proposal

Enter data in JSON format. Please validate the data based on your Data Model.

(YES, I know this data doesn't make any sense. STOP taking everything so seriously!)

{
  'comment': 'null',
  'first_name': 'hi',
  'last_name': 'yo',
  'age': 433,
  'pets': {
    'name': 'sdsd',
    'age': 433
  }
}

Server Responce

Screenshot 2022-08-09 at 6 06 49 PM

Mine Block

Add Transaction to the Distributed Ledger.

Parameters

  • data_uid (Please enter data_uid).
  • public-token-key (Please enter Public Key hear. You can get it from the GET "create_token_key" Endpoint). 🔑
  • private_key (Please enter Wallet Encrypted Private Key hear. You can get it from the GET "create_wallet_key" Endpoint). 👜 🗝️ 🔐
  • key_id (Please enter Wallet Key Id hear. You can get it from the GET "create_wallet_key" Endpoint).👜 🔑 🆔
  • enc_password (Please enter the Password used for Encrypting Wallet. Password entered inside "enc_password" request body during GET "create_wallet_key" Endpoint).👜 🔐

(We use Private key for Block Signature)

Screenshot 2022-08-09 at 6 13 07 PM

Server Responce

Screenshot 2022-08-09 at 6 13 50 PM

Broadcast Transaction

Broadcast Transaction across the nodes. 📢

Parameters

  • index (Block Index)
  • public-token-key (Please enter Public Key hear. You can get it from the GET "create_token_key" Endpoint). 🔑
  • NodeURLs
{
    "node_url_1": "postgres://postgres:password@localhost:5432/Node_1",
    "node_url_2": "postgres://postgres:password@localhost:5432/Node_2",
    "node_url_3": "postgres://postgres:password@localhost:5432/Node_3"
}

Screenshot 2022-08-09 at 9 39 46 PM