Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak in script to work under Linux; updates to readme for demo #33

Merged
merged 1 commit into from
Jul 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,49 @@
The dockerized demo requires to have von-network instance running in Docker locally. See the [von-network](von-https://github.com/bcgov/von-network) readme file for more info.

### Running the dockerized demo
Open two shells (Git Bash is recommended for Windows) in the `scripts` directory.
Open three `bash` shells. Git Bash is highly recommended for Windows, Linux and Mac terminal apps default to `bash`.

Start the `faber` agent by issuing the following command in the first shell:
```
In the first terminal window, start `von-network` using the instructions provided [here](https://github.com/bcgov/von-network#running-the-network-locally).

In the second terminal, change directory into `scripts` directory of your clone of this repository. Start the `faber` agent by issuing the following command:

``` bash
./run_demo faber
```

Start the `alice` agent by issuing the following command in the first shell:
```
In the second terminal, change directory into `scripts` directory of your clone of this repository. Start the `faber` agent by issuing the following command:

``` bash
./run_demo alice
```

Refer to the section [follow the script](#follow-the-script) for further instructions.
Jump to the [Follow The Script](#follow-the-script) section below for further instructions.

## Running Locally

## Running locally
First you need to startup a local ledger (e.g. like this: https://github.com/hyperledger/indy-sdk#1-starting-the-test-pool-on-localhost), and then open up two shell scripts and run:

```
``` bash
python faber-pg.py <port#>
```

```
``` bash
python alice-pg.py <port#>
```

Note that alice and faber will each use 5 ports, e.g. if you run ```python faber-pg.py 8020``` if will actually use
ports 8020 through 8024.
Note that Alice and Faber will each use 5 ports, e.g. if you run ```python faber-pg.py 8020``` it will actually use ports 8020 through 8024.

To create the alice/faber wallets using postgres storage, just add the "--postgres" option when running the script.
To create the Alice/Faber wallets using postgres storage, just add the "--postgres" option when running the script.

These scripts run the agent as a sub-process (see the documentation for acagent) and also publish a rest service to
receive web hook callbacks from their agent
These scripts implement the controller and run the agent as a sub-process (see the documentation for `acagent`). The controller publishes a rest service to receive web hook callbacks from their agent.

Refer to the section [follow the script](#follow-the-script)for further instructions.
Refer to the [Follow The Script](#follow-the-script) section below for further instructions.

## Follow The Script
Once Faber has started, it will create and display an invitation; copy this invitation and input at the Alice prompt.

The scripts will then request an option:
With both the Alice and Faber agents started, go to the Faber terminal window. The Faber agent has created and displayed an invitation. Copy this invitation and paste it at the Alice prompt. The agents will connect and then show a menu of options:

faber-pg.py - establishes a connection with Alice, and then provides a menu:
Faber:

```
1 = send credential to Alice
Expand All @@ -55,13 +57,15 @@ faber-pg.py - establishes a connection with Alice, and then provides a menu:
x = stop and exit
```

alice-pg.py - once a connection is established, this script provides a menu:
Alice:

```
3 = send a message to Faber
x = stop and exit
```

At the Faber prompt, enter "1" to send a credential, and then "2" to request a proof.
Feel free to use the "3" option to send messages back and forth between the agents. Fun, eh? Those are secure, end-to-end encrypted messages.

When ready to test the credentials exchange protocols, go to the Faber prompt, enter "1" to send a credential, and then "2" to request a proof.

You don't need to do anything with Alice - she will automatically receive Credentials and respond to Proofs.
You don't need to do anything with Alice's agent - her agent is implemented to automatically receive credentials and respond to proof requests.
5 changes: 2 additions & 3 deletions scripts/run_demo
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ else
AGENT_PORT_RANGE=8030-8037
fi

DOCKER_ENV="-e LOG_LEVEL=${LOG_LEVEL} -e RUNMODE=docker"
DOCKER_ENV="-e LOG_LEVEL=${LOG_LEVEL} -e RUNMODE=docker -e DOCKERHOST=`docker run --net=host codenvy/che-ip`"
if ! [ -z "$POSTGRES" ]; then
DOCKER_ENV="${DOCKER_ENV} -e POSTGRES=1 -e RUST_BACKTRACE=1"
fi

# on Windows, docker run needs to be prefixed by winpty
if [[ "$OSTYPE" == "msys" ]]; then
DOCKER="winpty docker"
else
DOCKER=${DOCKER:-docker}
fi
DOCKER=${DOCKER:-docker}

$DOCKER run --name $AGENT --rm -it \
-p 0.0.0.0:$AGENT_PORT_RANGE:$AGENT_PORT_RANGE \
Expand Down