diff --git a/chaincode-docker-devmode/.gitignore b/chaincode-docker-devmode/.gitignore index 699c14a5a0..3bb4c8e84c 100644 --- a/chaincode-docker-devmode/.gitignore +++ b/chaincode-docker-devmode/.gitignore @@ -1,3 +1,3 @@ /myc.block -/chaincode/sacc/sacc -/chaincode/chaincode_example02/chaincode_example02 +/chaincode/sacc/go/sacc +/chaincode/abstore/go/abstore diff --git a/chaincode-docker-devmode/README.rst b/chaincode-docker-devmode/README.rst index 91bccb3031..aa57190b7f 100644 --- a/chaincode-docker-devmode/README.rst +++ b/chaincode-docker-devmode/README.rst @@ -86,14 +86,14 @@ Now, compile your chaincode: .. code:: bash - cd chaincode_example02/go - go build -o chaincode_example02 + cd abstore/go + go build -o abstore Now run the chaincode: .. code:: bash - CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./chaincode_example02 + CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./abstore The chaincode is started with peer and chaincode logs indicating successful registration with the peer. Note that at this stage the chaincode is not associated with any channel. This is done in subsequent steps @@ -114,7 +114,7 @@ We'll leverage the CLI container to drive these calls. .. code:: bash - peer chaincode install -p chaincodedev/chaincode/chaincode_example02/go -n mycc -v 0 + peer chaincode install -p chaincodedev/chaincode/abstore/go -n mycc -v 0 peer chaincode instantiate -n mycc -v 0 -c '{"Args":["init","a","100","b","200"]}' -C myc Now issue an invoke to move ``10`` from ``a`` to ``b``. @@ -132,7 +132,7 @@ Finally, query ``a``. We should see a value of ``90``. Testing new chaincode --------------------- -By default, we mount only ``chaincode_example02``. However, you can easily test different +By default, we mount only ``abstore``. However, you can easily test different chaincodes by adding them to the ``chaincode`` subdirectory and relaunching your network. At this point they will be accessible in your ``chaincode`` container. diff --git a/chaincode-docker-devmode/docker-compose-simple.yaml b/chaincode-docker-devmode/docker-compose-simple.yaml index 725a3eaf8c..0d2ea71e3b 100644 --- a/chaincode-docker-devmode/docker-compose-simple.yaml +++ b/chaincode-docker-devmode/docker-compose-simple.yaml @@ -73,7 +73,7 @@ services: - GOPATH=/opt/gopath - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock - FABRIC_LOGGING_SPEC=DEBUG - - CORE_PEER_ID=example02 + - CORE_PEER_ID=abstore - CORE_PEER_ADDRESS=peer:7051 - CORE_PEER_LOCALMSPID=DEFAULT - CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp diff --git a/chaincode/chaincode_example02/go/chaincode_example02.go b/chaincode/abstore/go/abstore.go similarity index 80% rename from chaincode/chaincode_example02/go/chaincode_example02.go rename to chaincode/abstore/go/abstore.go index 5343806643..6b64d57782 100644 --- a/chaincode/chaincode_example02/go/chaincode_example02.go +++ b/chaincode/abstore/go/abstore.go @@ -16,12 +16,6 @@ limitations under the License. package main -//WARNING - this chaincode's ID is hard-coded in chaincode_example04 to illustrate one way of -//calling chaincode from a chaincode. If this example is modified, chaincode_example04.go has -//to be modified as well with the new ID of chaincode_example02. -//chaincode_example05 show's how chaincode ID can be passed in as a parameter instead of -//hard-coding. - import ( "fmt" "strconv" @@ -30,12 +24,12 @@ import ( pb "github.com/hyperledger/fabric/protos/peer" ) -// SimpleChaincode example simple Chaincode implementation -type SimpleChaincode struct { +// ABstore Chaincode implementation +type ABstore struct { } -func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response { - fmt.Println("ex02 Init") +func (t *ABstore) Init(stub shim.ChaincodeStubInterface) pb.Response { + fmt.Println("ABstore Init") _, args := stub.GetFunctionAndParameters() var A, B string // Entities var Aval, Bval int // Asset holdings @@ -72,8 +66,8 @@ func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response { return shim.Success(nil) } -func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response { - fmt.Println("ex02 Invoke") +func (t *ABstore) Invoke(stub shim.ChaincodeStubInterface) pb.Response { + fmt.Println("ABstore Invoke") function, args := stub.GetFunctionAndParameters() if function == "invoke" { // Make payment of X units from A to B @@ -90,7 +84,7 @@ func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response { } // Transaction makes payment of X units from A to B -func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response { +func (t *ABstore) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response { var A, B string // Entities var Aval, Bval int // Asset holdings var X int // Transaction value @@ -147,7 +141,7 @@ func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string } // Deletes an entity from state -func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response { +func (t *ABstore) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response { if len(args) != 1 { return shim.Error("Incorrect number of arguments. Expecting 1") } @@ -164,7 +158,7 @@ func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string } // query callback representing the query of a chaincode -func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response { +func (t *ABstore) query(stub shim.ChaincodeStubInterface, args []string) pb.Response { var A string // Entities var err error @@ -192,8 +186,8 @@ func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) } func main() { - err := shim.Start(new(SimpleChaincode)) + err := shim.Start(new(ABstore)) if err != nil { - fmt.Printf("Error starting Simple chaincode: %s", err) + fmt.Printf("Error starting ABstore chaincode: %s", err) } } diff --git a/chaincode/chaincode_example02/java/build.gradle b/chaincode/abstore/java/build.gradle similarity index 88% rename from chaincode/chaincode_example02/java/build.gradle rename to chaincode/abstore/java/build.gradle index 5221272c1e..0f02f85fbe 100644 --- a/chaincode/chaincode_example02/java/build.gradle +++ b/chaincode/abstore/java/build.gradle @@ -29,6 +29,6 @@ shadowJar { classifier = null manifest { - attributes 'Main-Class': 'org.hyperledger.fabric.example.SimpleChaincode' + attributes 'Main-Class': 'org.hyperledger.fabric_samples.ABstore' } } diff --git a/chaincode/chaincode_example02/java/settings.gradle b/chaincode/abstore/java/settings.gradle similarity index 100% rename from chaincode/chaincode_example02/java/settings.gradle rename to chaincode/abstore/java/settings.gradle diff --git a/chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java b/chaincode/abstore/java/src/main/java/org/hyperledger/fabric-samples/ABstore.java similarity index 96% rename from chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java rename to chaincode/abstore/java/src/main/java/org/hyperledger/fabric-samples/ABstore.java index dd93a4e06f..e7cfd3d135 100644 --- a/chaincode/chaincode_example02/java/src/main/java/org/hyperledger/fabric/example/SimpleChaincode.java +++ b/chaincode/abstore/java/src/main/java/org/hyperledger/fabric-samples/ABstore.java @@ -3,7 +3,7 @@ SPDX-License-Identifier: Apache-2.0 */ -package org.hyperledger.fabric.example; +package org.hyperledger.fabric_samples; import java.util.List; @@ -16,9 +16,9 @@ import static java.nio.charset.StandardCharsets.UTF_8; -public class SimpleChaincode extends ChaincodeBase { +public class ABstore extends ChaincodeBase { - private static Log _logger = LogFactory.getLog(SimpleChaincode.class); + private static Log _logger = LogFactory.getLog(ABstore.class); @Override public Response init(ChaincodeStub stub) { @@ -136,7 +136,7 @@ private Response query(ChaincodeStub stub, List args) { public static void main(String[] args) { System.out.println("OpenSSL avaliable: " + OpenSsl.isAvailable()); - new SimpleChaincode().start(args); + new ABstore().start(args); } } diff --git a/chaincode/chaincode_example02/node/chaincode_example02.js b/chaincode/abstore/node/abstore.js similarity index 96% rename from chaincode/chaincode_example02/node/chaincode_example02.js rename to chaincode/abstore/node/abstore.js index 545092aff0..adcfdd9c78 100644 --- a/chaincode/chaincode_example02/node/chaincode_example02.js +++ b/chaincode/abstore/node/abstore.js @@ -7,11 +7,11 @@ const shim = require('fabric-shim'); const util = require('util'); -var Chaincode = class { +var ABstore = class { // Initialize the chaincode async Init(stub) { - console.info('========= example02 Init ========='); + console.info('========= ABstore Init ========='); let ret = stub.getFunctionAndParameters(); console.info(ret); let args = ret.params; @@ -135,4 +135,4 @@ var Chaincode = class { } }; -shim.start(new Chaincode()); +shim.start(new ABstore()); diff --git a/chaincode/chaincode_example02/node/package.json b/chaincode/abstore/node/package.json similarity index 53% rename from chaincode/chaincode_example02/node/package.json rename to chaincode/abstore/node/package.json index 9a4ab4077d..e38c4e0728 100644 --- a/chaincode/chaincode_example02/node/package.json +++ b/chaincode/abstore/node/package.json @@ -1,12 +1,14 @@ { - "name": "chaincode_example02", + "name": "abstore", "version": "1.0.0", - "description": "chaincode_example02 chaincode implemented in node.js", + "description": "ABstore chaincode implemented in node.js", "engines": { "node": ">=8.4.0", "npm": ">=5.3.0" }, - "scripts": { "start" : "node chaincode_example02.js" }, + "scripts": { + "start": "node abstore.js" + }, "engine-strict": true, "license": "Apache-2.0", "dependencies": { diff --git a/commercial-paper/organization/digibank/gateway/papernetConnection.yaml b/commercial-paper/organization/digibank/gateway/papernetConnection.yaml index 7fc4028316..79036af6e7 100644 --- a/commercial-paper/organization/digibank/gateway/papernetConnection.yaml +++ b/commercial-paper/organization/digibank/gateway/papernetConnection.yaml @@ -100,7 +100,7 @@ channels: # this list with the query results of getInstalledChaincodes() and getInstantiatedChaincodes() chaincodes: # the format follows the "cannonical name" of chaincodes by fabric code - - example02:v1 + - abstore:v1 - marbles:1.0 # @@ -222,4 +222,4 @@ certificateAuthorities: - enrollId: admin enrollSecret: adminpw # [Optional] The optional name of the CA. - caName: ca-digibank \ No newline at end of file + caName: ca-digibank diff --git a/commercial-paper/organization/magnetocorp/gateway/papernetConnection.yaml b/commercial-paper/organization/magnetocorp/gateway/papernetConnection.yaml index 7fc4028316..79036af6e7 100644 --- a/commercial-paper/organization/magnetocorp/gateway/papernetConnection.yaml +++ b/commercial-paper/organization/magnetocorp/gateway/papernetConnection.yaml @@ -100,7 +100,7 @@ channels: # this list with the query results of getInstalledChaincodes() and getInstantiatedChaincodes() chaincodes: # the format follows the "cannonical name" of chaincodes by fabric code - - example02:v1 + - abstore:v1 - marbles:1.0 # @@ -222,4 +222,4 @@ certificateAuthorities: - enrollId: admin enrollSecret: adminpw # [Optional] The optional name of the CA. - caName: ca-digibank \ No newline at end of file + caName: ca-digibank diff --git a/first-network/scripts/script.sh b/first-network/scripts/script.sh index 664dfba8f4..53259e3cdf 100755 --- a/first-network/scripts/script.sh +++ b/first-network/scripts/script.sh @@ -23,13 +23,12 @@ LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=10 -CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/" if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/" -fi - -if [ "$LANGUAGE" = "java" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/java/" + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" +elif [ "$LANGUAGE" = "java" ]; then + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" fi echo "Channel name : "$CHANNEL_NAME diff --git a/first-network/scripts/step1org3.sh b/first-network/scripts/step1org3.sh index 94e9d00548..5caac6561d 100755 --- a/first-network/scripts/step1org3.sh +++ b/first-network/scripts/step1org3.sh @@ -25,9 +25,12 @@ LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/" if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/" + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" +elif [ "$LANGUAGE" = "java" ]; then + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" fi # import utils diff --git a/first-network/scripts/step2org3.sh b/first-network/scripts/step2org3.sh index 734a0d7cdf..c0a8d8d160 100755 --- a/first-network/scripts/step2org3.sh +++ b/first-network/scripts/step2org3.sh @@ -28,9 +28,12 @@ LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/" if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/" + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" +elif [ "$LANGUAGE" = "java" ]; then + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" fi # import utils diff --git a/first-network/scripts/step3org3.sh b/first-network/scripts/step3org3.sh index 6a3ac3d567..381af51a5f 100755 --- a/first-network/scripts/step3org3.sh +++ b/first-network/scripts/step3org3.sh @@ -29,9 +29,12 @@ LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/" if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/" + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" +elif [ "$LANGUAGE" = "java" ]; then + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" fi # import utils diff --git a/first-network/scripts/testorg3.sh b/first-network/scripts/testorg3.sh index e7a396de7f..dd87675801 100755 --- a/first-network/scripts/testorg3.sh +++ b/first-network/scripts/testorg3.sh @@ -33,9 +33,12 @@ LANGUAGE=`echo "$LANGUAGE" | tr [:upper:] [:lower:]` COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/" if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/" + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" +elif [ "$LANGUAGE" = "java" ]; then + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" fi echo "Channel name : "$CHANNEL_NAME diff --git a/first-network/scripts/upgrade_to_v14.sh b/first-network/scripts/upgrade_to_v14.sh index fc671ac2a8..751f111f33 100755 --- a/first-network/scripts/upgrade_to_v14.sh +++ b/first-network/scripts/upgrade_to_v14.sh @@ -23,9 +23,12 @@ LANGUAGE=$(echo "$LANGUAGE" | tr [:upper:] [:lower:]) COUNTER=1 MAX_RETRY=5 -CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/go/" if [ "$LANGUAGE" = "node" ]; then - CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/chaincode_example02/node/" + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/node/" +elif [ "$LANGUAGE" = "java" ]; then + CC_SRC_PATH="/opt/gopath/src/github.com/hyperledger/fabric-samples/chaincode/abstore/java/" +else + CC_SRC_PATH="github.com/hyperledger/fabric-samples/chaincode/abstore/go/" fi echo "Channel name : "$CHANNEL_NAME