Skip to content

dhiway/cord-demo-scripts

Repository files navigation

Cord transaction anchoring scripts (for demonstration purposes)

Requirements

  • You are expected to have docker available to run the cord.network locally with developer mode.
  • Have yarn installed and ready.
  • Any web browser (which supports javascript) to check transactions on the CORD Chain.

How to run the demo code with DOCKER

  • Step 1: checkout/clone this repository.

  • Step 2: build image locally

sudo docker build -t <docker-image-name> .
  • Step 3: run docker image

i) Run demo on sparknet node

sudo docker run <docker-image-name> src/func-test.ts

ii) Run demo on custom node

sudo docker run --env NETWORK_ADDRESS='<network-address>' --env ANCHOR_URI='<anchor-uri>' <docker-image-name> src/func-test.ts

Example : sudo docker run --env NETWORK_ADDRESS='ws://host.docker.internal:9944' --env ANCHOR_URI='//Alice' <docker-image-name> src/func-test.ts

  • Here values of NETWORK_ADDRESS and ANCHOR_URI can be changed according to your use case.

How to run the demo code (with local node)

  • Step 1: checkout/clone this repository.

  • Step 2: install with yarn install once you are inside the repository.

  • Step 3: start the CORD Network in the developer mode (In another terminal)

  • Step 4: run the demo script with npx tsx src/func-test.ts. Understand whats happening by checking the code at src/func-test.ts.

How to run the demo code (with staging network)

  • Step 1: checkout/clone this repository.

  • Step 2: install with yarn install once you are inside the repository.

  • Step 3: You can watch the events and blocks finalization @ https://apps.cord.network/?rpc=wss%3A%2F%2Fstaging.cord.network#/explorer

  • Step 4: Open the demo file you want to run (eg., src/func-test.ts) and change ws://127.0.0.1:9944 to wss://staging.cord.network. Save the file.

  • Step 5: run the demo script with npx tsx src/func-test.ts. Understand whats happening by checking the code at src/func-test.ts.

  • Step 6: run the VC (Verifiable Credential) demo script by running npx tsx src/func-test.ts.

    • NOTE: The VerifiableCredential is a required form of output if your application wants to interact with other applications. If one needs to have complete eco-system in their control, just the stream format of CORD SDK is good enough.

What next from here?

  • Understand the methods exposed from SDK by refering how func-test.ts and network-score-test.ts files are structured.

  • You can refer our white paper for multiple usecases through https://cord.network

  • To build on CORD chain, visit cord project repo.

    • SDK development work is happening at CORD.js repository
    • SUBQL (Substrate's GraphQL update, which can help in organizing events and extrinsics happening on CORD chain) - Repository
  • Reach out to CORD community by joining Discord