Skip to content

Commit 70f5e1b

Browse files
committed
Add README
Signed-off-by: Ian Costanzo <ian@anon-solutions.ca>
1 parent d71e9e2 commit 70f5e1b

4 files changed

Lines changed: 84 additions & 3 deletions

File tree

demo/docker-agent/Dockerfile.acapy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ COPY ngrok-wait.sh ngrok-wait.sh
88
RUN chmod +x ./ngrok-wait.sh
99

1010
USER $user
11+
12+
# temporary until this PR gets merged/released
13+
RUN pip uninstall -y aries-cloudagent
14+
RUN pip install aries-cloudagent[indy,bbs,askar]@git+https://github.com/ianco/aries-cloudagent-python@endorser-write-did

demo/docker-agent/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Running an Author Agent and connecting to an Endorser
2+
3+
This directory contains scripts to run an aca-py agent as an Author, that can conenct to an Endorser service.
4+
5+
## Running the Author Agent
6+
7+
The docker-compose script runs ngrok to expose the agent's port publicly, and stores wallet data in a postgres database.
8+
9+
To run the Author agent in this repo, open a command shell in this directory and run:
10+
11+
- to build the containers:
12+
13+
```bash
14+
docker-compose build
15+
```
16+
17+
- to run the author agent:
18+
19+
```bash
20+
docker-compose up
21+
```
22+
23+
You can connect to the [agent's api service here](http://localhost:8010).
24+
25+
Note that all the configuration settings are hard-coded in the docker-compose file and ngrok-wait.sh script, so if you change any configs you need to rebuild the docker images.
26+
27+
- to shut down the agent:
28+
29+
```bash
30+
docker-compose stop
31+
docker-compose rm -f
32+
```
33+
34+
This will leave the agent's wallet data, so if you restart the agent it will maintain any created data.
35+
36+
- to remove the agent's wallet:
37+
38+
```bash
39+
docker volume rm docker-agent_wallet-db-data
40+
```
41+
42+
## Connecting to an Endorser Service
43+
44+
For this example, we will connect to [this endorser service](https://github.com/bcgov/aries-endorser-service), which you can connect to locally at `http://localhost:5050/endorser/docs`.
45+
46+
Make sure you start the endorser service on the same ledger as your author, and make sure the endorser has a public DID with ENDORSER role.
47+
48+
For example start the endorser service as `LEDGER_URL=http://test.bcovrin.vonx.io TAILS_SERVER_URL=https://tails-test.vonx.io ./manage start --logs` and then make sure the Author agent is started with `--genesis_url http://test.bcovrin.vonx.io/genesis`.
49+
50+
### Connecting the Author to the Endorser
51+
52+
Endorser Service: Use the `GET /v1/admin/config` endpoint to fetch the endorser's configuration, including the public DID (which the author will need to know). Also confirm whether the `ENDORSER_AUTO_ACCEPT_CONNECTIONS` and `ENDORSER_AUTO_ENDORSE_REQUESTS` settings are `True` or `False` - for the following we will assume that both are `False` and the endorser must explicitely respond to all requests.
53+
54+
Author Agent: Use the `POST /didexchange/create-request` to request a connection with the endorser, using the endorser's public DID. Set the `alias` to `Endorser` - this *MUST* match the `--endorser-alias 'Endorser'` setting (in the ngrok-wait.sh script). Use the `GET /connections` endpoint to verify the connection is in `request` state.
55+
56+
Endorser Service: Use the `GET /v1/connections` endpoint to see the connection request (state `request`). Using the `connection_id`, call the `POST /connections/{connection_id}/accept` endpoint to accept the request. Verify that the connection state goes to `active`.
57+
58+
Author Agent: Verify the connection state goes to `active`. Use the `POST /transactions/{conn_id}/set-endorser-role` to set the connection role to `TRANSACTION_AUTHOR`, and then use `POST /transactions/{conn_id}/set-endorser-info` to set the endorser's alias to `Endorser` and the public DID to the endorser's public DID. Verify the settings using the `GET /connections/{conn_id}/meta-data` endpoint.
59+
60+
The connection is now setup between the two agents!
61+
62+
### Creating a Public Author DID
63+
64+
Author Agent: Use the `POST /wallet/did/create` (use an empty `{}` POST body) to create a local did. Then use `POST /ledger/register-nym` to send the data to the ledger - this will create a transaction and send it to the endorser service.
65+
66+
Endorser Service: Use the `GET /v1/endorse/transactions` endpoint to see the endorse request - it should be in state `request_received`. Using the `POST /v1/endorse/transactions/{transaction_id}/endorse` endpoint and the `transaction_id`, approve the request. The state should now (eventually) go to `transaction_acked`.
67+
68+
Author Service: Use the `GET /transactions` endpoint to verify the transaction is in `transaction_acked` state. Then use the `POST /wallet/did/public` to set the new DID to be the Author's public DID. This will generate another endorser transaction to set the DID's endpoint (ATTRIB transaction) on the ledger.
69+
70+
Endorser Service: Use the same endpoints as above (`GET /v1/endorse/transactions` and then `POST /v1/endorse/transactions/{transaction_id}/endorse`) to view the endorse request and approve it.
71+
72+
### Endorsing Author Requests
73+
74+
Author requests to create schema, create credential definition and create revocation registries will all now generate endorse requests to the endorser.
75+

demo/docker-agent/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
ngrok-agent:
99
image: wernight/ngrok
1010
ports:
11-
- 4057:4040
11+
- 4067:4040
1212
command: ngrok http author-agent:8001 --log stdout
1313

1414
author-agent:

demo/docker-agent/ngrok-wait.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ exec aca-py start \
2727
--auto-provision \
2828
--inbound-transport http '0.0.0.0' 8001 \
2929
--outbound-transport http \
30-
--genesis-url "https://raw.githubusercontent.com/ICCS-ISAC/dtrust-reconu/main/CANdy/dev/pool_transactions_genesis" \
30+
--genesis-url "http://test.bcovrin.vonx.io/genesis" \
3131
--endpoint "${ACAPY_ENDPOINT}" \
3232
--auto-ping-connection \
3333
--monitor-ping \
3434
--public-invites \
35-
--wallet-type "askar" \
35+
--wallet-type "indy" \
3636
--wallet-name "test_author" \
3737
--wallet-key "secret_key" \
3838
--wallet-storage-type "postgres_storage" \
@@ -47,3 +47,5 @@ exec aca-py start \
4747
--auto-write-transactions \
4848
--auto-create-revocation-transactions \
4949
--log-level "error"
50+
51+
# --genesis-url "https://raw.githubusercontent.com/ICCS-ISAC/dtrust-reconu/main/CANdy/dev/pool_transactions_genesis" \

0 commit comments

Comments
 (0)