Skip to content

Latest commit

 

History

History
110 lines (80 loc) · 3.71 KB

README.md

File metadata and controls

110 lines (80 loc) · 3.71 KB

Indy smart contracts

Prerequisites to run

  • node > v18.15.0
  • yarn

Install dependencies

> yarn install

Compile contracts

> yarn compile

The following folders should be generated as the result:

  • artifacts - completed contract specification
  • typechain-types - typescript bindings for contracts

Run tests

> yarn test

Main Contracts

Demos

You can find sample scripts demonstrating the usage of deployed contracts in the demo folder.

  • Account management - deploy/read/writer transactions.
    > yarn demo/account
    
  • Demo flow - create/resolve DID/Schema/Credential Definition using did:indy2 method.
    > yarn demo/flow
    
  • Demo flow - create/resolve DID/Schema/Credential Definition using did:ethr method.
    > yarn demo/flow-with-did-ethr
    
  • Roles management - get/assign/revoke role to/from account.
    > yarn demo/roles
    
  • Upgrade management - propose/approve upgradable contract implementation.
    > yarn demo/upgrade
    
  • Validators management - get list of current validators.
    > yarn demo/validators
    

Helper Scripts

  • genesis - helper scripts to generate genesis blocks for injecting contracts.

    Find more details regarding the scripts in the genesis section of this document.

Inject contracts into network genesis

Prerequisites

  • socl tool must be installed on the machine.

This section describes how to inject smart contracts into the genesis state of the network.

  1. Prepare the input file with the initial state of each contract.

  2. Compile contracts:

    yarn solc-compile
    
  • artifacts and compiled-contracts folders with compiled contracts will be generated as the result of the execution.
  1. Execute script generating the contracts content for the network genesis file:

    yarn genesis/generate

  • ContractsGenesis.json file will be generated as the result
  1. Put the whole block into the alloc section of the network genesis file.

  2. If you changed the default address of ValidatorControl contract: Set address of ValidatorControl contract into validatorcontractaddress field of the qbft section of the genesis file.

  3. If you changed the default address of AccountControl contract: Set address of AccountControl contract into permissions-accounts-contract-address field of the config.toml file.