Skip to content
Permalink
Browse files

docs(simple-example): improve script output

and incorporate feedback from @dora-gt, @Neil-Jubinville, @pgarg-ripple,
@KevinWMatthews, and @bstrie
  • Loading branch information...
emschwartz committed Jul 30, 2019
1 parent 0aab3a7 commit c50797ce93f8dc6e5bd38e1f1f35352b8cf74d99
@@ -10,6 +10,6 @@ Cargo.lock
*.rdb
*.aof
cmake-build-debug/
*.log
**/*.log
.DS_Store

@@ -27,7 +27,7 @@ Install and Run:

1. `git clone https://github.com/emschwartz/interledger-rs && cd interledger-rs`
2. `cargo build` (add `--release` to compile the release version, which is slower to compile but faster to run)
2. `cargo run --package interledger` (append command line options after a `--` to use the CLI)
2. `cargo run` (append command line options after a `--` to use the CLI)

## Running the Examples

@@ -6,5 +6,6 @@ Here you can find various demos of Interledger.rs' functionality:
1. [Two-Node Payment with On-Ledger Settlement](./eth-settlement/README.md)
1. Three-Node Payment (Coming Soon!)
1. Cross-Currency Payment and Settlement (Coming Soon!)
1. Integrating Interledger Into Your App (Coming Soon!)

Have questions? Feel free to [open an issue](https://github.com/emschwartz/interledger-rs/issues/new) or ask a question [on the forum](https://forum.interledger.org/)!
@@ -1,13 +1,17 @@
# Simple Two-Node Payment

This example sets up two Interledger.rs nodes, connects them together, and sends a payment from one to the other.
This example sets up two local Interledger.rs nodes, peers them together, and sends a payment from one to the other. This example does not involve any remote nodes or networks.

To run the full example, install [Redis](https://redis.io/) and then use the [`run-all.sh`](./run-all.sh) script. Otherwise, you can walk through each step below.
To run the full example, you can use the [`run-all.sh`](./run-all.sh) script. Otherwise, you can walk through each step below.

Each of the services write their logs to files found under the `logs` directory. You can run `tail -f logs/node-a.log`, for example, to watch the logs of Node A.

![overview](images/overview.svg)

## Prerequisites

- [Redis](https://redis.io/download)

## Running and Configuring the Nodes

The [`start-services.sh`](./start-services.sh) script runs a Redis instance and the two nodes, Node A and Node B.
@@ -2,6 +2,8 @@

# Insert accounts on Node A
# One account represents Alice and the other represents Node B's account with Node A
printf "Creating accounts:\n\n"

printf "Alice's account:\n"
curl \
-H "Content-Type: application/json" \
@@ -32,6 +34,4 @@ curl \
-d @./node-b/node-a.json \
http://localhost:8770/accounts

sleep 1

printf "\n\n"
printf "\n\nCreated accounts on both nodes\n\n"
@@ -1,5 +1,7 @@
#! /bin/bash

printf "Stopping Interledger nodes\n"

if lsof -Pi :6379 -sTCP:LISTEN -t >/dev/null ; then
redis-cli -p 6379 shutdown
fi
@@ -15,3 +17,5 @@ fi
if lsof -tPi :8770 ; then
kill `lsof -tPi :8770`
fi

printf "\n"

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
@@ -6,7 +6,7 @@
"http_incoming_token": "node-b",
"http_outgoing_token": "node-a",
"http_endpoint": "http://localhost:8770/ilp",
"min_balance": -1000,
"min_balance": -100000,
"routing_relation": "Peer",
"send_routes": true,
"receive_routes": true
@@ -6,7 +6,7 @@
"http_incoming_token": "node-a",
"http_outgoing_token": "node-b",
"http_endpoint": "http://localhost:7770/ilp",
"min_balance": -1000,
"min_balance": -100000,
"routing_relation": "Peer",
"send_routes": true,
"receive_routes": true
@@ -3,6 +3,9 @@
sh kill-services.sh
sh start-services.sh
sh create-accounts.sh
sleep 1
sh check-balances.sh
sh send-payment.sh
sh check-balances.sh
# Comment out the next command if you want to keep the services running
sh kill-services.sh
@@ -1,11 +1,14 @@
#!/bin/bash

printf "Building interledger.rs... (this may take a little while)\n"
cargo build --bins

# Create the logs directory if it doesn't already exist
mkdir -p logs

# Start Redis
redis-server --version > /dev/null || echo "Uh oh! You need to install redis-server before running this example"
redis-server --port 6379 &> logs/redis.log &
redis-server &> logs/redis.log &

# Turn on debug logging for all of the interledger.rs components and tower-web
export RUST_LOG=tower-web,interledger/.*
@@ -15,3 +18,5 @@ cargo run --package interledger -- node --config ./node-a/config.yml &> logs/nod
cargo run --package interledger -- node --config ./node-b/config.yml &> logs/node-b.log &

sleep 1

printf "The Interledger.rs nodes are up and running!\n\n"

0 comments on commit c50797c

Please sign in to comment.
You can’t perform that action at this time.