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 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%2Fregistries.demo.cord.network#/explorer

  • Step 4: run the demo script with NETWORK_ADDRESS=wss://registries.demo.cord.network yarn demo-statement1. Understand whats happening by checking the code at src/func-test_v9400.ts.

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 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.

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