Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MCLDG committed Nov 24, 2018
1 parent a15937f commit 15d10d8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 28 deletions.
10 changes: 5 additions & 5 deletions ngo-chaincode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If the file has values for all keys, source it:
source ~/peer-exports.sh
```

## Step 1 - copy the chaincode into the CLI container
## Step 1 - Copy the chaincode into the CLI container

The Fabric CLI container that is running on your Fabric client node (do `docker ps` to see it)
mounts a folder from the Fabric client node EC2 instance: /home/ec2-user/fabric-samples/chaincode.
Expand All @@ -57,7 +57,7 @@ mkdir -p ./fabric-samples/chaincode/ngo
cp ./non-profit-blockchain/ngo-chaincode/src/* ./fabric-samples/chaincode/ngo
```

## Step 2 - install the chaincode on your peer
## Step 2 - Install the chaincode on your peer

Notice we are using the `-l node` flag, as our chaincode is written in Node.js.

Expand All @@ -74,7 +74,7 @@ Expected response:
2018-11-15 06:39:47.636 UTC [chaincodeCmd] install -> INFO 004 Installed remotely response:<status:200 payload:"OK" >
```

## Step 3 - instantiate the chaincode on the channel
## Step 3 - Instantiate the chaincode on the channel

```
docker exec -e "CORE_PEER_TLS_ENABLED=true" -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/home/taiga-tls.pem" -e "CORE_PEER_LOCALMSPID=$MSP" -e "CORE_PEER_MSPCONFIGPATH=$MSP_PATH" -e "CORE_PEER_ADDRESS=$PEER" cli peer chaincode instantiate -o $ORDERER -C mychannel -n ngo -v v0 -c '{"Args":["init"]}' --cafile /opt/home/taiga-tls.pem --tls
Expand All @@ -89,7 +89,7 @@ instantiated once on a channel)
2018-11-15 06:41:02.847 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
```

## Step 4 - query the chaincode
## Step 4 - Query the chaincode

Query all donors
```
Expand All @@ -101,7 +101,7 @@ Query a specific donor
docker exec -e "CORE_PEER_TLS_ENABLED=true" -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/home/taiga-tls.pem" -e "CORE_PEER_ADDRESS=$PEER" -e "CORE_PEER_LOCALMSPID=$MSP" -e "CORE_PEER_MSPCONFIGPATH=$MSP_PATH" cli peer chaincode query -C mychannel -n ngo -c '{"Args":["queryDonor","{\"donorUserName\": \"edge\"}"]}'
```

## Step 5 - invoke a transaction
## Step 5 - Invoke a transaction

```
docker exec -e "CORE_PEER_TLS_ENABLED=true" -e "CORE_PEER_TLS_ROOTCERT_FILE=/opt/home/taiga-tls.pem" -e "CORE_PEER_ADDRESS=$PEER" -e "CORE_PEER_LOCALMSPID=$MSP" -e "CORE_PEER_MSPCONFIGPATH=$MSP_PATH" cli peer chaincode invoke -C mychannel -n ngo -c '{"Args":["createDonor","{\"donorUserName\": \"edge\", \"email\": \"[email protected]\", \"registeredDate\": \"2018-10-22T11:52:20.182Z\"}"]}' -o $ORDERER --cafile /opt/home/taiga-tls.pem --tls
Expand Down
22 changes: 11 additions & 11 deletions ngo-fabric/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ In the AWS Managed Blockchain Console: https://console.aws.amazon.com/managedblo

We'll continue with the next steps while we wait for the peer node to become HEALTHY.

## Step 3 - create the Fabric client node
## Step 3 - Create the Fabric client node
In your Cloud9 terminal window.

Create the Fabric client node, which will host the Fabric CLI. You will use the CLI to administer
Expand Down Expand Up @@ -96,7 +96,7 @@ cd ~/non-profit-blockchain/ngo-fabric

Check the progress in the AWS CloudFormation console.

## Step 4 - prepare the Fabric client node and enroll and identity
## Step 4 - Prepare the Fabric client node and enroll and identity
On the Fabric client node.

Prior to executing any commands in the Fabric client node, you will need to export ENV variables
Expand Down Expand Up @@ -127,7 +127,7 @@ vi fabric-exports.sh
```

Update the export statements at the top of the file. The info you need either matches what you
entered when creating the Fabric network in [Part 1.](../ngo-fabric/README.md), or can be found
entered when creating the Fabric network in [Part 1](../ngo-fabric/README.md), or can be found
in the AWS Managed Blockchain Console, under your network.

Source the file, so the exports are applied to your current session. If you exit the SSH
Expand Down Expand Up @@ -171,7 +171,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./4-enroll-member-admin.sh
```

## Step 5 - update the configtx channel configuration
## Step 5 - Update the configtx channel configuration
On the Fabric client node.

Update the configtx channel configuration. The Name and ID fields should be updated with the member ID.
Expand Down Expand Up @@ -204,7 +204,7 @@ Check that the channel configuration has been generated:
ls -lt ~/$CHANNEL.pb
```

## Step 6 - create a Fabric channel
## Step 6 - Create a Fabric channel
On the Fabric client node.

Create a Fabric channel.
Expand All @@ -216,7 +216,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./6-channel.sh
```

## Step 7 - join your peer node to the channel
## Step 7 - Join your peer node to the channel
On the Fabric client node.

Join peer to Fabric channel.
Expand All @@ -228,7 +228,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./7-join.sh
```

## Step 8 - install chaincode on your peer node
## Step 8 - Install chaincode on your peer node
On the Fabric client node.

Install chaincode on Fabric peer.
Expand All @@ -240,7 +240,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./8-install.sh
```

## Step 9 - instantiate the chaincode on the channel
## Step 9 - Instantiate the chaincode on the channel
On the Fabric client node.

Instantiate chaincode on Fabric channel.
Expand All @@ -252,7 +252,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./9-instantiate.sh
```

## Step 10 - query the chaincode
## Step 10 - Query the chaincode
On the Fabric client node.

Query the chaincode on Fabric peer.
Expand All @@ -264,7 +264,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./10-query.sh
```

## Step 11 - invoke a transaction
## Step 11 - Invoke a transaction
On the Fabric client node.

Invoke a Fabric transaction.
Expand All @@ -276,7 +276,7 @@ cd ~/non-profit-blockchain/ngo-fabric
./11-invoke.sh
```

## Step 10 - query the chaincode again and check the change in value
## Step 10 - Query the chaincode again and check the change in value
On the Fabric client node.

Query the chaincode on Fabric peer and check the change in value.
Expand Down
12 changes: 6 additions & 6 deletions ngo-rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cd ~
git clone https://github.com/aws-samples/non-profit-blockchain.git
```

## Step 1 - install Node
## Step 1 - Install Node
On the Fabric client node.

Install Node.js. We will use v8.x.
Expand All @@ -43,15 +43,15 @@ Amazon Linux seems to be missing g++, so:
sudo yum install gcc-c++ -y
```

## Step 2 - install dependencies
## Step 2 - Install dependencies
On the Fabric client node.

```
cd ~/non-profit-blockchain/ngo-rest-api
npm install
```

## Step 3 - generate a connection profile
## Step 3 - Generate a connection profile
On the Fabric client node.

The REST API needs a connection profile to connect to the Fabric network. Connection profiles describe
Expand Down Expand Up @@ -131,7 +131,7 @@ config.json should look something like this:
}
```

## Step 4 - run the REST API Node.js application
## Step 4 - Run the REST API Node.js application
On the Fabric client node.

Run the app (in the background if you prefer):
Expand All @@ -142,7 +142,7 @@ nvm use lts/carbon
node app.js &
```

## Step 5 - test the REST API
## Step 5 - Test the REST API
On the Fabric client node.

Once the app is running you can register an identity, and then start to execute chaincode
Expand Down Expand Up @@ -190,7 +190,7 @@ response:
{"docType":"donor","donorUserName":"edge","email":"[email protected]","registeredDate":"2018-10-22T11:52:20.182Z"}
]
```
## Step 6 - load the workshop test data
## Step 6 - Load the workshop test data

Loading the test data uses cURL commands similar to those you used above to test the API. You can
use the same endpoint (i.e. localhost), since you will load the test data from the Fabric client node,
Expand Down
16 changes: 10 additions & 6 deletions ngo-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cd ~
git clone https://github.com/aws-samples/non-profit-blockchain.git
```

## Step 1 - install Node
## Step 1 - Install Node
On Cloud9.

Install Node.js. We will use v8.x.
Expand All @@ -50,14 +50,14 @@ nvm install lts/carbon
nvm use lts/carbon
```

## Step 2 - install dependencies
## Step 2 - Install dependencies

```
cd ~/non-profit-blockchain/ngo-ui
npm i
```

## Step 3 - point the Node.js application to your REST API
## Step 3 - Point the Node.js application to your REST API

Your REST API is exposed via an AWS Elastic Load Balancer (ELB). The ELB was created for you
by CloudFormation in [Part 1.](../ngo-fabric/README.md). You can find the DNS endpoint for the ELB in
Expand All @@ -76,7 +76,7 @@ The values to be changed are as follows. The trailing backslash is important for
socket_url: 'ws://ngo10-elb-2090058053.us-east-1.elb.amazonaws.com'
```

## Step 4 - start the application
## Step 4 - Start the application

```
cd ~/non-profit-blockchain/ngo-ui
Expand All @@ -94,7 +94,7 @@ In Cloud9, navigate to the Cloud9 menu and click Preview->Preview Running Applic
the UI login page in a pane in the Cloud9 IDE. You can expand this out to your browser by clicking the
icon next to the URL in the preview pane.

## Step 5 - register a user in the application
## Step 5 - Register a user in the application
Registering a user is necessary before you carry out any tasks in the UI application. User registration
will call the Fabric CA and enroll a new user. This user will then be used to invoke transactions and
execute queries against the Fabric network. You can register a new user in the UI application. The link
Expand All @@ -108,7 +108,11 @@ into the network, such as [this one](../ngo-rest-api/ngo-load-workshop.sh)
You could also query the chaincode directly and see the same information. You query the chaincode from
the Fabric client node. An example of how to query the chaincode can be found in [this script](../ngo-chaincode/test-chaincode-aws.sh)

## Step 6 - pat yourself on the back, you've completed the workshop
## Step 6 - Pat yourself on the back, you've completed the workshop
You have successfully built a Hyperledger Fabric network using the AWS Managed Blockchain service, deployed
chaincode to the service, connected a RESTful API to the service and deployed an Angular application that
communicates with the RESTful API.

The workshop instructions can be found in the README files in parts 1-4:

* [Part 1:](../ngo-fabric/README.md) Start the workshop by building the AWS Managed Blockchain Hyperledger Fabric network.
Expand Down

0 comments on commit 15d10d8

Please sign in to comment.