Skip to content

Commit

Permalink
Linting Issues Fixed.
Browse files Browse the repository at this point in the history
Signed-off-by: Rajat Sharma <rajat16.sharma@ril.com>
  • Loading branch information
rajat-dlt committed Jun 10, 2024
1 parent be4a734 commit 4239b6c
Showing 1 changed file with 126 additions and 121 deletions.
247 changes: 126 additions & 121 deletions examples/cactus-example-discounted-asset-trade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Alice knows that Acme Corp. provides digital certificates. She asks Acme Corp. t
- `asset_trade_indy_all_in_one`

1. Setup Indy credentials:

- Before running the sample application we need to register employment credential and issue it to Alice (user of our app).
- Use `setup-credentials` script from `cactus-example-discounted-asset-trade-client`.

Expand Down Expand Up @@ -184,158 +185,162 @@ For development purposes, it might be useful to run the sample application outsi

1. (Optional) Check credentials in Alice wallet by selecting `Get this agent credentials`.

```bash
Action: Get this agent credentials
[
{
"id": "eb69032d-ec73-4fa1-bd83-1ff52a0dc4b5",
"schemaId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0",
# Note: This credential matches one we'll be requesting in discounted asset trade example
"credentialDefinitionId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default",
"connectionId": "32134b50-a245-4de5-8408-f35fcb069373",
"credentials": [
{
"credentialRecordType": "anoncreds",
"credentialRecordId": "dd6aba0c-8674-451d-a063-a630004be1dd"
}
],
"credentialAttributes": [
{
"mime-type": "text/plain",
"name": "first_name",
"value": "Alice"
},
{
"mime-type": "text/plain",
"name": "last_name",
"value": "Garcia"
},
{
"mime-type": "text/plain",
"name": "salary",
"value": "2400"
},
{
"mime-type": "text/plain",
"name": "employee_status",
# Note: Alice is a permanent employee
"value": "Permanent"
},
{
"mime-type": "text/plain",
"name": "experience",
"value": "10"
}
]
}
]
```
```bash
Action: Get this agent credentials
[
{
"id": "eb69032d-ec73-4fa1-bd83-1ff52a0dc4b5",
"schemaId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/SCHEMA/cactiJobCert/1.0.0",
# Note: This credential matches one we'll be requesting in discounted asset trade example
"credentialDefinitionId": "did:indy:cacti:test:Th7MpTaRZVRYnPiabds81Y/anoncreds/v0/CLAIM_DEF/11/default",
"connectionId": "32134b50-a245-4de5-8408-f35fcb069373",
"credentials": [
{
"credentialRecordType": "anoncreds",
"credentialRecordId": "dd6aba0c-8674-451d-a063-a630004be1dd"
}
],
"credentialAttributes": [
{
"mime-type": "text/plain",
"name": "first_name",
"value": "Alice"
},
{
"mime-type": "text/plain",
"name": "last_name",
"value": "Garcia"
},
{
"mime-type": "text/plain",
"name": "salary",
"value": "2400"
},
{
"mime-type": "text/plain",
"name": "employee_status",
# Note: Alice is a permanent employee
"value": "Permanent"
},
{
"mime-type": "text/plain",
"name": "experience",
"value": "10"
}
]
}
]
```

1. (Optional) Check the balance on Ethereum and the asset ownership on Fabric by selecting `Get assets`.

```bash
Action: Get assets
# Ethereum fromAccount:
1.00005515e+26
# Ethereum escrowAccount:
0
# Ethereum toAccount:
0
# Fabric:
[
{
...
},
{
ID: 'asset2',
color: 'red',
size: 5,
owner: 'Brad',
appraisedValue: 400
},
...
]
```
```bash
Action: Get assets
# Ethereum fromAccount:
1.00005515e+26
# Ethereum escrowAccount:
0
# Ethereum toAccount:
0
# Fabric:
[
{
...
},
{
ID: 'asset2',
color: 'red',
size: 5,
owner: 'Brad',
appraisedValue: 400
},
...
]
```

1. Run the transaction execution by selecting `Start the trade`

```bash
Action: Start the trade
Trade request sent! Response: { tradeID: '20231103185232057-001' }
```
```bash
Action: Start the trade
Trade request sent! Response: { tradeID: '20231103185232057-001' }
```
1. (Optional) Check the final balance on Ethereum and the asset ownership on Fabric by selecting `Get assets`.
```bash
Action: Get assets
# Ethereum fromAccount:
1.000057e+26
# Ethereum escrowAccount:
0
# Ethereum toAccount:
25
# Fabric:
[
{
...
},
{
ID: 'asset2',
color: 'red',
size: 5,
owner: 'Cathy',
appraisedValue: 400
},
...
]
```
```bash
Action: Get assets
# Ethereum fromAccount:
1.000057e+26
# Ethereum escrowAccount:
0
# Ethereum toAccount:
25
# Fabric:
[
{
...
},
{
ID: 'asset2',
color: 'red',
size: 5,
owner: 'Cathy',
appraisedValue: 400
},
...
]
```
## How to stop the application and Docker containers
1. Press `Ctrl+C` in `docker-compose` console to stop the application.
1. Run cleanup script
```
sudo ./script-cleanup.sh # for root owned files
./script-cleanup.sh # for user owner files
```
sudo ./script-cleanup.sh # for root owned files
./script-cleanup.sh # for user owner files
```
```
#### Manual cleanup instructions
1. Remove the config files on your machine
```
sudo rm -r ./etc/cactus/
```
sudo rm -r ./etc/cactus/
```
```
1. Stop the docker containers of Ethereum, Fabric and Indy
- `docker stop geth1 asset_trade_faio2x_testnet asset_trade_indy_all_in_one`
- `docker rm geth1 asset_trade_faio2x_testnet asset_trade_indy_all_in_one`
1. Clear indy-all-in-one
```
```
pushd ../../tools/docker/indy-all-in-one/
./script-cleanup.sh
popd
pushd ../../tools/docker/indy-all-in-one/
./script-cleanup.sh
popd
```
```
1. Remove geth files
```
pushd ../../tools/docker/geth-testnet/
rm -fr ./data-geth1/geth/
popd
```
```
pushd ../../tools/docker/geth-testnet/
rm -fr ./data-geth1/geth/
popd
```

0 comments on commit 4239b6c

Please sign in to comment.