apps user 7 năm trước cách đây
commit
1d6e2ee6ca
60 tập tin đã thay đổi với 3141 bổ sung0 xóa
  1. 1 0
      .gitignore
  2. 173 0
      configtx.yaml
  3. BIN
      crypto/orderer/channel.tx
  4. 10 0
      crypto/orderer/localMspConfig/admincerts/ordererOrg0.pem
  5. 10 0
      crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
  6. 5 0
      crypto/orderer/localMspConfig/keystore/ordererSigner.pem
  7. 10 0
      crypto/orderer/localMspConfig/signcerts/orderer0Signer.pem
  8. BIN
      crypto/orderer/orderer.block
  9. 10 0
      crypto/peer/peer0/localMspConfig/admincerts/peerOrg0.pem
  10. 10 0
      crypto/peer/peer0/localMspConfig/admincerts/peerOrg1.pem
  11. 10 0
      crypto/peer/peer0/localMspConfig/admincerts/peerOrg2.pem
  12. 10 0
      crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem
  13. 10 0
      crypto/peer/peer0/localMspConfig/cacerts/peerOrg1.pem
  14. 10 0
      crypto/peer/peer0/localMspConfig/cacerts/peerOrg2.pem
  15. 5 0
      crypto/peer/peer0/localMspConfig/keystore/peer0Signer.pem
  16. 10 0
      crypto/peer/peer0/localMspConfig/signcerts/peer0Signer.pem
  17. 10 0
      crypto/peer/peer1/localMspConfig/admincerts/peerOrg0.pem
  18. 10 0
      crypto/peer/peer1/localMspConfig/admincerts/peerOrg1.pem
  19. 10 0
      crypto/peer/peer1/localMspConfig/admincerts/peerOrg2.pem
  20. 10 0
      crypto/peer/peer1/localMspConfig/cacerts/peerOrg0.pem
  21. 10 0
      crypto/peer/peer1/localMspConfig/cacerts/peerOrg1.pem
  22. 10 0
      crypto/peer/peer1/localMspConfig/cacerts/peerOrg2.pem
  23. 5 0
      crypto/peer/peer1/localMspConfig/keystore/peer1Signer.pem
  24. 10 0
      crypto/peer/peer1/localMspConfig/signcerts/peer1Signer.pem
  25. 10 0
      crypto/peer/peer2/localMspConfig/admincerts/peerOrg0.pem
  26. 10 0
      crypto/peer/peer2/localMspConfig/admincerts/peerOrg1.pem
  27. 10 0
      crypto/peer/peer2/localMspConfig/admincerts/peerOrg2.pem
  28. 10 0
      crypto/peer/peer2/localMspConfig/cacerts/peerOrg0.pem
  29. 10 0
      crypto/peer/peer2/localMspConfig/cacerts/peerOrg1.pem
  30. 10 0
      crypto/peer/peer2/localMspConfig/cacerts/peerOrg2.pem
  31. 5 0
      crypto/peer/peer2/localMspConfig/keystore/peer2Signer.pem
  32. 10 0
      crypto/peer/peer2/localMspConfig/signcerts/peer2Signer.pem
  33. 10 0
      crypto/peer/peer3/localMspConfig/admincerts/peerOrg0.pem
  34. 10 0
      crypto/peer/peer3/localMspConfig/admincerts/peerOrg1.pem
  35. 10 0
      crypto/peer/peer3/localMspConfig/admincerts/peerOrg2.pem
  36. 10 0
      crypto/peer/peer3/localMspConfig/cacerts/peerOrg0.pem
  37. 10 0
      crypto/peer/peer3/localMspConfig/cacerts/peerOrg1.pem
  38. 10 0
      crypto/peer/peer3/localMspConfig/cacerts/peerOrg2.pem
  39. 5 0
      crypto/peer/peer3/localMspConfig/keystore/peer3Signer.pem
  40. 10 0
      crypto/peer/peer3/localMspConfig/signcerts/peer3Signer.pem
  41. BIN
      docker-compose
  42. 47 0
      docker-compose-cli.yaml
  43. 26 0
      docker-compose-orderer0.yaml
  44. 45 0
      docker-compose-peer0.yaml
  45. 49 0
      docker-compose-peer1.yaml
  46. 51 0
      docker-compose-peer2.yaml
  47. 53 0
      docker-compose-peer3.yaml
  48. 213 0
      docker-compose.yaml
  49. 72 0
      download-dockerimages.sh
  50. 841 0
      end-to-end.rst
  51. 199 0
      examples/chaincode/go/chaincode_example02/chaincode_example02.go
  52. 328 0
      examples/chaincode/go/chaincode_meidi/chaincode_meidi.go
  53. 30 0
      generateCfgTrx.sh
  54. 76 0
      network_setup.sh
  55. 109 0
      pack.sh
  56. 18 0
      peer-base/peer-base-no-tls.yaml
  57. 24 0
      peer-base/peer-base.yaml
  58. 178 0
      scripts/script.sh
  59. 178 0
      scripts/script.sh_bak
  60. 95 0
      setup.sh

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+meidi_*.tar.gz

+ 173 - 0
configtx.yaml

@@ -0,0 +1,173 @@
+---
+################################################################################
+#
+#   Profile
+#
+#   - Different configuration profiles may be encoded here to be specified
+#   as parameters to the configtxgen tool
+#
+################################################################################
+Profiles:
+
+    TwoOrgs:
+        Orderer:
+            <<: *OrdererDefaults
+            Organizations:
+                - *OrdererOrg
+        Application:
+            <<: *ApplicationDefaults
+            Organizations:
+                - *Org0
+                - *Org1
+
+################################################################################
+#
+#   Section: Organizations
+#
+#   - This section defines the different organizational identities which will
+#   be referenced later in the configuration.
+#
+################################################################################
+Organizations:
+
+    # SampleOrg defines an MSP using the sampleconfig.  It should never be used
+    # in production but may be used as a template for other definitions
+    - &OrdererOrg
+        # DefaultOrg defines the organization which is used in the sampleconfig
+        # of the fabric.git development environment
+        Name: OrdererOrg
+
+        # ID to load the MSP definition as
+        ID: OrdererMSP
+
+        # MSPDir is the filesystem path which contains the MSP configuration
+        MSPDir: examples/e2e_cli/crypto/orderer/localMspConfig
+
+        # BCCSP (Blockchain crypto provider): Select which crypto implementation or
+        # library to use
+        BCCSP:
+            Default: SW
+            SW:
+                Hash: SHA2
+                Security: 256
+                # Location of Key Store. If this is unset, a location will
+                # be chosen using 'MSPDir'/keystore
+                FileKeyStore:
+                    KeyStore:
+
+    - &Org0
+        # DefaultOrg defines the organization which is used in the sampleconfig
+        # of the fabric.git development environment
+        Name: Org0MSP
+
+        # ID to load the MSP definition as
+        ID: Org0MSP
+
+        MSPDir: examples/e2e_cli/crypto/peer/peer0/localMspConfig
+
+        # BCCSP (Blockchain crypto provider): Select which crypto implementation or
+        # library to use
+        BCCSP:
+            Default: SW
+            SW:
+                Hash: SHA2
+                Security: 256
+                # Location of Key Store. If this is unset, a location will
+                # be chosen using 'MSPDir'/keystore
+                FileKeyStore:
+                    KeyStore:
+
+        AnchorPeers:
+            # AnchorPeers defines the location of peers which can be used
+            # for cross org gossip communication.  Note, this value is only
+            # encoded in the genesis block in the Application section context
+            - Host: peer0
+              Port: 7051
+
+    - &Org1
+        # DefaultOrg defines the organization which is used in the sampleconfig
+        # of the fabric.git development environment
+        Name: Org1MSP
+
+        # ID to load the MSP definition as
+        ID: Org1MSP
+
+        MSPDir: examples/e2e_cli/crypto/peer/peer2/localMspConfig
+
+        # BCCSP (Blockchain crypto provider): Select which crypto implementation or
+        # library to use
+        BCCSP:
+            Default: SW
+            SW:
+                Hash: SHA2
+                Security: 256
+                # Location of Key Store. If this is unset, a location will
+                # be chosen using 'MSPDir'/keystore
+                FileKeyStore:
+                    KeyStore:
+
+        AnchorPeers:
+            # AnchorPeers defines the location of peers which can be used
+            # for cross org gossip communication.  Note, this value is only
+            # encoded in the genesis block in the Application section context
+            - Host: peer2
+              Port: 7051
+
+################################################################################
+#
+#   SECTION: Orderer
+#
+#   - This section defines the values to encode into a config transaction or
+#   genesis block for orderer related parameters
+#
+################################################################################
+Orderer: &OrdererDefaults
+
+    # Orderer Type: The orderer implementation to start
+    # Available types are "solo" and "kafka"
+    OrdererType: solo
+
+    Addresses:
+        - orderer0:7050
+
+    # Batch Timeout: The amount of time to wait before creating a batch
+    BatchTimeout: 2s
+
+    # Batch Size: Controls the number of messages batched into a block
+    BatchSize:
+
+        # Max Message Count: The maximum number of messages to permit in a batch
+        MaxMessageCount: 10
+
+        # Absolute Max Bytes: The absolute maximum number of bytes allowed for
+        # the serialized messages in a batch.
+        AbsoluteMaxBytes: 99 MB
+
+        # Preferred Max Bytes: The preferred maximum number of bytes allowed for
+        # the serialized messages in a batch. A message larger than the preferred
+        # max bytes will result in a batch larger than preferred max bytes.
+        PreferredMaxBytes: 512 KB
+
+    Kafka:
+        # Brokers: A list of Kafka brokers to which the orderer connects
+        # NOTE: Use IP:port notation
+        Brokers:
+            - 127.0.0.1:9092
+
+    # Organizations is the list of orgs which are defined as participants on
+    # the orderer side of the network
+    Organizations:
+
+################################################################################
+#
+#   SECTION: Application
+#
+#   - This section defines the values to encode into a config transaction or
+#   genesis block for application related parameters
+#
+################################################################################
+Application: &ApplicationDefaults
+
+    # Organizations is the list of orgs which are defined as participants on
+    # the application side of the network
+    Organizations:

BIN
crypto/orderer/channel.tx


+ 10 - 0
crypto/orderer/localMspConfig/admincerts/ordererOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBcjCCARigAwIBAwICA+gwCgYIKoZIzj0EAwIwFjEUMBIGA1UEAwwLb3JkZXJl
+ck9yZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjAWMRQwEgYDVQQD
+DAtvcmRlcmVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABK8Sv0EA9h06
+fmBkUCO+D/b/2INZ2huy+W/HCxSF22c7WGoJbRzQcWtQmW1KqZowUk86RcxVfFqv
+jEMFVXzV38SjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFCVakuvq
+xEcK8pYMf/Hw8hsexRMTMB8GA1UdIwQYMBaAFCVakuvqxEcK8pYMf/Hw8hsexRMT
+MAoGCCqGSM49BAMCA0gAMEUCIQCmXgDSRTyxpSk+PXg0FNlYZ4ijTVwKgLkYVhod
+zZPfngIgO4y0p3Fs/gNsJYrroKaaVDe955KrPp/O55jYDKAD/oY=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBcjCCARigAwIBAwICA+gwCgYIKoZIzj0EAwIwFjEUMBIGA1UEAwwLb3JkZXJl
+ck9yZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjAWMRQwEgYDVQQD
+DAtvcmRlcmVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABK8Sv0EA9h06
+fmBkUCO+D/b/2INZ2huy+W/HCxSF22c7WGoJbRzQcWtQmW1KqZowUk86RcxVfFqv
+jEMFVXzV38SjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFCVakuvq
+xEcK8pYMf/Hw8hsexRMTMB8GA1UdIwQYMBaAFCVakuvqxEcK8pYMf/Hw8hsexRMT
+MAoGCCqGSM49BAMCA0gAMEUCIQCmXgDSRTyxpSk+PXg0FNlYZ4ijTVwKgLkYVhod
+zZPfngIgO4y0p3Fs/gNsJYrroKaaVDe955KrPp/O55jYDKAD/oY=
+-----END CERTIFICATE-----

+ 5 - 0
crypto/orderer/localMspConfig/keystore/ordererSigner.pem

@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIJPtBtNKlilpgVZ5FGUBWB2KH3zBtzkBnkrFMmi6W/80oAoGCCqGSM49
+AwEHoUQDQgAEfWHpZ4VacEOA83luJdvLOpKEasBn3O067iPTfFyupQh6cFABIn+u
+YASuariSKU3JFWfB1nANwZOsDA9B8BeRUA==
+-----END EC PRIVATE KEY-----

+ 10 - 0
crypto/orderer/localMspConfig/signcerts/orderer0Signer.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBajCCAQ+gAwIBAwICA+gwCgYIKoZIzj0EAwIwFjEUMBIGA1UEAwwLb3JkZXJl
+ck9yZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQD
+DAhvcmRlcmVyMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH1h6WeFWnBDgPN5
+biXbyzqShGrAZ9ztOu4j03xcrqUIenBQASJ/rmAErmq4kilNyRVnwdZwDcGTrAwP
+QfAXkVCjUDBOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFK01/Qm7YoTpXLXjq18D
++X2pExanMB8GA1UdIwQYMBaAFCVakuvqxEcK8pYMf/Hw8hsexRMTMAoGCCqGSM49
+BAMCA0kAMEYCIQDXdRYqrZdTAM6F2JBl/eN3nIHoBa7N3gIQDqdUAris8wIhAP6i
+f0CgyBN4nWmw2mT+XtxaB0xxWrhYj/j4agiuQzrd
+-----END CERTIFICATE-----

BIN
crypto/orderer/orderer.block


+ 10 - 0
crypto/peer/peer0/localMspConfig/admincerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer0/localMspConfig/admincerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer0/localMspConfig/admincerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer0/localMspConfig/cacerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer0/localMspConfig/cacerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 5 - 0
crypto/peer/peer0/localMspConfig/keystore/peer0Signer.pem

@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIKyhczWGQa7NbV1tq9LkZkvqslzoQ1HaEVwA6FCLOfvioAoGCCqGSM49
+AwEHoUQDQgAEQXp1+qOp9siBm45H52CgkyX8VpSUYjvQD+LGZVRjzdinhi1XcUMF
+I4+I7k76zykeelvAHUuqGvEDHU+WvQz9RQ==
+-----END EC PRIVATE KEY-----

+ 10 - 0
crypto/peer/peer0/localMspConfig/signcerts/peer0Signer.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBYzCCAQmgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjAQMQ4wDAYDVQQDDAVw
+ZWVyMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABEF6dfqjqfbIgZuOR+dgoJMl
+/FaUlGI70A/ixmVUY83Yp4YtV3FDBSOPiO5O+s8pHnpbwB1LqhrxAx1Plr0M/UWj
+UDBOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFBY2bc84vLEwkX1fSAER2p48jJXw
+MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqGSM49BAMCA0gA
+MEUCIQDeDZ71L+OTYcbbqiDNRf0L8OExO59mH1O3xpdwMAM0MgIgXySG4sv9yV31
+WcWRFfRFyu7o3T72kqiLZ1nkDuJ8jWI=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/admincerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/admincerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/admincerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/cacerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/cacerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/cacerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 5 - 0
crypto/peer/peer1/localMspConfig/keystore/peer1Signer.pem

@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIGke7eS6obPUxqqTr3k4svyI+7H2K8vtauJslox/rNjooAoGCCqGSM49
+AwEHoUQDQgAEj3/vPecw5FR5Letn4X3fKYNHaOIHpab5BKhLP+5C5Fq+eiSyBTql
+4XmsEx95uT8982hWN1Hh6AKoAcEcimnsiw==
+-----END EC PRIVATE KEY-----

+ 10 - 0
crypto/peer/peer1/localMspConfig/signcerts/peer1Signer.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBYzCCAQmgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjAQMQ4wDAYDVQQDDAVw
+ZWVyMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABI9/7z3nMORUeS3rZ+F93ymD
+R2jiB6Wm+QSoSz/uQuRavnoksgU6peF5rBMfebk/PfNoVjdR4egCqAHBHIpp7Iuj
+UDBOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFJpxVAXpMAEOHtbNCwvL1m/ku9gt
+MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqGSM49BAMCA0gA
+MEUCIQDsQ6lmuLdKmMgnN5+9YjlpCRQEJCoaG3uxRHhrAecZngIgQZlwnvwka+TM
+gF/yC3r2MeELK9ocw8c22DAe6x71RT4=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/admincerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/admincerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/admincerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/cacerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/cacerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/cacerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 5 - 0
crypto/peer/peer2/localMspConfig/keystore/peer2Signer.pem

@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEICO7+w9YD/MdNiZHXusiWGhHTOOAXks10aJGuITmZ0wkoAoGCCqGSM49
+AwEHoUQDQgAEtnKiIRz/RpNy2TxMcoe1DxYXYEAbW+AHqTFP5xRoucQfYSX01O9F
+iMeaOryjMz379HYlW5wQZl6UAhDEoPmlew==
+-----END EC PRIVATE KEY-----

+ 10 - 0
crypto/peer/peer2/localMspConfig/signcerts/peer2Signer.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBYzCCAQmgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjAQMQ4wDAYDVQQDDAVw
+ZWVyMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLZyoiEc/0aTctk8THKHtQ8W
+F2BAG1vgB6kxT+cUaLnEH2El9NTvRYjHmjq8ozM9+/R2JVucEGZelAIQxKD5pXuj
+UDBOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFDdoFJ6jiClMPOVsNx5akist91so
+MB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqGSM49BAMCA0gA
+MEUCIQC7wATZy+O/7UIPzSiMSXNgBKCaT2U55+Y/e0FcHQFSoQIgCyKExrm3gtW0
+SAN1VofiAZkr3gYndu9goHZe4wVh9eQ=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/admincerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/admincerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/admincerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/cacerts/peerOrg0.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzAwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABKJfDc/CcaiHRipTG2AB
+K5fA0LO9SOlbtC9bZcjLo/xsL157p+3QB3UVF3gt7nkwgMs/ul3FhSEFTk2EVNlF
+1QCjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFFQzuQR1RZP/Qn/B
+NDtGSa8n4eN/MB8GA1UdIwQYMBaAFFQzuQR1RZP/Qn/BNDtGSa8n4eN/MAoGCCqG
+SM49BAMCA0gAMEUCIAuG+/Fy3x9JXAD1/rFsu3ZpCKbXiXZLGF7P6Gma8is5AiEA
+pSQpRcdukxe4zvcfRmNBjMbNLWCoWlHSQA2jD678QGE=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/cacerts/peerOrg1.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjEwWhcNMTgwMjIwMTkwNjEwWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJ2S+UvyFgFZYL6qcrKo
+zy72Nkc/RQVzg1VfwC3X7QcnHEVBuCzba1nxdDVE8XPnhmKBWLKh0adn6GKUZpyf
+mbKjVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFAQlMVsXlKGMEWPf
+KMMM6QVASnlPMB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqG
+SM49BAMCA0gAMEUCIHr4AD6Xx3R6zFCsveIMnWao9Us88/0uGHoT4ELmMhA1AiEA
+yzfXU5qHp3xBJ1BrKOGi71UmQZVwWfO26INhxcfpCAg=
+-----END CERTIFICATE-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/cacerts/peerOrg2.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBbDCCARKgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzIwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjATMREwDwYDVQQDDAhw
+ZWVyT3JnMjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABH3IweQK1AJdcV3FF27a
+gNKhy13Nz2OguzsmUbW85/7pReenAWzs89rEApHXoJqUtNzdZfaLkcq32E1Ilk3N
+oN2jVjBUMBIGA1UdEwEB/wQIMAYBAf8CAQAwHQYDVR0OBBYEFEhOilIyGA53r9Zo
+O5GQP0RSZcQ1MB8GA1UdIwQYMBaAFEhOilIyGA53r9ZoO5GQP0RSZcQ1MAoGCCqG
+SM49BAMCA0gAMEUCIQD+/5z68ewJarixMgYrg/MwyTMwX7ikCaCgU5TN2MU1PQIg
+Qe+klrq6COxsmrctClV64Wj4zhGTOhaZG1yN24OXukQ=
+-----END CERTIFICATE-----

+ 5 - 0
crypto/peer/peer3/localMspConfig/keystore/peer3Signer.pem

@@ -0,0 +1,5 @@
+-----BEGIN EC PRIVATE KEY-----
+MHcCAQEEIPK7O2ZBw9tXDiVd2OM+riCIHT+uQPynGd0z9fjLSUltoAoGCCqGSM49
+AwEHoUQDQgAEy+ACkoJdggRjhiA9OBAqsswYx0r/WPxYSXaGKMQP6idVQX/D+iV6
+JKWM04LF11re7dfTJepfP+jNA8kv93hgvw==
+-----END EC PRIVATE KEY-----

+ 10 - 0
crypto/peer/peer3/localMspConfig/signcerts/peer3Signer.pem

@@ -0,0 +1,10 @@
+-----BEGIN CERTIFICATE-----
+MIIBYzCCAQmgAwIBAwICA+gwCgYIKoZIzj0EAwIwEzERMA8GA1UEAwwIcGVlck9y
+ZzEwHhcNMTcwMjIwMTkwNjExWhcNMTgwMjIwMTkwNjExWjAQMQ4wDAYDVQQDDAVw
+ZWVyMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABMvgApKCXYIEY4YgPTgQKrLM
+GMdK/1j8WEl2hijED+onVUF/w/oleiSljNOCxdda3u3X0yXqXz/ozQPJL/d4YL+j
+UDBOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFOzMeVZK5xYzjaeO2uGvz8B7CQS7
+MB8GA1UdIwQYMBaAFAQlMVsXlKGMEWPfKMMM6QVASnlPMAoGCCqGSM49BAMCA0gA
+MEUCIQCgKtFodSdXcz2yf9MZB90t1nXYytpGUPMAl0/Gy2/yfQIgAcC1KRtaiclr
+9C9tshhXdYdbpvDruVZrwqjJ4drPHik=
+-----END CERTIFICATE-----

BIN
docker-compose


+ 47 - 0
docker-compose-cli.yaml

@@ -0,0 +1,47 @@
+version: '2'
+
+services:
+
+  cli:
+    container_name: cli
+    image: hyperledger/fabric-peer
+    tty: true
+    environment:
+      - GOPATH=/opt/gopath
+      - CORE_PEER_ADDRESSAUTODETECT=true
+      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
+      - CORE_LOGGING_LEVEL=DEBUG
+      - CORE_NEXT=true
+      - CORE_PEER_ID=cli
+      - CORE_PEER_ENDORSER_ENABLED=true
+        # - CORE_PEER_COMMITTER_LEDGER_ORDERER=orderer0:7050
+      - CORE_PEER_ADDRESS=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org0MSP
+      - CORE_PEER_TLS_ENABLED=true
+      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/signcerts/peer0Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/keystore/peer0Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0
+      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig
+
+    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
+    command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; '
+    #command: /bin/bash
+    extra_hosts:
+      - "orderer0:10.16.80.209"
+      - "peer0:10.16.80.210"
+      - "peer1:10.16.80.211"
+      - "peer2:10.16.80.212"
+      - "peer3:10.16.80.213"
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./examples/:/opt/gopath/src/github.com/hyperledger/fabric/examples/
+      #- ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
+      - ./crypto:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
+      - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
+    #depends_on:
+      #- orderer0
+      #- peer0
+      #- peer1
+      #- peer2
+      #- peer3

+ 26 - 0
docker-compose-orderer0.yaml

@@ -0,0 +1,26 @@
+version: '2'
+
+services:
+
+  orderer0:
+    container_name: orderer0
+    image: hyperledger/fabric-orderer
+    environment:
+      - ORDERER_GENERAL_LOGLEVEL=debug
+      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
+      - ORDERER_GENERAL_GENESISMETHOD=file
+      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.block
+      - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
+      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/localMspConfig
+      # enabled TLS
+      - ORDERER_GENERAL_TLS_ENABLED=true
+      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/localMspConfig/keystore/ordererSigner.pem
+      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/localMspConfig/signcerts/orderer0Signer.pem
+      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/localMspConfig/cacerts/ordererOrg0.pem]
+    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
+    command: orderer
+    volumes:
+      - ./crypto/orderer:/var/hyperledger/orderer
+    ports:
+      - "7050:7050"
+

+ 45 - 0
docker-compose-peer0.yaml

@@ -0,0 +1,45 @@
+version: '2'
+
+services:
+
+## To enable CouchDB as state database, uncomment the following sections of this file:
+## 1) couchdb containers
+## 2) peer environment variables CORE_LEDGER_STATE_STATEDATABASE and
+##    CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
+## 3) couch container names in "depends_on" section
+
+  couchdb0:
+    container_name: couchdb0
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "5984:5984"
+
+  peer0:
+    container_name: peer0
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer0
+      - CORE_PEER_ADDRESS=peer0:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org0MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer0Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer0Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/cacerts/peerOrg0.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
+    extra_hosts:
+      - "orderer0:10.16.80.209"
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer0/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 7051:7051
+      - 7053:7053
+    depends_on:
+      - couchdb0
+

+ 49 - 0
docker-compose-peer1.yaml

@@ -0,0 +1,49 @@
+version: '2'
+
+services:
+
+## To enable CouchDB as state database, uncomment the following sections of this file:
+## 1) couchdb containers
+## 2) peer environment variables CORE_LEDGER_STATE_STATEDATABASE and
+##    CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
+## 3) couch container names in "depends_on" section
+
+  couchdb1:
+    container_name: couchdb1
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "5984:5984"
+
+  peer1:
+    container_name: peer1
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer1
+      - CORE_PEER_ADDRESS=peer1:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1:7051
+      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org0MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer1Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer1Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/cacerts/peerOrg0.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
+    extra_hosts:
+      - "orderer0:10.16.80.209"
+      - "peer0:10.16.80.210"
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer1/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 7051:7051
+      - 7053:7053
+    depends_on:
+      #- orderer0
+      #- peer0
+      - couchdb1
+

+ 51 - 0
docker-compose-peer2.yaml

@@ -0,0 +1,51 @@
+version: '2'
+
+services:
+
+## To enable CouchDB as state database, uncomment the following sections of this file:
+## 1) couchdb containers
+## 2) peer environment variables CORE_LEDGER_STATE_STATEDATABASE and
+##    CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
+## 3) couch container names in "depends_on" section
+
+  couchdb2:
+    container_name: couchdb2
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "5984:5984"
+
+  peer2:
+    container_name: peer2
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer2
+      - CORE_PEER_ADDRESS=peer2:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer2:7051
+      - CORE_PEER_GOSSIP_BOOTSTRAP=peer2:7051
+      - CORE_PEER_LOCALMSPID=Org1MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer2Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer2Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/admincerts/peerOrg1.pem
+      #- CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer2
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
+    extra_hosts:
+      - "orderer0:10.16.80.209"
+      - "peer0:10.16.80.210"
+      - "peer1:10.16.80.211"
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer2/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 7051:7051
+      - 7053:7053
+    depends_on:
+      #- orderer0
+      #- peer0
+      #- peer1
+      - couchdb2
+

+ 53 - 0
docker-compose-peer3.yaml

@@ -0,0 +1,53 @@
+version: '2'
+
+services:
+
+## To enable CouchDB as state database, uncomment the following sections of this file:
+## 1) couchdb containers
+## 2) peer environment variables CORE_LEDGER_STATE_STATEDATABASE and
+##    CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
+## 3) couch container names in "depends_on" section
+
+  couchdb3:
+    container_name: couchdb3
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "5984:5984"
+
+  peer3:
+    container_name: peer3
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer3
+      - CORE_PEER_ADDRESS=peer3:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer3:7051
+      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org1MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer3Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer3Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/cacerts/peerOrg1.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer3
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
+    extra_hosts:
+      - "orderer0:10.16.80.209"
+      - "peer0:10.16.80.210"
+      - "peer1:10.16.80.211"
+      - "peer2:10.16.80.212"
+    volumes:
+        - /var/run/:/host/var/run/
+        - ./crypto/peer/peer3/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 7051:7051
+      - 7053:7053
+    depends_on:
+      #- orderer0
+      #- peer0
+      #- peer1
+      #- peer2
+      - couchdb3
+

+ 213 - 0
docker-compose.yaml

@@ -0,0 +1,213 @@
+version: '2'
+
+services:
+
+  orderer0:
+    container_name: orderer0
+    image: hyperledger/fabric-orderer
+    environment:
+      - ORDERER_GENERAL_LOGLEVEL=debug
+      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
+      - ORDERER_GENERAL_GENESISMETHOD=file
+      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.block
+      - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
+      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/localMspConfig
+      # enabled TLS
+      - ORDERER_GENERAL_TLS_ENABLED=true
+      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/localMspConfig/keystore/ordererSigner.pem
+      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/localMspConfig/signcerts/orderer0Signer.pem
+      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/localMspConfig/cacerts/ordererOrg0.pem]
+    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
+    command: orderer
+    volumes:
+      - ./crypto/orderer:/var/hyperledger/orderer
+    ports:
+      - 7050:7050
+
+## To enable CouchDB as state database, uncomment the following sections of this file:
+## 1) couchdb containers
+## 2) peer environment variables CORE_LEDGER_STATE_STATEDATABASE and
+##    CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS
+## 3) couch container names in "depends_on" section
+
+  couchdb0:
+    container_name: couchdb0
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "5984:5984"
+
+  peer0:
+    container_name: peer0
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer0
+      - CORE_PEER_ADDRESS=peer0:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org0MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer0Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer0Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/cacerts/peerOrg0.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer0/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 7051:7051
+      - 7053:7053
+    depends_on:
+      - orderer0
+      - couchdb0
+
+  couchdb1:
+    container_name: couchdb1
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "6984:5984"
+
+  peer1:
+    container_name: peer1
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer1
+      - CORE_PEER_ADDRESS=peer1:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1:7051
+      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org0MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer1Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer1Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/cacerts/peerOrg0.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer1
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer1/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 8051:7051
+      - 8053:7053
+    depends_on:
+      - orderer0
+      - peer0
+      - couchdb1
+
+  couchdb2:
+    container_name: couchdb2
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "7984:5984"
+
+  peer2:
+    container_name: peer2
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer2
+      - CORE_PEER_ADDRESS=peer2:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer2:7051
+      - CORE_PEER_GOSSIP_BOOTSTRAP=peer2:7051
+      - CORE_PEER_LOCALMSPID=Org1MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer2Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer2Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/admincerts/peerOrg1.pem
+      #- CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer2
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer2/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 9051:7051
+      - 9053:7053
+    depends_on:
+      - orderer0
+      - peer0
+      - peer1
+      - couchdb2
+
+  couchdb3:
+    container_name: couchdb3
+    image: hyperledger/fabric-couchdb
+#   Uncomment the port mapping if you want to expose the CouchDB service,
+#   for example to utilize Fauxton User Interface in dev environments.
+    ports:
+      - "8984:5984"
+
+  peer3:
+    container_name: peer3
+    extends:
+      file: peer-base/peer-base.yaml
+      service: peer-base
+    environment:
+      - CORE_PEER_ID=peer3
+      - CORE_PEER_ADDRESS=peer3:7051
+      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer3:7051
+      - CORE_PEER_GOSSIP_BOOTSTRAP=peer2:7051
+      - CORE_PEER_LOCALMSPID=Org1MSP
+      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/signcerts/peer3Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/msp/sampleconfig/keystore/peer3Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/msp/sampleconfig/cacerts/peerOrg1.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer3
+      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
+      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb3:5984
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./crypto/peer/peer3/localMspConfig:/etc/hyperledger/fabric/msp/sampleconfig
+    ports:
+      - 10051:7051
+      - 10053:7053
+    depends_on:
+      - orderer0
+      - peer0
+      - peer1
+      - peer2
+      - couchdb3
+
+  cli:
+    container_name: cli
+    image: hyperledger/fabric-peer
+    tty: true
+    environment:
+      - GOPATH=/opt/gopath
+      - CORE_PEER_ADDRESSAUTODETECT=true
+      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
+      - CORE_LOGGING_LEVEL=DEBUG
+      - CORE_NEXT=true
+      - CORE_PEER_ID=cli
+      - CORE_PEER_ENDORSER_ENABLED=true
+      - CORE_PEER_ADDRESS=peer0:7051
+      - CORE_PEER_LOCALMSPID=Org0MSP
+      - CORE_PEER_TLS_ENABLED=true
+      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/signcerts/peer0Signer.pem
+      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/keystore/peer0Signer.pem
+      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem
+      # - CORE_PEER_TLS_SERVERHOSTOVERRIDE=peer0
+      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig
+
+    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
+    command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}; '
+    #command: /bin/bash
+    volumes:
+      - /var/run/:/host/var/run/
+      - ./examples/:/opt/gopath/src/github.com/hyperledger/fabric/examples/
+      - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
+      - ./crypto:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
+      - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
+    depends_on:
+      - orderer0
+      - peer0
+      - peer1
+      - peer2
+      - peer3

+ 72 - 0
download-dockerimages.sh

@@ -0,0 +1,72 @@
+#!/bin/bash -eu
+
+##################################################
+# This script pulls docker images from hyperledger
+# docker hub repository and Tag it as
+# hyperledger/fabric-<image> latest tag
+##################################################
+
+dockerFabricPull() {
+  local FABRIC_TAG=$1
+  for IMAGES in peer orderer couchdb ccenv javaenv kafka zookeeper; do
+      echo "==> FABRIC IMAGE: $IMAGES"
+      echo
+      docker pull hyperledger/fabric-$IMAGES:$FABRIC_TAG
+      docker tag hyperledger/fabric-$IMAGES:$FABRIC_TAG hyperledger/fabric-$IMAGES
+  done
+}
+
+dockerCaPull() {
+      local CA_TAG=$1
+      echo "==> FABRIC CA IMAGE"
+      echo
+      docker pull hyperledger/fabric-ca:$CA_TAG
+      docker tag hyperledger/fabric-ca:$CA_TAG hyperledger/fabric-ca
+}
+usage() {
+      echo "Description "
+      echo
+      echo "Pulls docker images from hyperledger dockerhub repository"
+      echo "tag as hyperledger/fabric-<image>:latest"
+      echo
+      echo "USAGE: "
+      echo
+      echo "./download-dockerimages.sh [-c <fabric-ca tag>] [-f <fabric tag>]"
+      echo "      -c fabric-ca docker image tag"
+      echo "      -f fabric docker image tag"
+      echo
+      echo
+      echo "EXAMPLE:"
+      echo "./download-dockerimages.sh -c x86_64-1.0.0-alpha -f x86_64-1.0.0-alpha"
+      echo
+      echo "By default, pulls fabric-ca and fabric 1.0.0-alpha docker images"
+      echo "from hyperledger dockerhub"
+      exit 0
+}
+
+while getopts "\?hc:f:" opt; do
+  case "$opt" in
+     c) CA_TAG="$OPTARG"
+        echo "Pull CA IMAGES"
+        ;;
+
+     f) FABRIC_TAG="$OPTARG"
+        echo "Pull FABRIC TAG"
+        ;;
+     \?|h) usage
+        echo "Print Usage"
+        ;;
+  esac
+done
+
+: ${CA_TAG:="x86_64-1.0.0-alpha"}
+: ${FABRIC_TAG:="x86_64-1.0.0-alpha"}
+
+echo "===> Pulling fabric Images"
+dockerFabricPull ${FABRIC_TAG}
+
+echo "===> Pulling fabric ca Image"
+dockerCaPull ${CA_TAG}
+echo
+echo "===> List out hyperledger docker images"
+docker images | grep hyperledger*

+ 841 - 0
end-to-end.rst

@@ -0,0 +1,841 @@
+End-to-End Flow
+===============
+
+The end-to-end verification demonstrates usage of the configuration
+transaction tool for orderer bootstrap and channel creation. The tool
+consumes a configuration transaction yaml file, which defines the
+cryptographic material (certs) used for member identity and network
+authentication. In other words, the MSP information for each member and
+its corresponding network entities.
+
+*Currently the crypto material is baked into the directory. However,
+there will be a tool in the near future to organically generate the
+certificates*
+
+Prerequisites
+-------------
+
+-  Follow the steps for setting up a `development
+   environment <http://hyperledger-fabric.readthedocs.io/en/latest/dev-setup/devenv.html>`__
+
+-  Clone the Fabric code base.
+
+   .. code:: bash
+
+       git clone http://gerrit.hyperledger.org/r/fabric
+
+   or though a mirrored repository in github:
+
+   ::
+
+       git clone https://github.com/hyperledger/fabric.git
+
+-  Make the ``configtxgen`` tool.
+
+   .. code:: bash
+
+       cd $GOPATH/src/github.com/hyperledger/fabric/devenv
+       vagrant up
+       vagrant ssh
+       # ensure sure you are in the /fabric directory where the Makefile resides
+       make configtxgen
+
+-  Make the peer and orderer images.
+
+   .. code:: bash
+
+       # make sure you are in vagrant and in the /fabric directory
+       make peer-docker orderer-docker
+
+   Execute a ``docker images`` command in your terminal. If the images
+   compiled successfully, you should see an output similar to the
+   following:
+
+   .. code:: bash
+
+       vagrant@hyperledger-devenv:v0.3.0-4eec836:/opt/gopath/src/github.com/hyperledger/fabric$ docker images
+       REPOSITORY                     TAG                             IMAGE ID            CREATED             SIZE
+       hyperledger/fabric-orderer     latest                          264e45897bfb        10 minutes ago      180 MB
+       hyperledger/fabric-orderer     x86_64-0.7.0-snapshot-a0d032b   264e45897bfb        10 minutes ago      180 MB
+       hyperledger/fabric-peer        latest                          b3d44cff07c6        10 minutes ago      184 MB
+       hyperledger/fabric-peer        x86_64-0.7.0-snapshot-a0d032b   b3d44cff07c6        10 minutes ago      184 MB
+       hyperledger/fabric-javaenv     latest                          6e2a2adb998a        10 minutes ago      1.42 GB
+       hyperledger/fabric-javaenv     x86_64-0.7.0-snapshot-a0d032b   6e2a2adb998a        10 minutes ago      1.42 GB
+       hyperledger/fabric-ccenv       latest                          0ce0e7dc043f        12 minutes ago      1.29 GB
+       hyperledger/fabric-ccenv       x86_64-0.7.0-snapshot-a0d032b   0ce0e7dc043f        12 minutes ago      1.29 GB
+       hyperledger/fabric-baseimage   x86_64-0.3.0                    f4751a503f02        4 weeks ago         1.27 GB
+       hyperledger/fabric-baseos      x86_64-0.3.0                    c3a4cf3b3350        4 weeks ago         161 MB
+
+Configuration Transaction Generator
+-----------------------------------
+
+The `configtxgen
+tool <https://github.com/hyperledger/fabric/blob/master/docs/source/configtxgen.rst>`__
+is used to create two artifacts: - orderer **bootstrap block** - fabric
+**channel configuration transaction**
+
+The orderer block is the genesis block for the ordering service, and the
+channel transaction file is broadcast to the orderer at channel creation
+time.
+
+The ``configtx.yaml`` contains the definitions for the sample network.
+There are two members, each managing and maintaining two peer nodes.
+Inspect this file to better understand the corresponding cryptographic
+material tied to the member components. The ``/crypto`` directory
+contains the admin certs, ca certs, private keys for each entity, and
+the signing certs for each entity.
+
+For ease of use, a script - ``generateCfgTrx.sh`` - is provided. The
+script will generate the two configuration artifacts.
+
+Run the shell script
+^^^^^^^^^^^^^^^^^^^^
+
+Make sure you are in the ``examples/e2e_cli`` directory and in your
+vagrant environment. You can elect to pass in a unique name for your
+channel or simply execute the script without the ``channel-ID``
+parameter. If you choose not to pass in a unique name, then a channel
+with the default name of ``mychannel`` will be generated.
+
+.. code:: bash
+
+    cd examples/e2e_cli
+    # note the <channel-ID> parm is optional
+    ./generateCfgTrx.sh <channel-ID>
+
+After you run the shell script, you should see an output in your
+terminal similar to the following:
+
+.. code:: bash
+
+    2017/02/28 17:01:52 Generating new channel configtx
+    2017/02/28 17:01:52 Creating no-op MSP instance
+    2017/02/28 17:01:52 Obtaining default signing identity
+    2017/02/28 17:01:52 Creating no-op signing identity instance
+    2017/02/28 17:01:52 Serializing identity
+    2017/02/28 17:01:52 signing message
+    2017/02/28 17:01:52 signing message
+    2017/02/28 17:01:52 Writing new channel tx
+
+These configuration transactions will bundle the crypto material for the
+participating members and their network components and output an orderer
+genesis block and channel transaction artifact. These two artifacts are
+required for a functioning transactional network with
+sign/verify/authenticate capabilities.
+
+Manually generate the artifacts (optional)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+In your vagrant environment, navigate to the ``/common/configtx/tool``
+directory and replace the ``configtx.yaml`` file with the supplied yaml
+file in the ``/e2e_cli`` directory. Then return to the ``/e2e_cli``
+directory.
+
+.. code:: bash
+
+    # Generate orderer bootstrap block
+    configtxgen -profile TwoOrgs -outputBlock <block-name>
+    # example: configtxgen -profile TwoOrgs -outputBlock orderer.block
+
+    # Generate channel configuration transaction
+    configtxgen -profile TwoOrgs -outputCreateChannelTx <cfg txn name> -channelID <channel-id>
+    # example: configtxgen -profile TwoOrgs -outputCreateChannelTx channel.tx -channelID mychannel
+
+Run the end-to-end test with Docker
+-----------------------------------
+
+Make sure you are in the ``/e2e_cli`` directory. Then use docker-compose
+to spawn the network entities and drive the tests.
+
+.. code:: bash
+
+    [CHANNEL_NAME=<channel-id>] docker-compose up -d
+
+If you created a unique channel name, be sure to pass in that parameter.
+For example,
+
+.. code:: bash
+
+    CHANNEL_NAME=abc docker-compose up -d
+
+Wait, 30 seconds. Behind the scenes, there are transactions being sent
+to the peers. Execute a ``docker ps`` to view your active containers.
+You should see an output identical to the following:
+
+.. code:: bash
+
+    vagrant@hyperledger-devenv:v0.3.0-4eec836:/opt/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli$ docker ps
+    CONTAINER ID        IMAGE                        COMMAND                  CREATED              STATUS              PORTS                                              NAMES
+    45e3e114f7a2        dev-peer3-mycc-1.0           "chaincode -peer.a..."   4 seconds ago        Up 4 seconds                                                           dev-peer3-mycc-1.0
+    5970f740ad2b        dev-peer0-mycc-1.0           "chaincode -peer.a..."   24 seconds ago       Up 23 seconds                                                          dev-peer0-mycc-1.0
+    b84808d66e99        dev-peer2-mycc-1.0           "chaincode -peer.a..."   48 seconds ago       Up 47 seconds                                                          dev-peer2-mycc-1.0
+    16d7d94c8773        hyperledger/fabric-peer      "peer node start -..."   About a minute ago   Up About a minute   0.0.0.0:10051->7051/tcp, 0.0.0.0:10053->7053/tcp   peer3
+    3561a99e35e6        hyperledger/fabric-peer      "peer node start -..."   About a minute ago   Up About a minute   0.0.0.0:9051->7051/tcp, 0.0.0.0:9053->7053/tcp     peer2
+    0baad3047d92        hyperledger/fabric-peer      "peer node start -..."   About a minute ago   Up About a minute   0.0.0.0:8051->7051/tcp, 0.0.0.0:8053->7053/tcp     peer1
+    1216896b7b4f        hyperledger/fabric-peer      "peer node start -..."   About a minute ago   Up About a minute   0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp     peer0
+    155ff8747b4d        hyperledger/fabric-orderer   "orderer"                About a minute ago   Up About a minute   0.0.0.0:7050->7050/tcp                             orderer
+
+All in one
+^^^^^^^^^^
+
+You can also generate the artifacts and drive the tests using a single
+shell script. The ``configtxgen`` and ``docker-compose`` commands are
+embedded in the script.
+
+.. code:: bash
+
+    ./network_setup.sh up <channel-ID>
+
+Once again, if you choose not to pass the ``channel-ID`` parameter, then
+your channel will default to ``mychannel``.
+
+What's happening behind the scenes?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+-  A script - ``script.sh`` - is baked inside the CLI container. The
+   script drives the ``createChannel`` command against the default
+   ``mychannel`` name.
+
+-  The output of ``createChannel`` is a genesis block -
+   ``mychannel.block`` - which is stored on the file system.
+
+-  the ``joinChannel`` command is exercised for all four peers who will
+   pass in the genesis block.
+
+-  Now we have a channel consisting of four peers, and two
+   organizations.
+
+-  ``PEER0`` and ``PEER1`` belong to Org0; ``PEER2`` and ``PEER3``
+   belong to Org1
+
+-  Recall that these relationships are defined in the ``configtx.yaml``
+
+-  A chaincode - *chaincode\_example02* is installed on ``PEER0`` and
+   ``PEER2``
+
+-  The chaincode is then "instantiated" on ``PEER2``. Instantiate simply
+   refers to starting the container and initializing the key value pairs
+   associated with the chaincode. The initial values for this example
+   are "a","100" "b","200". This "instantiation" results in a container
+   by the name of ``dev-peer2-mycc-1.0`` starting.
+
+-  The instantiation also passes in an argument for the endorsement
+   policy. The policy is defined as
+   ``-P "OR    ('Org0MSP.member','Org1MSP.member')"``, meaning that any
+   transaction must be endorsed by a peer tied to Org0 or Org1.
+
+-  A query against the value of "a" is issued to ``PEER0``. The
+   chaincode was previously installed on ``PEER0``, so this will start
+   another container by the name of ``dev-peer0-mycc-1.0``. The result
+   of the query is also returned. No write operations have occurred, so
+   a query against "a" will still return a value of "100"
+
+-  An invoke is sent to ``PEER0`` to move "10" from "a" to "b"
+
+-  The chaincode is installed on ``PEER3``
+
+-  A query is sent to ``PEER3`` for the value of "a". This starts a
+   third chaincode container by the name of ``dev-peer3-mycc-1.0``. A
+   value of 90 is returned, correctly reflecting the previous
+   transaction during which the value for key "a" was modified by 10.
+
+What does this demonstrate?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Chaincode **MUST** be installed on a peer in order for it to
+successfully perform read/write operations against the ledger.
+Furthermore, a chaincode container is not started for a peer until a
+read/write operation is performed against that chaincode (e.g. query for
+the value of "a"). The transaction causes the container to start. Also,
+all peers in a channel maintain an exact copy of the ledger which
+comprises the blockchain to store the immutable, sequenced record in
+blocks, as well as a state database to maintain current fabric state.
+This includes those peers that do not have chaincode installed on them
+(like ``Peer3`` in the above example) . Finally, the chaincode is accessible
+after it is installed (like ``Peer3`` in the above example) because it
+already has been instantiated.
+
+How do I see these transactions?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Check the logs for the CLI docker container.
+
+::
+
+    docker logs -f cli
+
+You should see the following output:
+
+.. code:: bash
+
+    2017-02-28 04:31:20.841 UTC [logging] InitFromViper -> DEBU 001 Setting default logging level to DEBUG for command 'chaincode'
+    2017-02-28 04:31:20.842 UTC [msp] GetLocalMSP -> DEBU 002 Returning existing local MSP
+    2017-02-28 04:31:20.842 UTC [msp] GetDefaultSigningIdentity -> DEBU 003 Obtaining default signing identity
+    2017-02-28 04:31:20.843 UTC [msp] Sign -> DEBU 004 Sign: plaintext: 0A8F050A59080322096D796368616E6E...6D7963631A0A0A0571756572790A0161
+    2017-02-28 04:31:20.843 UTC [msp] Sign -> DEBU 005 Sign: digest: 52F1A41B7B0B08CF3FC94D9D7E916AC4C01C54399E71BC81D551B97F5619AB54
+    Query Result: 90
+    2017-02-28 04:31:30.425 UTC [main] main -> INFO 006 Exiting.....
+    ===================== Query on chaincode on PEER3 on channel 'mychannel' is successful =====================
+
+    ===================== All GOOD, End-2-End execution completed =====================
+
+How can I see the chaincode logs?
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Inspect the individual chaincode containers to see the separate
+transactions executed against each container. Here is the combined
+output from each container:
+
+.. code:: bash
+
+    $ docker logs dev-peer2-mycc-1.0
+    04:30:45.947 [BCCSP_FACTORY] DEBU : Initialize BCCSP [SW]
+    ex02 Init
+    Aval = 100, Bval = 200
+
+    $ docker logs dev-peer0-mycc-1.0
+    04:31:10.569 [BCCSP_FACTORY] DEBU : Initialize BCCSP [SW]
+    ex02 Invoke
+    Query Response:{"Name":"a","Amount":"100"}
+    ex02 Invoke
+    Aval = 90, Bval = 210
+
+    $ docker logs dev-peer3-mycc-1.0
+    04:31:30.420 [BCCSP_FACTORY] DEBU : Initialize BCCSP [SW]
+    ex02 Invoke
+    Query Response:{"Name":"a","Amount":"90"}
+
+Run the end-to-end test manually with Docker
+--------------------------------------------
+
+From your vagrant environment exit the currently running containers:
+
+.. code:: bash
+
+    docker rm -f $(docker ps -aq)
+
+Execute a ``docker images`` command in your terminal to view the
+chaincode images. They will look similar to the following:
+
+.. code:: bash
+
+    REPOSITORY                     TAG                             IMAGE ID            CREATED             SIZE
+    dev-peer3-mycc-1.0             latest                          3415bc2e146c        5 hours ago         176 MB
+    dev-peer0-mycc-1.0             latest                          140d7ee3e911        5 hours ago         176 MB
+    dev-peer2-mycc-1.0             latest                          6e4fc412969e        5 hours ago         176 MB
+
+Remove these images:
+
+.. code:: bash
+
+    docker rmi <IMAGE ID> <IMAGE ID> <IMAGE ID>
+
+For example:
+
+.. code:: bash
+
+    docker rmi -f 341 140 6e4
+
+Ensure you have the configuration artifacts. If you deleted them, run
+the shell script again:
+
+.. code:: bash
+
+    ./generateCfgTrx.sh <channel-ID>
+
+Modify the docker-compose file
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Open the docker-compose file and comment out the command to run
+``script.sh``. Navigate down to the cli image and place a ``#`` to the
+left of the command. For example:
+
+.. code:: bash
+
+        working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
+      # command: /bin/bash -c './scripts/script.sh ${CHANNEL_NAME}'
+
+Save the file and return to the ``/e2e_cli`` directory.
+
+Now restart your network:
+
+.. code:: bash
+
+    # make sure you are in the /e2e_cli directory where you docker-compose script resides
+    docker-compose up -d
+
+Command syntax
+^^^^^^^^^^^^^^
+
+Refer to the create and join commands in the ``script.sh``.
+
+For the following CLI commands against `peer0` to work, you need to set the
+values for four environment variables, given below. Please make sure to override
+the values accordingly when calling commands against other peers and the
+orderer.
+
+.. code:: bash
+
+    # Environment variables for PEER0
+    CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig
+    CORE_PEER_ADDRESS=peer0:7051
+    CORE_PEER_LOCALMSPID="Org0MSP"
+    CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem
+
+These environment variables for each peer are defined in the supplied
+docker-compose file.
+
+Create channel
+^^^^^^^^^^^^^^
+
+Exec into the cli container:
+
+.. code:: bash
+
+    docker exec -it cli bash
+
+If successful you should see the following:
+
+.. code:: bash
+
+    root@0d78bb69300d:/opt/gopath/src/github.com/hyperledger/fabric/peer#
+
+Specify your channel name with the ``-c`` flag. Specify your channel
+configuration transaction with the ``-f`` flag. In this case it is
+``channeltx``, however you can mount your own configuration transaction
+with a different name.
+
+.. code:: bash
+
+    # the channel.tx and orderer.block are mounted in the crypto/orderer folder within your cli container
+    # as a result, we pass the full path for the file
+     peer channel create -o orderer0:7050 -c mychannel -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
+
+Since the `channel create` runs against the orderer, we need to override the
+four environment variables set before. So the above command in its entirety would be:
+
+.. code:: bash
+
+    CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig CORE_PEER_LOCALMSPID="OrdererMSP" peer channel create -o orderer0:7050 -c mychannel -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
+
+
+**Note**: You will remain in the CLI container for the remainder of
+these manual commands. You must also remember to preface all commands
+with the corresponding environment variables for targetting a peer other than
+`peer0`.
+
+Join channel
+^^^^^^^^^^^^
+
+Join specific peers to the channel
+
+.. code:: bash
+
+    # By default, this joins PEER0 only
+    # the mychannel.block is also mounted in the crypto/orderer directory
+     peer channel join -b mychannel.block
+
+You can make other peers join the channel as necessary by making appropriate
+changes in the four environment variables.
+
+Install chaincode onto a remote peer
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Install the sample go code onto one of the four peer nodes
+
+.. code:: bash
+
+    peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
+
+Instantiate chaincode and define the endorsement policy
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Instantiate the chaincode on a peer. This will launch a chaincode
+container for the targeted peer and set the endorsement policy for the
+chaincode. In this snippet, we define the policy as requiring an
+endorsement from one peer node that is a part of either `Org0` or `Org1`.
+The command is:
+
+.. code:: bash
+
+    peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
+
+See the `endorsement
+policies <http://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies/>`__
+documentation for more details on policy implementation.
+
+Invoke chaincode
+^^^^^^^^^^^^^^^^
+
+.. code:: bash
+
+    peer chaincode invoke -o orderer0:7050  --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem  -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
+
+**NOTE**: Make sure to wait a few seconds for the operation to complete.
+
+Query chaincode
+^^^^^^^^^^^^^^^
+
+.. code:: bash
+
+    peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}'
+
+The result of the above command should be as below:
+
+.. code:: bash
+
+    Query Result: 90
+
+Run the end-to-end test using the native binaries
+-------------------------------------------------
+
+Open your vagrant environment:
+
+.. code:: bash
+
+    cd $GOPATH/src/github.com/hyperledger/fabric/devenv
+
+.. code:: bash
+
+    # you may have to first start your VM with vagrant up
+    vagrant ssh
+
+From the ``fabric`` directory build the issue the following commands to
+build the peer and orderer executables:
+
+.. code:: bash
+
+    make clean
+    make native
+
+You will also need the ``ccenv`` image. From the ``fabric`` directory:
+
+.. code:: bash
+
+    make peer-docker
+
+Next, open two more terminals and start your vagrant environment in
+each. You should now have a total of three terminals, all within
+vagrant.
+
+Before starting, make sure to clear your ledger folder
+``/var/hyperledger/``. You will want to do this after each run to avoid
+errors and duplication.
+
+::
+
+    rm -rf /var/hyperledger/*
+
+**Vagrant window 1**
+
+Use the ``configtxgen`` tool to create the orderer genesis block:
+
+.. code:: bash
+
+    configtxgen -profile SampleSingleMSPSolo -outputBlock orderer.block
+
+**Vagrant window 2**
+
+Start the orderer with the genesis block you just generated:
+
+.. code:: bash
+
+    ORDERER_GENERAL_GENESISMETHOD=file ORDERER_GENERAL_GENESISFILE=./orderer.block orderer
+
+**Vagrant window 1**
+
+Create the channel configuration transaction:
+
+.. code:: bash
+
+    configtxgen -profile SampleSingleMSPSolo -outputCreateChannelTx channel.tx -channelID <channel-ID>
+
+This will generate a ``channel.tx`` file in your current directory
+
+**Vagrant window 3**
+
+Start the peer in *"chainless"* mode
+
+.. code:: bash
+
+    peer node start --peer-defaultchain=false
+
+**Note**: Use Vagrant window 1 for the remainder of commands
+
+Create channel
+^^^^^^^^^^^^^^
+
+Ask peer to create a channel with the configuration parameters in
+``channel.tx``
+
+.. code:: bash
+
+    peer channel create -o 127.0.0.1:7050 -c mychannel -f channel.tx
+
+This will return a channel genesis block - ``mychannel.block`` - in your
+current directory.
+
+Join channel
+^^^^^^^^^^^^
+
+Ask peer to join the channel by passing in the channel genesis block:
+
+.. code:: bash
+
+    peer channel join -b mychannel.block
+
+Install
+^^^^^^^
+
+Install chaincode on the peer:
+
+.. code:: bash
+
+    peer chaincode install -o 127.0.0.1:7050 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
+
+Make sure the chaincode is in the filesystem:
+
+.. code:: bash
+
+    ls /var/hyperledger/production/chaincodes
+
+You should see ``mycc.1.0``
+
+Instantiate
+^^^^^^^^^^^
+
+Instantiate the chaincode:
+
+.. code:: bash
+
+    peer chaincode instantiate -o 127.0.0.1:7050 -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}'
+
+Check your active containers:
+
+.. code:: bash
+
+    docker ps
+
+If the chaincode container started successfully, you should see:
+
+.. code:: bash
+
+    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
+    bd9c6bda7560        dev-jdoe-mycc-1.0   "chaincode -peer.a..."   5 seconds ago       Up 5 seconds                            dev-jdoe-mycc-1.0
+
+Invoke
+^^^^^^
+
+Issue an invoke to move "10" from "a" to "b":
+
+.. code:: bash
+
+    peer chaincode invoke -o 127.0.0.1:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
+
+Wait a few seconds for the operation to complete
+
+Query
+^^^^^
+
+Query for the value of "a":
+
+.. code:: bash
+
+    # this should return 90
+    peer chaincode query -o 127.0.0.1:7050 -C mychannel -n mycc -c '{"Args":["query","a"]}'
+
+Don't forget to clear ledger folder ``/var/hyperledger/`` after each
+run!
+
+::
+
+    rm -rf /var/hyperledger/*
+
+Using CouchDB
+-------------
+
+The state database can be switched from the default (goleveldb) to CouchDB.
+The same chaincode functions are available with CouchDB, however, there is the
+added ability to perform rich and complex queries against the state database
+data content contingent upon the chaincode data being modeled as JSON.
+
+To use CouchDB instead of the default database (goleveldb), follow the same
+procedure in the **Prerequisites** section, and additionally perform the
+following two steps to enable the CouchDB containers and associate each peer
+container with a CouchDB container:
+
+-  Make the CouchDB image.
+
+   .. code:: bash
+
+       # make sure you are in the /fabric directory
+       make couchdb
+
+-  Open the ``fabric/examples/e2e_cli/docker-compose.yaml`` and un-comment
+   all commented statements relating to CouchDB containers and peer container
+   use of CouchDB. These instructions are are also outlined in the
+   same ``docker-compose.yaml`` file. Search the file for 'couchdb' (case insensitive) references.
+
+*chaincode_example02* should now work using CouchDB underneath.
+
+***Note***: If you choose to implement mapping of the fabric-couchdb container
+port to a host port, please make sure you are aware of the security
+implications. Mapping of the port in a development environment allows the
+visualization of the database via the CouchDB web interface (Fauxton).
+Production environments would likely refrain from implementing port mapping in
+order to restrict outside access to the CouchDB containers.
+
+You can use *chaincode_example02* chaincode against the CouchDB state database
+using the steps outlined above, however in order to exercise the query
+capabilities you will need to use a chaincode that has data modeled as JSON,
+(e.g. *marbles02*). You can locate the *marbles02* chaincode in the
+``fabric/examples/chaincode/go`` directory.
+
+Install, instantiate, invoke, and query *marbles02* chaincode by following the
+same general steps outlined above for *chaincode_example02* in the **Manually
+create the channel and join peers through CLI** section. After the **Join
+channel** step, use the following steps to interact with the *marbles02*
+chaincode: 
+
+-  Install and instantiate the chaincode in ``peer0``:
+
+   .. code:: bash
+
+       peer chaincode install -o orderer0:7050 -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02
+       peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02 -c '{"Args":["init"]}' -P "OR      ('Org0MSP.member','Org1MSP.member')"
+
+-  Create some marbles and move them around:
+
+   .. code:: bash
+
+        peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'
+        peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'
+        peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'
+        peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'
+        peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["transferMarblesBasedOnColor","blue","jerry"]}'
+        peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["delete","marble1"]}'
+
+
+
+-  If you chose to activate port mapping, you can now view the state database
+   through the CouchDB web interface (Fauxton) by opening a browser and
+   navigating to one of the two URLs below.
+
+   For containers running in a vagrant environment:
+
+   ``http://localhost:15984/_utils``
+
+   For non-vagrant environment, use the port address that was mapped in CouchDB
+   container specification:
+
+   ``http://localhost:5984/_utils``
+
+   You should see a database named ``mychannel`` and the documents
+   inside it.
+
+-  You can run regular queries from the `cli` (e.g. reading ``marble2``):
+
+   .. code:: bash
+
+      peer chaincode query -C mychannel -n marbles -c '{"Args":["readMarble","marble2"]}'
+
+
+   You should see the details of ``marble2``:
+
+   .. code:: bash
+
+       Query Result: {"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}
+
+
+   Retrieve the history of ``marble1``:
+
+   .. code:: bash
+
+      peer chaincode query -C mychannel -n marbles -c '{"Args":["getHistoryForMarble","marble1"]}'
+
+   You should see the transactions on ``marble1``:
+
+   .. code:: bash
+
+      Query Result: [{"TxId":"1c3d3caf124c89f91a4c0f353723ac736c58155325f02890adebaa15e16e6464", "Value":{"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"tom"}},{"TxId":"755d55c281889eaeebf405586f9e25d71d36eb3d35420af833a20a2f53a3eefd", "Value":{"docType":"marble","name":"marble1","color":"blue","size":35,"owner":"jerry"}},{"TxId":"819451032d813dde6247f85e56a89262555e04f14788ee33e28b232eef36d98f", "Value":}]
+
+
+
+-  You can also perform rich queries on the data content, such as querying marble fields by owner ``jerry``:
+
+   .. code:: bash
+
+      peer chaincode query -C mychannel -n marbles -c '{"Args":["queryMarblesByOwner","jerry"]}'
+
+   The output should display the two marbles owned by ``jerry``:
+
+   .. code:: bash
+
+       Query Result: [{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"jerry","size":70}}]
+
+   Query by field ``owner`` where the value is ``jerry``:
+
+   .. code:: bash
+
+      peer chaincode query -C mychannel -n marbles -c '{"Args":["queryMarbles","{\"selector\":{\"owner\":\"jerry\"}}"]}'
+
+   The output should display:
+
+   .. code:: bash
+
+       Query Result: [{"Key":"marble2", "Record":{"color":"red","docType":"marble","name":"marble2","owner":"jerry","size":50}},{"Key":"marble3", "Record":{"color":"blue","docType":"marble","name":"marble3","owner":"jerry","size":70}}]
+
+A Note on Data Persistence
+--------------------------
+
+If data persistence is desired on the peer container or the CouchDB container,
+one option is to mount a directory in the docker-host into a relevant directory
+in the container. For example, you may add the following two lines in
+the peer container specification in the ``docker-compose.yaml`` file:
+
+   .. code:: bash
+
+       volumes:
+        - /var/hyperledger/peer0:/var/hyperledger/production
+
+
+For the CouchDB container, you may add the following two lines in the CouchDB
+container specification:
+
+   .. code:: bash
+
+       volumes:
+        - /var/hyperledger/couchdb0:/opt/couchdb/data
+
+
+Troubleshooting
+---------------
+
+-  Ensure you clear the file system after each run
+
+-  If you see docker errors, remove your images and start from scratch.
+
+   .. code:: bash
+
+       make clean
+       make peer-docker orderer-docker
+
+-  If you see the below error:
+
+   .. code:: bash
+
+       Error: Error endorsing chaincode: rpc error: code = 2 desc = Error installing chaincode code mycc:1.0(chaincode /var/hyperledger/production/chaincodes/mycc.1.0 exits)
+
+   You likely have chaincode images (e.g. ``peer0-peer0-mycc-1.0`` or
+   ``peer1-peer0-mycc1-1.0``) from prior runs. Remove them and try
+   again.
+
+.. code:: bash
+
+    docker rmi -f $(docker images | grep peer[0-9]-peer[0-9] | awk '{print $3}')
+
+-  To cleanup the network, use the ``down`` option:
+
+   .. code:: bash
+
+       ./network_setup.sh down

+ 199 - 0
examples/chaincode/go/chaincode_example02/chaincode_example02.go

@@ -0,0 +1,199 @@
+/*
+Copyright IBM Corp. 2016 All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+		 http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+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"
+
+	"github.com/hyperledger/fabric/core/chaincode/shim"
+	pb "github.com/hyperledger/fabric/protos/peer"
+)
+
+// SimpleChaincode example simple Chaincode implementation
+type SimpleChaincode struct {
+}
+
+func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
+	fmt.Println("ex02 Init")
+	_, args := stub.GetFunctionAndParameters()
+	var A, B string    // Entities
+	var Aval, Bval int // Asset holdings
+	var err error
+
+	if len(args) != 4 {
+		return shim.Error("Incorrect number of arguments. Expecting 4")
+	}
+
+	// Initialize the chaincode
+	A = args[0]
+	Aval, err = strconv.Atoi(args[1])
+	if err != nil {
+		return shim.Error("Expecting integer value for asset holding")
+	}
+	B = args[2]
+	Bval, err = strconv.Atoi(args[3])
+	if err != nil {
+		return shim.Error("Expecting integer value for asset holding")
+	}
+	fmt.Printf("Aval = %d, Bval = %d\n", Aval, Bval)
+
+	// Write the state to the ledger
+	err = stub.PutState(A, []byte(strconv.Itoa(Aval)))
+	if err != nil {
+		return shim.Error(err.Error())
+	}
+
+	err = stub.PutState(B, []byte(strconv.Itoa(Bval)))
+	if err != nil {
+		return shim.Error(err.Error())
+	}
+
+	return shim.Success(nil)
+}
+
+func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
+	fmt.Println("ex02 Invoke")
+	function, args := stub.GetFunctionAndParameters()
+	if function == "invoke" {
+		// Make payment of X units from A to B
+		return t.invoke(stub, args)
+	} else if function == "delete" {
+		// Deletes an entity from its state
+		return t.delete(stub, args)
+	} else if function == "query" {
+		// the old "Query" is now implemtned in invoke
+		return t.query(stub, args)
+	}
+
+	return shim.Error("Invalid invoke function name. Expecting \"invoke\" \"delete\" \"query\"")
+}
+
+// Transaction makes payment of X units from A to B
+func (t *SimpleChaincode) invoke(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+	var A, B string    // Entities
+	var Aval, Bval int // Asset holdings
+	var X int          // Transaction value
+	var err error
+
+	if len(args) != 3 {
+		return shim.Error("Incorrect number of arguments. Expecting 3")
+	}
+
+	A = args[0]
+	B = args[1]
+
+	// Get the state from the ledger
+	// TODO: will be nice to have a GetAllState call to ledger
+	Avalbytes, err := stub.GetState(A)
+	if err != nil {
+		return shim.Error("Failed to get state")
+	}
+	if Avalbytes == nil {
+		return shim.Error("Entity not found")
+	}
+	Aval, _ = strconv.Atoi(string(Avalbytes))
+
+	Bvalbytes, err := stub.GetState(B)
+	if err != nil {
+		return shim.Error("Failed to get state")
+	}
+	if Bvalbytes == nil {
+		return shim.Error("Entity not found")
+	}
+	Bval, _ = strconv.Atoi(string(Bvalbytes))
+
+	// Perform the execution
+	X, err = strconv.Atoi(args[2])
+	if err != nil {
+		return shim.Error("Invalid transaction amount, expecting a integer value")
+	}
+	Aval = Aval - X
+	Bval = Bval + X
+	fmt.Printf("Aval = %d, Bval = %d\n", Aval, Bval)
+
+	// Write the state back to the ledger
+	err = stub.PutState(A, []byte(strconv.Itoa(Aval)))
+	if err != nil {
+		return shim.Error(err.Error())
+	}
+
+	err = stub.PutState(B, []byte(strconv.Itoa(Bval)))
+	if err != nil {
+		return shim.Error(err.Error())
+	}
+
+	return shim.Success(nil)
+}
+
+// Deletes an entity from state
+func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+	if len(args) != 1 {
+		return shim.Error("Incorrect number of arguments. Expecting 1")
+	}
+
+	A := args[0]
+
+	// Delete the key from the state in ledger
+	err := stub.DelState(A)
+	if err != nil {
+		return shim.Error("Failed to delete state")
+	}
+
+	return shim.Success(nil)
+}
+
+// query callback representing the query of a chaincode
+func (t *SimpleChaincode) query(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+	var A string // Entities
+	var err error
+
+	if len(args) != 1 {
+		return shim.Error("Incorrect number of arguments. Expecting name of the person to query")
+	}
+
+	A = args[0]
+
+	// Get the state from the ledger
+	Avalbytes, err := stub.GetState(A)
+	if err != nil {
+		jsonResp := "{\"Error\":\"Failed to get state for " + A + "\"}"
+		return shim.Error(jsonResp)
+	}
+
+	if Avalbytes == nil {
+		jsonResp := "{\"Error\":\"Nil amount for " + A + "\"}"
+		return shim.Error(jsonResp)
+	}
+
+	jsonResp := "{\"Name\":\"" + A + "\",\"Amount\":\"" + string(Avalbytes) + "\"}"
+	fmt.Printf("Query Response:%s\n", jsonResp)
+	return shim.Success(Avalbytes)
+}
+
+func main() {
+	err := shim.Start(new(SimpleChaincode))
+	if err != nil {
+		fmt.Printf("Error starting Simple chaincode: %s", err)
+	}
+}

+ 328 - 0
examples/chaincode/go/chaincode_meidi/chaincode_meidi.go

@@ -0,0 +1,328 @@
+/*
+Copyright 33.cn Corp. 2017 All Rights Reserved.
+
+Chaincode for Meidi Corp.
+
+Chang history:
+
+
+2017/4/12 Building successfully.
+2017/4/11 init version.  
+
+
+*/
+
+package main
+
+
+import (
+	"encoding/json"
+	"errors"
+	"fmt"
+	"strconv"
+	"time"
+
+	"github.com/hyperledger/fabric/core/chaincode/shim"
+	pb "github.com/hyperledger/fabric/protos/peer"
+)
+
+var transactionNo int = 0
+
+// SimpleChaincode example simple Chaincode implementation
+type SimpleChaincode struct {
+}
+
+type Bill struct {
+	BillId		string
+	Maker		string
+	Acceptor	string
+	Receiver	string //Receiver name	
+	IssueDate	int64
+	ExpireDate	int64
+	RecBank		string //Name of receiver's Bank
+	Amount		int //Amount of money 
+	Type		int //0:taels 1:Business 
+	Form		int //0:paper 1:electronic 
+	Status		int //0: 1: 2: 3: 4: 5: 
+}
+
+// Record all operation include the create/change or the bill
+
+type Transaction struct {
+
+	BillId		string
+	Operation	string
+	BillStatus	int
+	Time		int64
+	ID		int
+}
+
+func (t *SimpleChaincode) Init(stub shim.ChaincodeStubInterface) pb.Response {
+	fmt.Println("Chaicode_Meidi Init")
+
+	// Write the state to the ledger
+	err := stub.PutState("MeiDiFabric", []byte("This is the block chain for MeiDiBill system..."))
+	if err != nil {
+		return shim.Error(err.Error())
+	}
+
+	return shim.Success(nil)
+}
+
+func (t *SimpleChaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response {
+	fmt.Println("ChainCode_Meidi Invoke")
+	function, args := stub.GetFunctionAndParameters()
+	if function == "createBill" {
+		// Create the Bill 
+		return t.createBill(stub, args)
+	} else if function == "changeBillStatus" {
+		// Change the status of Bill  
+		return t.changeBillStatus(stub, args)
+	} else if function == "queryBill" {
+		//Query the Bill info from fabric 
+		return t.queryBill(stub, args)
+	} else if function == "queryTransaction" {
+		//Query the Bill info from fabric 
+		return t.queryTransaction(stub, args)
+	}
+
+	return shim.Error("Invalid invoke function name. Expecting \"createBill\" \"changeBillStaus\" \"queryBill\" \"queryTransaction\"")
+}
+
+
+// Deletes an entity from state
+func (t *SimpleChaincode) delete(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+	if len(args) != 1 {
+		return shim.Error("Incorrect number of arguments. Expecting 1")
+	}
+
+	A := args[0]
+
+	// Delete the key from the state in ledger
+	err := stub.DelState(A)
+	if err != nil {
+		return shim.Error("Failed to delete state")
+	}
+
+	return shim.Success(nil)
+}
+
+
+func (t *SimpleChaincode) createBill(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+
+	if len(args) != 11 {
+		return shim.Error("createBill(): Incorrect number of arguments. Expecting 11")
+	}
+
+	var bill	Bill
+	var t_issue	time.Time
+	var t_expire	time.Time
+	var err		error
+	var amount	int
+	var billtype	int
+	var form	int
+	var status	int
+	var billBytes []byte
+
+	layout := "2006-01-02 15:04:05"
+	t_issue, err =  time.Parse(layout, args[4])
+	if err != nil {
+		jsonResp := "{\"Error\":\"Failed to pharse the time, plese follow the fomat as" + layout + "\"}"
+		return shim.Error(jsonResp)
+	}
+
+	t_expire, err =  time.Parse(layout, args[5])
+	if err != nil {
+		jsonResp := "{\"Error\":\"Failed to pharse the time, plese follow the fomat " + layout + "\"}"
+		return shim.Error(jsonResp)
+	}
+
+	amount, err = strconv.Atoi(args[7])
+	if err != nil {
+		return shim.Error("Expecting integer value for asset holding")
+	}
+
+	billtype, err = strconv.Atoi(args[8])
+	if err != nil {
+		return shim.Error("Expecting integer value for asset holding")
+	}
+
+	form, err = strconv.Atoi(args[9])
+	if err != nil {
+		return shim.Error("Expecting integer value for asset holding")
+	}
+
+	status, err = strconv.Atoi(args[10])
+	if err != nil {
+		return shim.Error("Expecting integer value for asset holding")
+	}
+
+	bill = Bill{BillId:args[0], Maker: args[1], Acceptor: args[2], Receiver: args[3], IssueDate: t_issue.Unix(), ExpireDate: t_expire.Unix(), RecBank: args[6], Amount: amount, Type: billtype, Form: form, Status: status}
+
+	err = writeBill(stub, bill)
+
+	if err != nil {
+		return shim.Error("createBill(): Fail to write the bill" + err.Error())
+	}
+
+	billBytes, err = json.Marshal(&bill)
+	if err != nil {
+		return shim.Error("createBill():" + err.Error())
+	}
+
+//Any operation of Bill will treat as transaction.
+
+	transaction := Transaction{BillId: args[0], Operation: "Create", BillStatus: status, Time: time.Now().Unix(), ID: transactionNo }
+
+	err = writeTransaction(stub, transaction)
+	if err != nil {
+		return shim.Error("createBill(): Fail to write the transaction" + err.Error())
+	}
+
+	transactionNo += 1
+
+	return shim.Success(billBytes)
+
+}
+
+
+// Change the Bill status
+func (t *SimpleChaincode) changeBillStatus(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+	if len(args) != 2 {
+		return shim.Error("changeBillStatus(): Incorrect number of arguments. Expecting 2")
+	}
+
+	var bill Bill
+
+	status, err := strconv.Atoi(args[1])
+	if err != nil {
+		return shim.Error("changeBillStatus(): status want Integer number")
+	}
+
+	bill,_,err = getBillById(stub, args[0])
+	if err != nil {
+
+		return shim.Error("changeBillStatus(): Fail to get Bill" + err.Error())
+
+	}
+	bill.Status = status
+
+	err = writeBill(stub, bill)
+
+	if err != nil {
+		shim.Error("changeBillStatus():fail to write Bill" + err.Error())
+	}
+
+	transaction := Transaction{BillId: args[0], Operation: "changeStatus", BillStatus: status, Time: time.Now().Unix(), ID: transactionNo }
+
+	err = writeTransaction(stub, transaction)
+	if err != nil {
+		return shim.Error("changeBillStatus(): Fail to write the transaction" + err.Error())
+	}
+
+	transactionNo += 1
+
+	return shim.Success(nil)
+}
+
+// Query Bill info 
+func (t *SimpleChaincode) queryBill(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+
+	if len(args) != 1 {
+		return shim.Error("queryBill(): Incorrect number of arguments. Expecting 1")
+	}
+
+	_,billBytes,err := getBillById(stub,args[0])
+
+	if err != nil {
+		shim.Error("queryBill(): Fail to get Bill" +  err.Error())
+	}
+
+	return shim.Success(billBytes)
+
+}
+
+// Query Transaction info 
+func (t *SimpleChaincode) queryTransaction(stub shim.ChaincodeStubInterface, args []string) pb.Response {
+
+	if len(args) != 1 {
+		return shim.Error("queryTransaction(): Incorrect number of arguments. Expecting 1")
+	}
+
+	_,transBytes,err := getTransactionById(stub,args[0])
+
+	if err != nil {
+		return shim.Error("queryBill(): Fail to get Bill" +  err.Error())
+	}
+
+	return shim.Success(transBytes)
+
+}
+
+
+// Write Bill info into the fabric
+func writeBill(stub shim.ChaincodeStubInterface, bill Bill) error {
+
+	billBytes, err := json.Marshal(&bill)
+	if err != nil {
+		return errors.New("writeBill():" + err.Error())
+	}
+	err = stub.PutState("bill"+bill.BillId, billBytes)
+	if err != nil {
+		return errors.New("writeBill(): PutState Error" + err.Error())
+	}
+	return nil
+}
+
+//Write the transaction info into the Fabric
+func writeTransaction(stub shim.ChaincodeStubInterface, transaction Transaction) error {
+	var tsId string
+	tsBytes, err := json.Marshal(&transaction)
+	if err != nil {
+		return errors.New("writeTransaction():" + err.Error())
+	}
+	tsId = strconv.Itoa(transaction.ID)
+	if err != nil {
+		return errors.New("writeTransaction(): want Integer number")
+	}
+	err = stub.PutState("transaction"+tsId, tsBytes)
+	if err != nil {
+		return errors.New("writeTransaction(): PutState Error" + err.Error())
+	}
+	return nil
+}
+
+func getBillById(stub shim.ChaincodeStubInterface, id string) (Bill, []byte, error) {
+	var bill Bill
+	billBytes, err := stub.GetState("bill" + id)
+	if err != nil {
+		fmt.Println("Error retrieving cpBytes")
+	}
+	err = json.Unmarshal(billBytes, &bill)
+	if err != nil {
+		fmt.Println("Error unmarshalling Bill")
+	}
+	return bill, billBytes, nil
+}
+
+
+
+func getTransactionById(stub shim.ChaincodeStubInterface, id string) (Transaction, []byte, error) {
+	var transaction Transaction
+	transBytes, err := stub.GetState("transaction" + id)
+	if err != nil {
+		fmt.Println("Error retrieving transBytes")
+	}
+	err = json.Unmarshal(transBytes, &transaction)
+	if err != nil {
+		fmt.Println("Error unmarshalling transaction")
+	}
+	return transaction, transBytes, nil
+}
+
+func main() {
+	err := shim.Start(new(SimpleChaincode))
+	if err != nil {
+		fmt.Printf("Error starting Simple chaincode: %s", err)
+	}
+}

+ 30 - 0
generateCfgTrx.sh

@@ -0,0 +1,30 @@
+#!/bin/bash
+
+CHANNEL_NAME=$1
+if [ -z "$1" ]; then
+	echo "Setting channel to default name 'mychannel'"
+	CHANNEL_NAME="mychannel"
+fi
+
+echo "Channel name - "$CHANNEL_NAME
+echo
+
+#Backup the original configtx.yaml
+cp ../../common/configtx/tool/configtx.yaml ../../common/configtx/tool/configtx.yaml.orig
+cp configtx.yaml ../../common/configtx/tool/configtx.yaml
+
+cd $PWD/../../
+echo "Building configtxgen"
+make configtxgen
+
+echo "Generating genesis block"
+./build/bin/configtxgen -profile TwoOrgs -outputBlock orderer.block
+mv orderer.block examples/meidi/crypto/orderer/orderer.block
+
+echo "Generating channel configuration transaction"
+./build/bin/configtxgen -profile TwoOrgs -outputCreateChannelTx channel.tx -channelID $CHANNEL_NAME
+mv channel.tx examples/meidi/crypto/orderer/channel.tx
+
+#reset configtx.yaml file to its original
+cp common/configtx/tool/configtx.yaml.orig common/configtx/tool/configtx.yaml
+rm common/configtx/tool/configtx.yaml.orig

+ 76 - 0
network_setup.sh

@@ -0,0 +1,76 @@
+#!/bin/bash
+
+UP_DOWN=$1
+CH_NAME=$2
+
+COMPOSE_FILE=docker-compose-cli.yaml
+
+function printHelp () {
+	echo "Usage: ./network_setup <up|down> <channel-name>"
+}
+
+function validateArgs () {
+	if [ -z "${UP_DOWN}" ]; then
+		echo "Option up / down / restart not mentioned"
+		printHelp
+		exit 1
+	fi
+	if [ -z "${CH_NAME}" ]; then
+		echo "setting to default channel 'mychannel'"
+		CH_NAME=mychannel
+	fi
+}
+
+function clearContainers () {
+        CONTAINER_IDS=$(docker ps -aq)
+        if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" = " " ]; then
+                echo "---- No containers available for deletion ----"
+        else
+                docker rm -f $CONTAINER_IDS
+        fi
+}
+
+function removeUnwantedImages() {
+        DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}')
+        if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" = " " ]; then
+                echo "---- No images available for deletion ----"
+        else
+                docker rmi -f $DOCKER_IMAGE_IDS
+        fi
+}
+
+function networkUp () {
+	CURRENT_DIR=$PWD
+        source generateCfgTrx.sh $CH_NAME
+	cd $CURRENT_DIR
+
+	CHANNEL_NAME=$CH_NAME docker-compose -f $COMPOSE_FILE up -d 2>&1
+	if [ $? -ne 0 ]; then
+		echo "ERROR !!!! Unable to pull the images "
+		exit 1
+	fi
+	docker logs -f cli
+}
+
+function networkDown () {
+        docker-compose -f $COMPOSE_FILE down
+        #Cleanup the chaincode containers
+	clearContainers
+	#Cleanup images
+	removeUnwantedImages
+}
+
+validateArgs
+
+#Create the network using docker compose
+if [ "${UP_DOWN}" == "up" ]; then
+	networkUp
+elif [ "${UP_DOWN}" == "down" ]; then ## Clear the network
+	networkDown
+elif [ "${UP_DOWN}" == "restart" ]; then ## Restart the network
+	networkDown
+	networkUp
+else
+	printHelp
+	exit 1
+fi

+ 109 - 0
pack.sh

@@ -0,0 +1,109 @@
+#!/bin/bash
+project=meidi
+channel=mychannel
+docker_peer_images="hyperledger/fabric-peer:x86_64-1.0.0-alpha"
+docker_couchdb_images="hyperledger/fabric-couchdb:x86_64-1.0.0-alpha"
+docker_orderer_images="docker.io/hyperledger/fabric-orderer:x86_64-1.0.0-alpha"
+docker_ccenv_images="docker.io/hyperledger/fabric-ccenv:x86_64-1.0.0-alpha"
+docker_baseos_images="docker.io/hyperledger/fabric-baseos:x86_64-0.3.0"
+
+rm -rf "$project"_*
+
+function create_cli() {
+    rm -rf "$projec"_cli
+    mkdir -p "$project"_cli
+
+    echo "docker pull $docker_peer_images" >> "$project"_cli/download-dockerimages.sh
+    echo "docker tag $docker_peer_images hyperledger/fabric-peer" >> "$project"_cli/download-dockerimages.sh
+    echo "CHANNEL_NAME=$channel ./docker-compose -f docker-compose-cli.yaml up -d " >> "$project"_cli/start.sh
+    echo "docker logs -f cli" >> "$project"_cli/start.sh
+    chmod u+x "$project"_cli/download-dockerimages.sh
+    chmod u+x "$project"_cli/start.sh
+
+    mkdir -p "$project"_cli/scripts
+    cp -rf examples "$project"_cli
+    cp -rf crypto "$project"_cli
+    cp -rf scripts "$project"_cli
+    cp -rf docker-compose "$project"_cli
+    cp -rf docker-compose-cli.yaml "$project"_cli
+
+    tar -cvf "$project"_cli.tar "$project"_cli
+    gzip "$project"_cli.tar
+    rm -rf "$project"_cli
+}
+
+function create_orderer() {
+    while read -s -n1 -p "Are you want to generateCfgTrx channel.tx and orderer.block ? [y|n]" input
+    do
+        case $input in
+        Y|y)
+            echo "generateCfgTrx"
+    	    CURRENT_DIR=$PWD
+            source generateCfgTrx.sh $channel
+            cd $CURRENT_DIR
+	    break;;
+        N|n)
+            echo "skip generateCfgTrx"
+	    break;;
+        *)
+            echo "input error";;
+        esac
+    done
+
+
+    rm -rf "$project"_orderer
+    mkdir -p "$project"_orderer
+    echo "docker pull $docker_orderer_images" >> "$project"_orderer/download-dockerimages.sh
+    echo "docker tag $docker_orderer_images hyperledger/fabric-orderer" >> "$project"_orderer/download-dockerimages.sh
+    echo "CHANNEL_NAME=$channel ./docker-compose -f docker-compose-orderer0.yaml up -d " >> "$project"_orderer/start.sh
+    chmod u+x "$project"_orderer/download-dockerimages.sh
+    chmod u+x "$project"_orderer/start.sh
+
+    mkdir -p "$project"_orderer/crypto
+    cp -rf crypto/orderer "$project"_orderer/crypto
+    cp -rf docker-compose "$project"_orderer
+    cp -rf docker-compose-orderer0.yaml "$project"_orderer
+    tar -cvf "$project"_orderer0.tar "$project"_orderer
+    gzip "$project"_orderer0.tar
+    rm -rf "$project"_orderer
+}
+
+function create_peer() {
+    rm -rf $project
+    mkdir -p $project
+
+    for N in 0 1 2 3 ; do
+        rm -rf $project
+        mkdir -p $project
+        echo "CHANNEL_NAME=$channel ./docker-compose -f docker-compose-peer"$N".yaml up -d " >> $project/start.sh
+        echo "docker pull $docker_peer_images" >> $project/download-dockerimages.sh
+        echo "docker tag $docker_peer_images hyperledger/fabric-peer" >> $project/download-dockerimages.sh
+        echo "docker pull $docker_couchdb_images" >> $project/download-dockerimages.sh
+        echo "docker tag $docker_couchdb_images hyperledger/fabric-couchdb" >> $project/download-dockerimages.sh
+        echo "docker pull $docker_ccenv_images" >> $project/download-dockerimages.sh
+        echo "docker tag $docker_ccenv_images hyperledger/fabric-ccenv" >> $project/download-dockerimages.sh
+        echo "docker pull $docker_baseos_images" >> $project/download-dockerimages.sh
+        chmod u+x $project/start.sh
+        chmod u+x $project/download-dockerimages.sh
+
+        mkdir -p ./$project/peer-base
+        mkdir -p ./$project/crypto/peer/peer$N/localMspConfig
+        cp -rf docker-compose $project
+        cp -rf docker-compose-peer"$N".yaml $project
+        cp -rf peer-base/peer-base.yaml $project/peer-base/peer-base.yaml
+        cp -rf crypto/peer/peer$N/localMspConfig/* $project/crypto/peer/peer$N/localMspConfig/
+        tar -cvf "$project"_peer$N.tar $project
+        gzip "$project"_peer$N.tar
+        rm -rf $project
+    done
+
+    rm -rf $project
+}
+
+
+create_orderer
+
+create_cli
+
+create_peer
+

+ 18 - 0
peer-base/peer-base-no-tls.yaml

@@ -0,0 +1,18 @@
+version: '2'
+services:
+  peer-base:
+    image: hyperledger/fabric-peer
+    environment:
+      - CORE_PEER_ADDRESSAUTODETECT=true
+      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
+      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=e2ecli_default
+      - CORE_LOGGING_LEVEL=ERROR
+      #- CORE_LOGGING_LEVEL=DEBUG
+      - CORE_NEXT=true
+      - CORE_PEER_TLS_ENABLED=false
+      - CORE_PEER_ENDORSER_ENABLED=true
+      - CORE_PEER_GOSSIP_ORGLEADER=false
+      - CORE_PEER_GOSSIP_USELEADERELECTION=true
+      - CORE_PEER_PROFILE_ENABLED=true
+    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
+    command: peer node start --peer-defaultchain=false

+ 24 - 0
peer-base/peer-base.yaml

@@ -0,0 +1,24 @@
+version: '2'
+services:
+  peer-base:
+    image: hyperledger/fabric-peer
+    environment:
+      #- CORE_PEER_ADDRESSAUTODETECT=true
+      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
+      # the following setting starts chaincode containers on the same
+      # bridge network as the peers
+      # https://docs.docker.com/compose/networking/
+      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=meidi_default
+      #- CORE_LOGGING_LEVEL=ERROR
+      - CORE_LOGGING_LEVEL=DEBUG
+      - CORE_PEER_TLS_ENABLED=true
+      - CORE_NEXT=true
+      - CORE_PEER_ENDORSER_ENABLED=true
+      - CORE_PEER_GOSSIP_USELEADERELECTION=true
+      - CORE_PEER_GOSSIP_ORGLEADER=false
+      # The following setting skips the gossip handshake since we are
+      # are not doing mutual TLS
+      - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
+      - CORE_PEER_PROFILE_ENABLED=true
+    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
+    command: peer node start --peer-defaultchain=false

+ 178 - 0
scripts/script.sh

@@ -0,0 +1,178 @@
+#!/bin/bash
+
+CHANNEL_NAME="$1"
+: ${CHANNEL_NAME:="mychannel"}
+: ${TIMEOUT:="60"}
+COUNTER=0
+MAX_RETRY=5
+ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
+
+echo "Channel name : "$CHANNEL_NAME
+
+verifyResult () {
+	if [ $1 -ne 0 ] ; then
+		echo "!!!!!!!!!!!!!!! "$2" !!!!!!!!!!!!!!!!"
+                echo "================== ERROR !!! FAILED to execute End-2-End Scenario =================="
+		echo
+   		exit 1
+	fi
+}
+
+setGlobals () {
+
+	CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer$1/localMspConfig
+
+	CORE_PEER_ADDRESS=peer$1:7051
+
+	if [ $1 -eq 0 -o $1 -eq 1 ] ; then
+		CORE_PEER_LOCALMSPID="Org0MSP"
+		CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer$1/localMspConfig/cacerts/peerOrg0.pem
+	else
+		CORE_PEER_LOCALMSPID="Org1MSP"
+		CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer$1/localMspConfig/cacerts/peerOrg1.pem
+	fi
+	env |grep CORE
+}
+
+createChannel() {
+	CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig
+	CORE_PEER_LOCALMSPID="OrdererMSP"
+
+        if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
+		peer channel create -o orderer0:7050 -c $CHANNEL_NAME -f crypto/orderer/channel.tx >&log.txt
+	else
+		peer channel create -o orderer0:7050 -c $CHANNEL_NAME -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt
+	fi
+	res=$?
+	cat log.txt
+	verifyResult $res "Channel creation failed"
+	echo "===================== Channel \"$CHANNEL_NAME\" is created successfully ===================== "
+	echo
+}
+
+## Sometimes Join takes time hence RETRY atleast for 5 times
+joinWithRetry () {
+	peer channel join -b $CHANNEL_NAME.block  >&log.txt
+	res=$?
+	cat log.txt
+	if [ $res -ne 0 -a $COUNTER -lt $MAX_RETRY ]; then
+		COUNTER=` expr $COUNTER + 1`
+		echo "PEER$1 failed to join the channel, Retry after 2 seconds"
+		sleep 2
+		joinWithRetry $1
+	else
+		COUNTER=0
+	fi
+        verifyResult $res "After $MAX_RETRY attempts, PEER$ch has failed to Join the Channel"
+}
+
+joinChannel () {
+	for ch in 0 1 2 3; do
+		setGlobals $ch
+		joinWithRetry $ch
+		echo "===================== PEER$ch joined on the channel \"$CHANNEL_NAME\" ===================== "
+		sleep 2
+		echo
+	done
+}
+
+installChaincode () {
+	PEER=$1
+	setGlobals $PEER
+	peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 >&log.txt
+	res=$?
+	cat log.txt
+        verifyResult $res "Chaincode installation on remote peer PEER$PEER has Failed"
+	echo "===================== Chaincode is installed on remote peer PEER$PEER ===================== "
+	echo
+}
+
+instantiateChaincode () {
+	PEER=$1
+	setGlobals $PEER
+        if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
+		peer chaincode instantiate -o orderer0:7050 -C $CHANNEL_NAME -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR	('Org0MSP.member','Org1MSP.member')" >&log.txt
+	else
+		peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR	('Org0MSP.member','Org1MSP.member')" >&log.txt
+	fi
+	res=$?
+	cat log.txt
+	verifyResult $res "Chaincode instantiation on PEER$PEER on channel '$CHANNEL_NAME' failed"
+	echo "===================== Chaincode Instantiation on PEER$PEER on channel '$CHANNEL_NAME' is successful ===================== "
+	echo
+}
+
+chaincodeQuery () {
+  PEER=$1
+  echo "===================== Querying on PEER$PEER on channel '$CHANNEL_NAME'... ===================== "
+  setGlobals $PEER
+  local rc=1
+  local starttime=$(date +%s)
+
+  # continue to poll
+  # we either get a successful response, or reach TIMEOUT
+  while test "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0
+  do
+     sleep 3
+     echo "Attempting to Query PEER$PEER ...$(($(date +%s)-starttime)) secs"
+     peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}' >&log.txt
+     test $? -eq 0 && VALUE=$(cat log.txt | awk '/Query Result/ {print $NF}')
+     test "$VALUE" = "$2" && let rc=0
+  done
+  echo
+  cat log.txt
+  if test $rc -eq 0 ; then
+	echo "===================== Query on PEER$PEER on channel '$CHANNEL_NAME' is successful ===================== "
+  else
+	echo "!!!!!!!!!!!!!!! Query result on PEER$PEER is INVALID !!!!!!!!!!!!!!!!"
+        echo "================== ERROR !!! FAILED to execute End-2-End Scenario =================="
+	echo
+  fi
+}
+
+chaincodeInvoke () {
+        PEER=$1
+        if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
+		peer chaincode invoke -o orderer0:7050 -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}' >&log.txt
+	else
+		peer chaincode invoke -o orderer0:7050  --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}' >&log.txt
+	fi
+	res=$?
+	cat log.txt
+	verifyResult $res "Invoke execution on PEER$PEER failed "
+	echo "===================== Invoke transaction on PEER$PEER on channel '$CHANNEL_NAME' is successful ===================== "
+	echo
+}
+
+## Create channel
+createChannel
+
+## Join all the peers to the channel
+joinChannel
+
+
+## Install chaincode on Peer0/Org0 and Peer2/Org1
+installChaincode 0
+installChaincode 2
+
+#Instantiate chaincode on Peer2/Org1
+echo "Instantiating chaincode on Peer2/Org1 ..."
+instantiateChaincode 0
+
+#Query on chaincode on Peer0/Org0
+chaincodeQuery 0 100
+
+#Invoke on chaincode on Peer0/Org0
+echo "send Invoke transaction on Peer0/Org0 ..."
+chaincodeInvoke 0
+
+## Install chaincode on Peer3/Org1
+installChaincode 3
+
+#Query on chaincode on Peer3/Org1, check if the result is 90
+chaincodeQuery 3 90
+
+echo
+echo "===================== All GOOD, End-2-End execution completed ===================== "
+echo
+exit 0

+ 178 - 0
scripts/script.sh_bak

@@ -0,0 +1,178 @@
+#!/bin/bash
+
+CHANNEL_NAME="$1"
+: ${CHANNEL_NAME:="mychannel"}
+: ${TIMEOUT:="60"}
+COUNTER=0
+MAX_RETRY=5
+ORDERER_CA=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
+
+echo "Channel name : "$CHANNEL_NAME
+
+verifyResult () {
+	if [ $1 -ne 0 ] ; then
+		echo "!!!!!!!!!!!!!!! "$2" !!!!!!!!!!!!!!!!"
+                echo "================== ERROR !!! FAILED to execute End-2-End Scenario =================="
+		echo
+   		exit 1
+	fi
+}
+
+setGlobals () {
+
+	CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer$1/localMspConfig
+	CORE_PEER_ADDRESS=peer$1:7051
+
+	if [ $1 -eq 0 -o $1 -eq 1 ] ; then
+		CORE_PEER_LOCALMSPID="Org0MSP"
+		CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer$1/localMspConfig/cacerts/peerOrg0.pem
+	else
+		CORE_PEER_LOCALMSPID="Org1MSP"
+		CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer$1/localMspConfig/cacerts/peerOrg1.pem
+	fi
+	env |grep CORE
+}
+
+createChannel() {
+	CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig
+	CORE_PEER_LOCALMSPID="OrdererMSP"
+
+        if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
+		peer channel create -o orderer0:7050 -c $CHANNEL_NAME -f crypto/orderer/channel.tx >&log.txt
+	else
+		peer channel create -o orderer0:7050 -c $CHANNEL_NAME -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA >&log.txt
+	fi
+	res=$?
+	cat log.txt
+	verifyResult $res "Channel creation failed"
+	echo "===================== Channel \"$CHANNEL_NAME\" is created successfully ===================== "
+	echo
+}
+
+## Sometimes Join takes time hence RETRY atleast for 5 times
+joinWithRetry () {
+	peer channel join -b $CHANNEL_NAME.block  >&log.txt
+	res=$?
+	cat log.txt
+	if [ $res -ne 0 -a $COUNTER -lt $MAX_RETRY ]; then
+		COUNTER=` expr $COUNTER + 1`
+		echo "PEER$1 failed to join the channel, Retry after 2 seconds"
+		sleep 2
+		joinWithRetry $1
+	else
+		COUNTER=0
+	fi
+        verifyResult $res "After $MAX_RETRY attempts, PEER$ch has failed to Join the Channel"
+}
+
+joinChannel () {
+	for ch in 0 1 2 3; do
+		setGlobals $ch
+		joinWithRetry $ch
+		echo "===================== PEER$ch joined on the channel \"$CHANNEL_NAME\" ===================== "
+		sleep 2
+		echo
+	done
+}
+
+installChaincode () {
+	PEER=$1
+	setGlobals $PEER
+	#peer chaincode install -n meidi -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_meidi >&log.txt
+	peer chaincode install -n meidi -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 >&log.txt
+	res=$?
+	cat log.txt
+        verifyResult $res "Chaincode installation on remote peer PEER$PEER has Failed"
+	echo "===================== Chaincode is installed on remote peer PEER$PEER ===================== "
+	echo
+}
+
+instantiateChaincode () {
+	PEER=$1
+	setGlobals $PEER
+        if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
+		peer chaincode instantiate -o orderer0:7050 -C $CHANNEL_NAME -n meidi -v 1.0 -c '{"Args":["init","a","100","b","200"]}' -P "OR	('Org0MSP.member','Org1MSP.member')" >&log.txt
+	else
+		peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n meidi -v 1.0 -c '{"Args":["init","a"]}' -P "OR ('Org0MSP.member','Org1MSP.member')" >&log.txt
+	fi
+	res=$?
+	cat log.txt
+	verifyResult $res "Chaincode instantiation on PEER$PEER on channel '$CHANNEL_NAME' failed"
+	echo "===================== Chaincode Instantiation on PEER$PEER on channel '$CHANNEL_NAME' is successful ===================== "
+	echo
+}
+
+chaincodeQuery () {
+  PEER=$1
+  echo "===================== Querying on PEER$PEER on channel '$CHANNEL_NAME'... ===================== "
+  setGlobals $PEER
+  local rc=1
+  local starttime=$(date +%s)
+
+  # continue to poll
+  # we either get a successful response, or reach TIMEOUT
+  while test "$(($(date +%s)-starttime))" -lt "$TIMEOUT" -a $rc -ne 0
+  do
+     sleep 3
+     echo "Attempting to Query PEER$PEER ...$(($(date +%s)-starttime)) secs"
+     peer chaincode query -C $CHANNEL_NAME -n mycc -c '{"Args":["query","a"]}' >&log.txt
+     test $? -eq 0 && VALUE=$(cat log.txt | awk '/Query Result/ {print $NF}')
+     test "$VALUE" = "$2" && let rc=0
+  done
+  echo
+  cat log.txt
+  if test $rc -eq 0 ; then
+	echo "===================== Query on PEER$PEER on channel '$CHANNEL_NAME' is successful ===================== "
+  else
+	echo "!!!!!!!!!!!!!!! Query result on PEER$PEER is INVALID !!!!!!!!!!!!!!!!"
+        echo "================== ERROR !!! FAILED to execute End-2-End Scenario =================="
+	echo
+  fi
+}
+
+chaincodeInvoke () {
+        PEER=$1
+        if [ -z "$CORE_PEER_TLS_ENABLED" -o "$CORE_PEER_TLS_ENABLED" = "false" ]; then
+		peer chaincode invoke -o orderer0:7050 -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}' >&log.txt
+	else
+		peer chaincode invoke -o orderer0:7050  --tls $CORE_PEER_TLS_ENABLED --cafile $ORDERER_CA -C $CHANNEL_NAME -n mycc -c '{"Args":["invoke","a","b","10"]}' >&log.txt
+	fi
+	res=$?
+	cat log.txt
+	verifyResult $res "Invoke execution on PEER$PEER failed "
+	echo "===================== Invoke transaction on PEER$PEER on channel '$CHANNEL_NAME' is successful ===================== "
+	echo
+}
+
+## Create channel
+createChannel
+
+## Join all the peers to the channel
+joinChannel
+
+
+## Install chaincode on Peer0/Org0 and Peer2/Org1
+installChaincode 0
+installChaincode 2
+
+#Instantiate chaincode on Peer2/Org1
+echo "Instantiating chaincode on Peer2/Org1 ..."
+instantiateChaincode 0
+
+#Query on chaincode on Peer0/Org0
+chaincodeQuery 0 100
+
+#Invoke on chaincode on Peer0/Org0
+echo "send Invoke transaction on Peer0/Org0 ..."
+chaincodeInvoke 0
+
+## Install chaincode on Peer3/Org1
+installChaincode 3
+
+#Query on chaincode on Peer3/Org1, check if the result is 90
+chaincodeQuery 3 90
+
+echo
+echo "===================== All GOOD, End-2-End execution completed ===================== "
+echo
+exit 0

+ 95 - 0
setup.sh

@@ -0,0 +1,95 @@
+#!/bin/bash
+
+DOCKER_NAME=$1
+UP_DOWN=$2
+CH_NAME=$3
+
+function printHelp () {
+	echo "Usage: ./network_setup cli|orderer0 <up|down> <channel-name>"
+}
+
+function validateArgs () {
+        if [ -z "${DOCKER_NAME}" ]; then 
+		echo "Option cli / orderer0 not mentioned"
+		printHelp
+		exit 1
+	fi
+	if [ -z "${UP_DOWN}" ]; then
+		echo "Option up / down / restart not mentioned"
+		printHelp
+		exit 1
+	fi
+	if [ -z "${CH_NAME}" ]; then
+		echo "setting to default channel 'mychannel'"
+		CH_NAME=mychannel
+	fi
+}
+
+function clearContainers () {
+        CONTAINER_IDS=$(docker ps -aq)
+        if [ -z "$CONTAINER_IDS" -o "$CONTAINER_IDS" = " " ]; then
+                echo "---- No containers available for deletion ----"
+        else
+                docker rm -f $CONTAINER_IDS
+        fi
+}
+
+function removeUnwantedImages() {
+        DOCKER_IMAGE_IDS=$(docker images | grep "dev\|none\|test-vp\|peer[0-9]-" | awk '{print $3}')
+        if [ -z "$DOCKER_IMAGE_IDS" -o "$DOCKER_IMAGE_IDS" = " " ]; then
+                echo "---- No images available for deletion ----"
+        else
+                docker rmi -f $DOCKER_IMAGE_IDS
+        fi
+}
+
+function networkUp () {
+	if [ "${DOCKER_NAME}" == "cli" ]; then
+		COMPOSE_FILE=docker-compose-cli.yaml
+	elif [ "${DOCKER_NAME}" == "orderer0" ]; then
+		COMPOSE_FILE=docker-compose-orderer0.yaml
+	else
+		echo "Option cli /orderer0 not mentioned"
+		exit 1
+	fi
+
+	CHANNEL_NAME=$CH_NAME docker-compose -f $COMPOSE_FILE up -d 2>&1
+	if [ $? -ne 0 ]; then
+		echo "ERROR !!!! Unable to pull the images "
+		exit 1
+	fi
+
+	if [ "${DOCKER_NAME}" == "cli" ]; then
+		docker logs -f cli
+	fi
+}
+
+function networkDown () {
+	if [ "${DOCKER_NAME}" == "cli" ]; then
+		COMPOSE_FILE=docker-compose-cli.yaml
+	elif [ "${DOCKER_NAME}" == "orderer0" ]; then
+		COMPOSE_FILE=docker-compose-orderer0.yaml
+	else
+		COMPOSE_FILE=
+	fi
+        docker-compose -f $COMPOSE_FILE down
+        #Cleanup the chaincode containers
+	clearContainers
+	#Cleanup images
+	removeUnwantedImages
+}
+
+validateArgs
+
+#Create the network using docker compose
+if [ "${UP_DOWN}" == "up" ]; then
+	networkUp
+elif [ "${UP_DOWN}" == "down" ]; then ## Clear the network
+	networkDown
+elif [ "${UP_DOWN}" == "restart" ]; then ## Restart the network
+	networkDown
+	networkUp
+else
+	printHelp
+	exit 1
+fi