Skip to content

Commit

Permalink
add a working demo script which uses statement, on a weave runtime ch…
Browse files Browse the repository at this point in the history
…ain (#50)

Signed-off-by: Amar Tumballi <[email protected]>
  • Loading branch information
amarts authored Oct 28, 2024
1 parent 6d9e23d commit 7dfdebe
Show file tree
Hide file tree
Showing 3 changed files with 460 additions and 29 deletions.
52 changes: 23 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,16 @@
* Have [`yarn`](https://yarnpkg.com/) installed and ready.
* Any web browser (which supports javascript) to check transactions on the CORD Chain.

## How to run the demo code with DOCKER
## How to run the demo code (with staging network)

* Step 1: checkout/clone this repository.

* Step 2: build image locally
```sh
sudo docker build -t <docker-image-name> .
```
* Step 3: run docker image

i) Run demo on sparknet node
```sh
sudo docker run <docker-image-name> src/func-test.ts
```
ii) Run demo on custom node
```sh
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`
* 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`.

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

Expand All @@ -41,22 +30,27 @@ Example : `sudo docker run --env NETWORK_ADDRESS='ws://host.docker.internal:9944

* 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)
## How to run the demo code with DOCKER

* 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`.
* Step 2: build image locally
```sh
sudo docker build -t <docker-image-name> .
```
* Step 3: run docker image

i) Run demo on sparknet node
```sh
sudo docker run <docker-image-name> src/func-test.ts
```
ii) Run demo on custom node
```sh
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`

- 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.
- Here values of `NETWORK_ADDRESS` and `ANCHOR_URI` can be changed according to your use case.


## What next from here?
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"stream-bench": "tsx --no-cache src/stream-bench",
"demo-score": "tsx --no-cache src/demo-score.ts",
"demo-statement": "tsx --no-cache src/func-test.ts",
"demo-statement1": "tsx --no-cache src/func-test_v9400.ts",
"demo-asset": "tsx --no-cache src/demo-asset.ts"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 7dfdebe

Please sign in to comment.