Skip to content

Commit

Permalink
Update Commercial Paper to v2.0 lifecycle
Browse files Browse the repository at this point in the history
- move to using the test-network
- updating README.md to include commands to use v2.0 lifecylce
- update Contracts and Applications to use 2.0 libraries

Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
  • Loading branch information
mbwhite committed Jan 29, 2020
1 parent 4f319ea commit 89a6d18
Show file tree
Hide file tree
Showing 35 changed files with 442 additions and 570 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
.project
# omit Go vendor directories
vendor/
.vscode
10 changes: 0 additions & 10 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion chaincode/abstore/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repositories {
}

dependencies {
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-beta.1'
implementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.+'
}

shadowJar {
Expand Down
4 changes: 2 additions & 2 deletions chaincode/fabcar/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ group 'org.hyperledger.fabric.samples'
version '1.0-SNAPSHOT'

dependencies {
compileOnly 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-beta.1'
compileOnly 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.+'
implementation 'com.owlike:genson:1.5'
testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.0-beta.1'
testImplementation 'org.hyperledger.fabric-chaincode-java:fabric-chaincode-shim:2.0.+'
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
testImplementation 'org.assertj:assertj-core:3.11.1'
testImplementation 'org.mockito:mockito-core:2.+'
Expand Down
81 changes: 70 additions & 11 deletions ci/commercialpaper-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,83 @@ steps:
- script: go test ./...
workingDirectory: commercial-paper/organization/digibank/contract-go
displayName: Go unit test digibank
- script: bash start.sh
workingDirectory: basic-network

- script: |
go mod vendor
workingDirectory: commercial-paper/organization/magnetocorp/contract-go
- script: |
go mod vendor
workingDirectory: commercial-paper/organization/digibank/contract-go
- script: |
echo $PATH
ls -l /usr/local/bin/peer
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
./network.sh down
./network.sh up createChannel -s couchdb -i 2.0.0-beta
# Copy the connection profiles so they are in the correct organizations.
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
workingDirectory: test-network
displayName: Start Fabric
env:
FABRIC_CFG_PATH: /usr/local/config
- script: |
docker-compose -f docker-compose.yml up -d cliMagnetoCorp
source <(../../roles/magnetocorp.sh)
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
peer lifecycle chaincode install cp.tar.gz
docker exec cliMagnetoCorp bash -c 'cd /opt/gopath/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go && go mod vendor'
export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id')
echo $PACKAGE_ID
docker exec cliMagnetoCorp peer lifecycle chaincode package cp.tar.gz --lang golang --path github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract-go --label cp_0
docker exec cliMagnetoCorp peer lifecycle chaincode install cp.tar.gz
export PACKAGE_ID=$(docker exec cliMagnetoCorp peer lifecycle chaincode queryinstalled 2>&1 | awk -F "[, ]+" '/Label: /{print $3}')
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel \
--name papercontract \
-v 0 \
--package-id $PACKAGE_ID \
--sequence 1 \
--tls \
--cafile $ORDERER_CA
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
workingDirectory: commercial-paper/organization/magnetocorp
displayName: Setup Commercial Paper contract
env:
FABRIC_CFG_PATH: /usr/local/config
- script: |
source <(../../roles/digibank.sh)
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
peer lifecycle chaincode install cp.tar.gz
export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id')
echo $PACKAGE_ID
docker exec cliMagnetoCorp peer lifecycle chaincode approveformyorg --channelID mychannel --name papercontract -v 0 --package-id $PACKAGE_ID --sequence 1 --signature-policy "AND ('Org1MSP.member')"
docker exec cliMagnetoCorp peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID mychannel --name papercontract -v 0 --sequence 1 --waitForEvent --signature-policy "AND ('Org1MSP.member')"
docker exec cliMagnetoCorp peer chaincode invoke -o orderer.example.com:7050 --channelID mychannel --name papercontract -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' --waitForEvent
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel \
--name papercontract \
-v 0 \
--package-id $PACKAGE_ID \
--sequence 1 \
--tls \
--cafile $ORDERER_CA
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
workingDirectory: commercial-paper/organization/magnetocorp/configuration/cli
peer lifecycle chaincode commit -o localhost:7050 \
--peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \
--peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \
--ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel --name papercontract -v 0 \
--sequence 1 \
--tls --cafile $ORDERER_CA --waitForEvent
workingDirectory: commercial-paper/organization/digibank
displayName: Setup Commercial Paper contract
env:
FABRIC_CFG_PATH: /usr/local/config
- script: retry -- npm install
workingDirectory: commercial-paper/organization/magnetocorp/application
Expand Down
79 changes: 68 additions & 11 deletions ci/commercialpaper-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,83 @@
#

steps:
- script: bash start.sh
workingDirectory: basic-network
displayName: Start Fabric
- script: |
./gradlew build
workingDirectory: commercial-paper/organization/digibank/contract-java
displayName: Build Java Contract
- script: |
docker-compose -f docker-compose.yml up -d cliDigiBank
./gradlew build
workingDirectory: commercial-paper/organization/magnetocorp/contract-java
displayName: Build Java Contract
- script: |
echo $PATH
ls -l /usr/local/bin/peer
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
./network.sh down
./network.sh up createChannel -s couchdb -i 2.0.0-beta
# Copy the connection profiles so they are in the correct organizations.
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
workingDirectory: test-network
displayName: Start Fabric
env:
FABRIC_CFG_PATH: /usr/local/config
- script: |
source <(../../roles/magnetocorp.sh)
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
peer lifecycle chaincode install cp.tar.gz
export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id')
echo $PACKAGE_ID
docker exec cliDigiBank peer lifecycle chaincode package cp.tar.gz --lang java --path /opt/gopath/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/digibank/contract-java/build/libs --label cp_0
docker exec cliDigiBank peer lifecycle chaincode install cp.tar.gz
export PACKAGE_ID=$(docker exec cliDigiBank peer lifecycle chaincode queryinstalled 2>&1 | awk -F "[, ]+" '/Label: /{print $3}')
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel \
--name papercontract \
-v 0 \
--package-id $PACKAGE_ID \
--sequence 1 \
--tls \
--cafile $ORDERER_CA
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
workingDirectory: commercial-paper/organization/magnetocorp
displayName: Setup Commercial Paper contract
env:
FABRIC_CFG_PATH: /usr/local/config
- script: |
source <(../../roles/digibank.sh)
peer lifecycle chaincode package cp.tar.gz --lang java --path ./contract-java --label cp_0
peer lifecycle chaincode install cp.tar.gz
docker exec cliDigiBank peer lifecycle chaincode approveformyorg --channelID mychannel --name papercontract -v 0 --package-id $PACKAGE_ID --sequence 1 --signature-policy "AND ('Org1MSP.member')"
docker exec cliDigiBank peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID mychannel --name papercontract -v 0 --sequence 1 --waitForEvent --signature-policy "AND ('Org1MSP.member')"
docker exec cliDigiBank peer chaincode invoke -o orderer.example.com:7050 --channelID mychannel --name papercontract -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' --waitForEvent
export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id')
echo $PACKAGE_ID
workingDirectory: commercial-paper/organization/digibank/configuration/cli
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel \
--name papercontract \
-v 0 \
--package-id $PACKAGE_ID \
--sequence 1 \
--tls \
--cafile $ORDERER_CA
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
peer lifecycle chaincode commit -o localhost:7050 \
--peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \
--peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \
--ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel --name papercontract -v 0 \
--sequence 1 \
--tls --cafile $ORDERER_CA --waitForEvent
workingDirectory: commercial-paper/organization/digibank
displayName: Setup Commercial Paper contract
env:
FABRIC_CFG_PATH: /usr/local/config
- script: retry -- npm install
workingDirectory: commercial-paper/organization/magnetocorp/application
Expand Down
72 changes: 61 additions & 11 deletions ci/commercialpaper-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,73 @@
#

steps:
- script: bash start.sh
workingDirectory: basic-network
displayName: Start Fabric
- script: |
docker-compose -f docker-compose.yml up -d cliMagnetoCorp
echo $PATH
ls -l /usr/local/bin/peer
sudo tar xzvf /tmp/hyperledger-fabric-linux-amd64-latest.tar.gz -C ..
./network.sh down
./network.sh up createChannel -s couchdb -i 2.0.0-beta
docker exec cliMagnetoCorp peer lifecycle chaincode package cp.tar.gz --lang node --path /opt/gopath/src/github.com/hyperledger/fabric-samples/commercial-paper/organization/magnetocorp/contract --label cp_0
docker exec cliMagnetoCorp peer lifecycle chaincode install cp.tar.gz
export PACKAGE_ID=$(docker exec cliMagnetoCorp peer lifecycle chaincode queryinstalled 2>&1 | awk -F "[, ]+" '/Label: /{print $3}')
# Copy the connection profiles so they are in the correct organizations.
cp "./organizations/peerOrganizations/org1.example.com/connection-org1.yaml" "../commercial-paper/organization/digibank/gateway/"
cp "./organizations/peerOrganizations/org2.example.com/connection-org2.yaml" "../commercial-paper/organization/magnetocorp/gateway/"
workingDirectory: test-network
displayName: Start Fabric
env:
FABRIC_CFG_PATH: /usr/local/config
- script: |
source <(../../roles/magnetocorp.sh)
peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0
peer lifecycle chaincode install cp.tar.gz
docker exec cliMagnetoCorp peer lifecycle chaincode approveformyorg --channelID mychannel --name papercontract -v 0 --package-id $PACKAGE_ID --sequence 1 --signature-policy "AND ('Org1MSP.member')"
docker exec cliMagnetoCorp peer lifecycle chaincode commit -o orderer.example.com:7050 --channelID mychannel --name papercontract -v 0 --sequence 1 --waitForEvent --signature-policy "AND ('Org1MSP.member')"
docker exec cliMagnetoCorp peer chaincode invoke -o orderer.example.com:7050 --channelID mychannel --name papercontract -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' --waitForEvent
export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id')
echo $PACKAGE_ID
workingDirectory: commercial-paper/organization/magnetocorp/configuration/cli
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel \
--name papercontract \
-v 0 \
--package-id $PACKAGE_ID \
--sequence 1 \
--tls \
--cafile $ORDERER_CA
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
workingDirectory: commercial-paper/organization/magnetocorp
displayName: Setup Commercial Paper contract
env:
FABRIC_CFG_PATH: /usr/local/config
- script: |
source <(../../roles/digibank.sh)
peer lifecycle chaincode package cp.tar.gz --lang node --path ./contract --label cp_0
peer lifecycle chaincode install cp.tar.gz
export PACKAGE_ID=$(peer lifecycle chaincode queryinstalled --output json | jq -r '.installed_chaincodes[0].package_id')
echo $PACKAGE_ID
peer lifecycle chaincode approveformyorg --orderer localhost:7050 --ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel \
--name papercontract \
-v 0 \
--package-id $PACKAGE_ID \
--sequence 1 \
--tls \
--cafile $ORDERER_CA
peer lifecycle chaincode checkcommitreadiness --channelID mychannel --name papercontract -v 0 --sequence 1
peer lifecycle chaincode commit -o localhost:7050 \
--peerAddresses localhost:7051 --tlsRootCertFiles ${PEER0_ORG1_CA} \
--peerAddresses localhost:9051 --tlsRootCertFiles ${PEER0_ORG2_CA} \
--ordererTLSHostnameOverride orderer.example.com \
--channelID mychannel --name papercontract -v 0 \
--sequence 1 \
--tls --cafile $ORDERER_CA --waitForEvent
workingDirectory: commercial-paper/organization/digibank
displayName: Setup Commercial Paper contract
env:
FABRIC_CFG_PATH: /usr/local/config
- script: retry -- npm install
workingDirectory: commercial-paper/organization/magnetocorp/application
displayName: Install Magnetocorp application
Expand Down
6 changes: 5 additions & 1 deletion commercial-paper/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
cp.tar.gz
cp.tar.gz

**/.gradle
**/gateway/connection-org1.yaml
**/gateway/connection-org2.yaml
Loading

0 comments on commit 89a6d18

Please sign in to comment.