rubixchain / rubixgoplatform

GNU General Public License v3.0
8 stars 17 forks source link

Token Chain Validation #185

Closed Maneesha-rubix closed 1 month ago

Maneesha-rubix commented 2 months ago

Adding a CLI command as well as an API end point to validate required number of blocks of any (RBT as well as smart contract) token chain. The blocks are validated as per their type-requirement. An user can also validate all it's tokens or all it's smart contract tokens available in it's SQLite3 DB.

Note: Please note that, this PR is only for (RBT / smart contract) token chain validation and does not include any resolutions for failed-validations.

TokenTransferredType:

  1. Block hash and previous block hash validation
  2. Sender signature validation
  3. All quorums' signature validation

TokenGeneratedType:

  1. Block hash validation
  2. Token-owner signature validation
  3. if part token, Parent token-chain latest block validation
  4. if parent token is also a part token, validate it's Parent token-chain latest block
  5. repeat step-4, until parent token is a whole token

TokenBurntType:

  1. Block hash and previous block hash validation
  2. Token-owner signature validation

TokenPledgedType:

  1. Block hash and previous block hash validation
  2. Token-owner signature validation

TokenUnpledgedType:

  1. Block hash and previous block hash validation
  2. Token-owner signature validation

TokenContractCommited:

  1. Block hash and previous block hash validation
  2. Token-owner signature validation

TokenDeployedType:

  1. Block hash validation
  2. All quorums' signature validation

TokenExecutedType:

  1. Block hash and previous block hash validation
  2. All quorums' signature validation

A few common validation checks for latest block of each token chain are:

  1. Token pin check
  2. Token-state pin check (in case latest block is TokenTransferredType or TokenGeneratedType )

The CLI command for token chain validation is: ./rubixgoplatform validatetokenchain -did <user did> -token <token ID> -sctValidation -blockCount <required number of blocks to be validated> -port <port number of user node>