IBM-Blockchain / blockchain-vscode-extension

IBM Blockchain Platform extension for Visual Studio Code (this project is no longer active)
https://marketplace.visualstudio.com/items?itemName=IBMBlockchain.ibm-blockchain-platform
Other
266 stars 156 forks source link

Commercial Paper Error #945

Closed austingrice closed 5 years ago

austingrice commented 5 years ago

I'm trying to run commercial paper located here: https://ibm-blockchain-wsc.github.io/ImmersionWorkshop/vscode-part2/#section-2-setting-the-stage but it is very similar (I think exactly the same) to the commercial paper found in the Hyperledger docs.

Description

I'm getting an error on authorization when installing the commercial paper smart contract via the hyperledger/fabric-tools container.

Austins-MacBook-Pro:cli Austin$ docker exec cliMagnetoCorp peer chaincode install -n papercontract -v 0 -p /opt/gopath/src/github.com/contract -l node
2019-05-08 14:43:30.560 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 001 Using default escc
2019-05-08 14:43:30.562 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 002 Using default vscc
Error: Error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [] creator org [Org1MSP]

I've tried this locally and have had success installing the smart contract via the same container. My local_fabric network is up and running with no issues. I did a clean teardown as well.

[5/7/2019 5:16:08 PM] [INFO] if ! docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" fabricvscodelocalfabric_peer0.org1.example.com peer channel getinfo -c mychannel
[5/7/2019 5:16:08 PM] [INFO] then
[5/7/2019 5:16:08 PM] [INFO]     # Create the channel
[5/7/2019 5:16:08 PM] [INFO]     docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" fabricvscodelocalfabric_peer0.org1.example.com peer channel create -o orderer.example.com:17050 -c mychannel -f /etc/hyperledger/configtx/channel.tx
[5/7/2019 5:16:08 PM] [INFO]     # Update the channel with the anchor peers
[5/7/2019 5:16:08 PM] [INFO]     docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" fabricvscodelocalfabric_peer0.org1.example.com peer channel update -o orderer.example.com:17050 -c mychannel -f /etc/hyperledger/configtx/Org1MSPanchors.tx
[5/7/2019 5:16:08 PM] [INFO]     # Join peer0.org1.example.com to the channel.
[5/7/2019 5:16:08 PM] [INFO]     docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" fabricvscodelocalfabric_peer0.org1.example.com peer channel join -b mychannel.block
[5/7/2019 5:16:08 PM] [INFO] fi
[5/7/2019 5:16:08 PM] [INFO] Hyperledger Fabric started in 4 seconds
[5/7/2019 5:16:08 PM] [INFO] 2019-05-07 21:16:08.691 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
[5/7/2019 5:16:08 PM] [INFO] Blockchain info: {"height":2,"currentBlockHash":"DFvNiQY4EQ9iPNCUK23D++pQQDjwj0J477WlM9ZGv4Q=","previousBlockHash":"htkk/GmV6rgTN6wfUATz+COttBjgUx3JM1PSnglGH2o="}

Further, my admin identity is in my wallet within the IBP extension.

I have modified the docker-compse.yaml file to match up with my network.

#
# Copyright IBM Corp All Rights Reserved
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'

networks:
  basic:
    external:
      name: fabricvscodelocalfabric_basic

services:
  cliMagnetoCorp:
    container_name: cliMagnetoCorp
    image: hyperledger/fabric-tools
    tty: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - FABRIC_LOGGING_SPEC=info
      - CORE_PEER_ID=cli
      - CORE_PEER_ADDRESS=peer0.org1.example.com:17051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
      - CORE_CHAINCODE_KEEPALIVE=10
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
        - /var/run/:/host/var/run/
        - ./../../../../organization/magnetocorp:/opt/gopath/src/github.com/
        - ./../../../../../basic-network/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    networks:
        - basic
    #depends_on:
    #  - orderer.example.com
    #  - peer0.org1.example.com
    #  - couchdb

I do notice CORE_PEER_ID which I've never seen before and can't find in the Fabric docs.

This all worked in 0.3.x and now I'm hitting these issues with 0.4.0.

Expected Behavior

Installation of the commercial paper smart contract

Actual Behavior

Failed to install the commercial paper smart contract. I did turn on debug logging and found this:

Austins-MacBook-Pro:cli Austin$ docker exec cliMagnetoCorp peer chaincode install -n papercontract -v 0 -p /opt/gopath/src/github.com/contract -l node
2019-05-07 21:17:11.826 UTC [viperutil] getKeysRecursively -> DEBU 001 Found map[string]interface{} value for peer.BCCSP
2019-05-07 21:17:11.826 UTC [viperutil] unmarshalJSON -> DEBU 002 Unmarshal JSON: value cannot be unmarshalled: invalid character 'S' looking for beginning of value
2019-05-07 21:17:11.826 UTC [viperutil] getKeysRecursively -> DEBU 003 Found real value for peer.BCCSP.Default setting to string SW
2019-05-07 21:17:11.827 UTC [viperutil] getKeysRecursively -> DEBU 004 Found map[string]interface{} value for peer.BCCSP.SW
2019-05-07 21:17:11.827 UTC [viperutil] unmarshalJSON -> DEBU 005 Unmarshal JSON: value cannot be unmarshalled: invalid character 'S' looking for beginning of value
2019-05-07 21:17:11.827 UTC [viperutil] getKeysRecursively -> DEBU 006 Found real value for peer.BCCSP.SW.Hash setting to string SHA2
2019-05-07 21:17:11.828 UTC [viperutil] unmarshalJSON -> DEBU 007 Unmarshal JSON: value is not a string: 256
2019-05-07 21:17:11.828 UTC [viperutil] getKeysRecursively -> DEBU 008 Found real value for peer.BCCSP.SW.Security setting to int 256
2019-05-07 21:17:11.828 UTC [viperutil] getKeysRecursively -> DEBU 009 Found map[string]interface{} value for peer.BCCSP.SW.FileKeyStore
2019-05-07 21:17:11.828 UTC [viperutil] unmarshalJSON -> DEBU 00a Unmarshal JSON: value cannot be unmarshalled: unexpected end of JSON input
2019-05-07 21:17:11.828 UTC [viperutil] getKeysRecursively -> DEBU 00b Found real value for peer.BCCSP.SW.FileKeyStore.KeyStore setting to string 
2019-05-07 21:17:11.829 UTC [viperutil] getKeysRecursively -> DEBU 00c Found map[string]interface{} value for peer.BCCSP.PKCS11
2019-05-07 21:17:11.829 UTC [viperutil] unmarshalJSON -> DEBU 00d Unmarshal JSON: value is not a string: <nil>
2019-05-07 21:17:11.830 UTC [viperutil] getKeysRecursively -> DEBU 00e Found real value for peer.BCCSP.PKCS11.Library setting to <nil> <nil>
2019-05-07 21:17:11.831 UTC [viperutil] unmarshalJSON -> DEBU 00f Unmarshal JSON: value is not a string: <nil>
2019-05-07 21:17:11.831 UTC [viperutil] getKeysRecursively -> DEBU 010 Found real value for peer.BCCSP.PKCS11.Label setting to <nil> <nil>
2019-05-07 21:17:11.832 UTC [viperutil] unmarshalJSON -> DEBU 011 Unmarshal JSON: value is not a string: <nil>
2019-05-07 21:17:11.832 UTC [viperutil] getKeysRecursively -> DEBU 012 Found real value for peer.BCCSP.PKCS11.Pin setting to <nil> <nil>
2019-05-07 21:17:11.833 UTC [viperutil] unmarshalJSON -> DEBU 013 Unmarshal JSON: value is not a string: <nil>
2019-05-07 21:17:11.833 UTC [viperutil] getKeysRecursively -> DEBU 014 Found real value for peer.BCCSP.PKCS11.Hash setting to <nil> <nil>
2019-05-07 21:17:11.834 UTC [viperutil] unmarshalJSON -> DEBU 015 Unmarshal JSON: value is not a string: <nil>
2019-05-07 21:17:11.834 UTC [viperutil] getKeysRecursively -> DEBU 016 Found real value for peer.BCCSP.PKCS11.Security setting to <nil> <nil>
2019-05-07 21:17:11.835 UTC [viperutil] getKeysRecursively -> DEBU 017 Found map[string]interface{} value for peer.BCCSP.PKCS11.FileKeyStore
2019-05-07 21:17:11.835 UTC [viperutil] unmarshalJSON -> DEBU 018 Unmarshal JSON: value is not a string: <nil>
2019-05-07 21:17:11.836 UTC [viperutil] getKeysRecursively -> DEBU 019 Found real value for peer.BCCSP.PKCS11.FileKeyStore.KeyStore setting to <nil> <nil>
2019-05-07 21:17:11.836 UTC [viperutil] EnhancedExactUnmarshalKey -> DEBU 01a map[peer.BCCSP:map[Default:SW SW:map[Hash:SHA2 Security:256 FileKeyStore:map[KeyStore:]] PKCS11:map[Library:<nil> Label:<nil> Pin:<nil> Hash:<nil> Security:<nil> FileKeyStore:map[KeyStore:<nil>]]]]
2019-05-07 21:17:11.845 UTC [bccsp_sw] openKeyStore -> DEBU 01b KeyStore opened at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore]...done
2019-05-07 21:17:11.846 UTC [bccsp] initBCCSP -> DEBU 01c Initialize BCCSP [SW]
2019-05-07 21:17:11.846 UTC [msp] getPemMaterialFromDir -> DEBU 01d Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts
2019-05-07 21:17:11.849 UTC [msp] getPemMaterialFromDir -> DEBU 01e Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/signcerts/Admin@org1.example.com-cert.pem
2019-05-07 21:17:11.852 UTC [msp] getPemMaterialFromDir -> DEBU 01f Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts
2019-05-07 21:17:11.854 UTC [msp] getPemMaterialFromDir -> DEBU 020 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/cacerts/ca.org1.example.com-cert.pem
2019-05-07 21:17:11.858 UTC [msp] getPemMaterialFromDir -> DEBU 021 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts
2019-05-07 21:17:11.866 UTC [msp] getPemMaterialFromDir -> DEBU 022 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/admincerts/Admin@org1.example.com-cert.pem
2019-05-07 21:17:11.869 UTC [msp] getPemMaterialFromDir -> DEBU 023 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts
2019-05-07 21:17:11.870 UTC [msp] getMspConfig -> DEBU 024 Intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/intermediatecerts: no such file or directory]
2019-05-07 21:17:11.870 UTC [msp] getPemMaterialFromDir -> DEBU 025 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts
2019-05-07 21:17:11.874 UTC [msp] getPemMaterialFromDir -> DEBU 026 Inspecting file /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlscacerts/tlsca.org1.example.com-cert.pem
2019-05-07 21:17:11.877 UTC [msp] getPemMaterialFromDir -> DEBU 027 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts
2019-05-07 21:17:11.878 UTC [msp] getMspConfig -> DEBU 028 TLS intermediate certs folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/tlsintermediatecerts: no such file or directory]
2019-05-07 21:17:11.878 UTC [msp] getPemMaterialFromDir -> DEBU 029 Reading directory /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls
2019-05-07 21:17:11.879 UTC [msp] getMspConfig -> DEBU 02a crls folder not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls]. Skipping. [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/crls: no such file or directory]
2019-05-07 21:17:11.884 UTC [msp] getMspConfig -> DEBU 02b MSP configuration file not found at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml]: [stat /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/config.yaml: no such file or directory]
2019-05-07 21:17:11.885 UTC [msp] newBccspMsp -> DEBU 02c Creating BCCSP-based MSP instance
2019-05-07 21:17:11.885 UTC [msp] New -> DEBU 02d Creating Cache-MSP instance
2019-05-07 21:17:11.885 UTC [msp] loadLocaMSP -> DEBU 02e Created new local MSP
2019-05-07 21:17:11.885 UTC [msp] Setup -> DEBU 02f Setting up MSP instance Org1MSP
2019-05-07 21:17:11.886 UTC [msp.identity] newIdentity -> DEBU 030 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICRDCCAeqgAwIBAgIRAIk/1HQ6XgI0p64PQwvUA3owCgYIKoZIzj0EAwIwczEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xGTAXBgNVBAoTEG9yZzEuZXhhbXBsZS5jb20xHDAaBgNVBAMTE2Nh
Lm9yZzEuZXhhbXBsZS5jb20wHhcNMTcwODMxMDkxNDMyWhcNMjcwODI5MDkxNDMy
WjBzMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
U2FuIEZyYW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UE
AxMTY2Eub3JnMS5leGFtcGxlLmNvbTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IA
BM0tgEje2ssj/AWFh/70ymdVvVH+8EWtu7/jcn5Hy7gTvewJzHSdF9gID50d/bZx
65KOreUxetqitV6/m2DgNzujXzBdMA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAG
BgRVHSUAMA8GA1UdEwEB/wQFMAMBAf8wKQYDVR0OBCIEIEI5qg3NdtruuLoM2nAY
UdFFBNMarRst3dusalc2Xkl8MAoGCCqGSM49BAMCA0gAMEUCIQDufxsHbxkSP/y+
oM2xZGgHL5XSTJVBqBryk1rd08Af6QIgLiAwtR7iKRbf1pKKCkt66MZzItZXC0po
/45uf29T/sc=
-----END CERTIFICATE-----
2019-05-07 21:17:11.886 UTC [msp.identity] newIdentity -> DEBU 031 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa
MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw
EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/
sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD
VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64
ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU
/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu
o2HkWiuxLsibGxtE
-----END CERTIFICATE-----
2019-05-07 21:17:11.887 UTC [msp.identity] newIdentity -> DEBU 032 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa
MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw
EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/
sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD
VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64
ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU
/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu
o2HkWiuxLsibGxtE
-----END CERTIFICATE-----
2019-05-07 21:17:11.890 UTC [bccsp_sw] loadPrivateKey -> DEBU 033 Loading private key [cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec] at [/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp/keystore/cd96d5260ad4757551ed4a5a991e62130f8008a0bf996e4e4b84cd097a747fec_sk]...
2019-05-07 21:17:11.893 UTC [msp.identity] newIdentity -> DEBU 034 Creating identity instance for cert -----BEGIN CERTIFICATE-----
MIICGDCCAb+gAwIBAgIQFSxnLAGsu04zrFkAEwzn6zAKBggqhkjOPQQDAjBzMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEZMBcGA1UEChMQb3JnMS5leGFtcGxlLmNvbTEcMBoGA1UEAxMTY2Eu
b3JnMS5leGFtcGxlLmNvbTAeFw0xNzA4MzEwOTE0MzJaFw0yNzA4MjkwOTE0MzJa
MFsxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
YW4gRnJhbmNpc2NvMR8wHQYDVQQDDBZBZG1pbkBvcmcxLmV4YW1wbGUuY29tMFkw
EwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEV1dfmKxsFKWo7o6DNBIaIVebCCPAM9C/
sLBt4pJRre9pWE987DjXZoZ3glc4+DoPMtTmBRqbPVwYcUvpbYY8p6NNMEswDgYD
VR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwKwYDVR0jBCQwIoAgQjmqDc122u64
ugzacBhR0UUE0xqtGy3d26xqVzZeSXwwCgYIKoZIzj0EAwIDRwAwRAIgXMy26AEU
/GUMPfCMs/nQjQME1ZxBHAYZtKEuRR361JsCIEg9BOZdIoioRivJC+ZUzvJUnkXu
o2HkWiuxLsibGxtE
-----END CERTIFICATE-----
2019-05-07 21:17:11.893 UTC [msp] setupSigningIdentity -> DEBU 035 Signing identity expires at 2027-08-29 09:14:32 +0000 UTC
2019-05-07 21:17:11.893 UTC [msp] Validate -> DEBU 036 MSP Org1MSP validating identity
2019-05-07 21:17:11.894 UTC [grpc] DialContext -> DEBU 037 parsed scheme: ""
2019-05-07 21:17:11.895 UTC [grpc] DialContext -> DEBU 038 scheme "" not registered, fallback to default scheme
2019-05-07 21:17:11.895 UTC [grpc] watcher -> DEBU 039 ccResolverWrapper: sending new addresses to cc: [{peer0.org1.example.com:17051 0  <nil>}]
2019-05-07 21:17:11.895 UTC [grpc] switchBalancer -> DEBU 03a ClientConn switching balancer to "pick_first"
2019-05-07 21:17:11.895 UTC [grpc] HandleSubConnStateChange -> DEBU 03b pickfirstBalancer: HandleSubConnStateChange: 0xc00035c7b0, CONNECTING
2019-05-07 21:17:11.903 UTC [grpc] HandleSubConnStateChange -> DEBU 03c pickfirstBalancer: HandleSubConnStateChange: 0xc00035c7b0, READY
2019-05-07 21:17:11.904 UTC [grpc] DialContext -> DEBU 03d parsed scheme: ""
2019-05-07 21:17:11.905 UTC [grpc] DialContext -> DEBU 03e scheme "" not registered, fallback to default scheme
2019-05-07 21:17:11.905 UTC [grpc] watcher -> DEBU 03f ccResolverWrapper: sending new addresses to cc: [{peer0.org1.example.com:17051 0  <nil>}]
2019-05-07 21:17:11.905 UTC [grpc] switchBalancer -> DEBU 040 ClientConn switching balancer to "pick_first"
2019-05-07 21:17:11.906 UTC [grpc] HandleSubConnStateChange -> DEBU 041 pickfirstBalancer: HandleSubConnStateChange: 0xc0004a4650, CONNECTING
2019-05-07 21:17:11.909 UTC [grpc] HandleSubConnStateChange -> DEBU 042 pickfirstBalancer: HandleSubConnStateChange: 0xc0004a4650, READY
2019-05-07 21:17:11.910 UTC [msp] GetDefaultSigningIdentity -> DEBU 043 Obtaining default signing identity
2019-05-07 21:17:11.911 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 044 Using default escc
2019-05-07 21:17:11.911 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 045 Using default vscc
2019-05-07 21:17:11.913 UTC [chaincode.platform.node] GetDeploymentPayload -> DEBU 046 Packaging node.js project from path /opt/gopath/src/github.com/contract
2019-05-07 21:17:11.914 UTC [container] WriteFolderToTarPackage -> DEBU 047 rootDirectory = /opt/gopath/src/github.com/contract
2019-05-07 21:17:11.918 UTC [container] WriteFileToPackage -> DEBU 048 Writing file to tarball: src/.editorconfig
2019-05-07 21:17:11.924 UTC [container] WriteFileToPackage -> DEBU 049 Writing file to tarball: src/.eslintignore
2019-05-07 21:17:11.928 UTC [container] WriteFileToPackage -> DEBU 04a Writing file to tarball: src/.eslintrc.js
2019-05-07 21:17:11.932 UTC [container] WriteFileToPackage -> DEBU 04b Writing file to tarball: src/.npmignore
2019-05-07 21:17:11.937 UTC [container] WriteFileToPackage -> DEBU 04c Writing file to tarball: src/contract-metadata/metadata.json
2019-05-07 21:17:11.941 UTC [container] WriteFileToPackage -> DEBU 04d Writing file to tarball: src/index.js
2019-05-07 21:17:11.946 UTC [container] WriteFileToPackage -> DEBU 04e Writing file to tarball: src/ledger-api/state.js
2019-05-07 21:17:11.952 UTC [container] WriteFileToPackage -> DEBU 04f Writing file to tarball: src/ledger-api/statelist.js
2019-05-07 21:17:11.959 UTC [container] WriteFileToPackage -> DEBU 050 Writing file to tarball: src/lib/paper.js
2019-05-07 21:17:11.964 UTC [container] WriteFileToPackage -> DEBU 051 Writing file to tarball: src/lib/papercontract.js
2019-05-07 21:17:11.969 UTC [container] WriteFileToPackage -> DEBU 052 Writing file to tarball: src/lib/paperlist.js
2019-05-07 21:17:11.974 UTC [container] WriteFileToPackage -> DEBU 053 Writing file to tarball: src/package.json
2019-05-07 21:17:11.982 UTC [container] WriteFileToPackage -> DEBU 054 Writing file to tarball: src/test/contract.js
2019-05-07 21:17:11.985 UTC [msp.identity] Sign -> DEBU 055 Sign: plaintext: 0A9C070A5C08031A0C08D7EBC7E60510...B9F23F010000FFFFE5AB834900840000 
2019-05-07 21:17:11.986 UTC [msp.identity] Sign -> DEBU 056 Sign: digest: 8D4A3A785B2CA4D38B1A9F97829AC92AC59D96BDFD2EBBD878565F15A247DAB2 
Error: Error endorsing chaincode: rpc error: code = Unknown desc = access denied: channel [] creator org [Org1MSP]

Sorry for a lot of logs and wording here, but thought I'd be as thorough as possible from the get-go.

Possible Fix

I did notice that the Fabric docs say to have Node 9.0 installed and I'm operating on 8.15.1 - but that shouldn't cause this type of issue. This did work on 0.3.x with node 8.15.1 and it worked just fine.

Steps to Reproduce

You can follow my steps here.. https://ibm-blockchain-wsc.github.io/ImmersionWorkshop/vscode-part2/#section-2-setting-the-stage

Existing issues

Log File

A lot of the logs are above

Your Environment

austingrice commented 5 years ago

I still get this issue with VSCode 1.0

cazfletch commented 5 years ago

@austingrice is the problem fixed if you use an unmodified version of the network configuration?

austingrice commented 5 years ago

@cazfletch I just tried an unmodified docker-compose.yaml file and got this when trying to install

Austins-MacBook-Pro:cli Austin$ docker exec cliMagnetoCorp peer chaincode install -n papercontract -v 0 -p /opt/gopath/src/github.com/contract -l node
Error: error getting endorser client for install: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp: lookup peer0.org1.example.com on 127.0.0.11:53: no such host"

This is with 1.0 of VSCode still

cazfletch commented 5 years ago

@austingrice have you tried installing from within VS Code?

austingrice commented 5 years ago

@cazfletch - Yes.. I was just able to install/instantiate within VSCode without an issue.

Also - I noticed how the basic-network/crypto-config got pulled into the fabric-tools so I thought the issue could be because the basic-network/config wasn't getting pulled into as well. So I modified the docker-compose.yaml file to say

    volumes:
        - /var/run/:/host/var/run/
        - ./../../../../organization/magnetocorp:/opt/gopath/src/github.com/
        - ./../../../../../basic-network/crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./../../../../../basic-network/config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/

But then I go into the cliMagnetoCorp container and get don't get actually mounted.

root@a55515e00dee:/opt/gopath/src/github.com/hyperledger/fabric/peer# ls -l
total 0
drwxr-xr-x 4 root root 128 May  9 15:18 crypto
root@a55515e00dee:/opt/gopath/src/github.com/hyperledger/fabric/peer# cd crypto/
root@a55515e00dee:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto# ls -l
total 0
drwxr-xr-x 3 root root 96 May  9 15:18 ordererOrganizations
drwxr-xr-x 3 root root 96 May  9 15:18 peerOrganizations
austingrice commented 5 years ago

@cazfletch - I did progress to the other parts of the tutorial (adding an identity and issuing an issue.js transaction), but I get an authorization error again as my MSPID Org1MSP

Austins-MacBook-Pro:application Austin$ node addToWallet.js 
done
Austins-MacBook-Pro:application Austin$ ls -l ../identity/user/isabella/wallet/
total 0
drwxr-xr-x  5 Austin  staff  160 May  9 14:36 User1@org1.example.com
Austins-MacBook-Pro:application Austin$ ls -l
total 192
-rw-r--r--    1 Austin  staff   1476 May  9 11:18 addToWallet.js
-rw-r--r--    1 Austin  staff   2974 May  9 11:18 issue.js
drwxr-xr-x  233 Austin  staff   7456 May  9 14:36 node_modules
-rw-r--r--    1 Austin  staff  83093 May  9 14:36 package-lock.json
-rw-r--r--    1 Austin  staff    397 May  9 11:18 package.json
Austins-MacBook-Pro:application Austin$ ls -l ../identity/user/isabella/wallet/User1\@org1.example.com/
total 24
-rw-r--r--  1 Austin  staff  1037 May  9 14:36 User1@org1.example.com
-rw-r--r--  1 Austin  staff   246 May  9 14:36 c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83-priv
-rw-r--r--  1 Austin  staff   182 May  9 14:36 c75bd6911aca808941c3557ee7c97e90f3952e379497dc55eb903f31b50abc83-pub
Austins-MacBook-Pro:application Austin$ node issue.js 
Connect to Fabric gateway.
Use network channel: mychannel.
2019-05-09T18:36:27.721Z - error: [Channel.js]: Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
2019-05-09T18:36:27.723Z - error: [Network]: _initializeInternalChannel: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
Error processing transaction. Error: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
Error: Unable to initialize channel. Attempted to contact 1 Peers. Last error was Error: 2 UNKNOWN: access denied: channel [mychannel] creator org [Org1MSP]
    at Network._initializeInternalChannel (/Users/Austin/Documents/VSCodeProjects/fabric-samples/commercial-paper/organization/magnetocorp/application/node_modules/fabric-network/lib/network.js:86:12)
    at <anonymous>
Disconnect from Fabric gateway.

Now, I can still submit from the VSCode UI..

Transaction ["issue", "MagnetoCorp", "00001", "2020-05-31", "2020-11-30", "5000000"]

[5/9/2019 2:45:06 PM] [INFO] submitTransaction
[5/9/2019 2:45:51 PM] [INFO] submitting transaction issue with args issue,MagnetoCorp,00001,2020-05-31,2020-11-30,5000000
[5/9/2019 2:45:53 PM] [SUCCESS] Returned value from issue: {"type":"Buffer","data":[123,34,99,108,97,115,115,34,58,34,111,114,103,46,112,97,112,101,114,110,101,116,46,99,111,109,109,101,114,99,105,97,108,112,97,112,101,114,34,44,34,107,101,121,34,58,34,92,34,105,115,115,117,101,92,34,58,92,34,77,97,103,110,101,116,111,67,111,114,112,92,34,34,44,34,99,117,114,114,101,110,116,83,116,97,116,101,34,58,49,44,34,105,115,115,117,101,114,34,58,34,105,115,115,117,101,34,44,34,112,97,112,101,114,78,117,109,98,101,114,34,58,34,77,97,103,110,101,116,111,67,111,114,112,34,44,34,105,115,115,117,101,68,97,116,101,84,105,109,101,34,58,34,48,48,48,48,49,34,44,34,109,97,116,117,114,105,116,121,68,97,116,101,84,105,109,101,34,58,34,50,48,50,48,45,48,53,45,51,49,34,44,34,102,97,99,101,86,97,108,117,101,34,58,34,50,48,50,48,45,49,49,45,51,48,34,44,34,111,119,110,101,114,34,58,34,105,115,115,117,101,34,125]}
austingrice commented 5 years ago

@cazfletch

Just to give you an update. I still get this issue. What's weird is that I can do an issue transaction (like above), but I get an endorsement error when trying to buy the paper. This is all from the VSCode UI. I'm still getting errors from the CLI from both the magnetocorp and digibank perspective.

austingrice commented 5 years ago

@cazfletch

Here is my networkConnection.yaml file..

---
#
# The network connection profile provides client applications the information about the target
# blockchain network that are necessary for the applications to interact with it. These are all
# knowledge that must be acquired from out-of-band sources. This file provides such a source.
#
name: "basic-network"

#
# Any properties with an "x-" prefix will be treated as application-specific, exactly like how naming
# in HTTP headers or swagger properties work. The SDK will simply ignore these fields and leave
# them for the applications to process. This is a mechanism for different components of an application
# to exchange information that are not part of the standard schema described below. In particular,
# the "x-type" property with the "hlfv1" value example below is used by Hyperledger Composer to
# determine the type of Fabric networks (v0.6 vs. v1.0) it needs to work with.
#
x-type: "hlfv1"

#
# Describe what the target network is/does.
#
description: "The basic network"

#
# Schema version of the content. Used by the SDK to apply the corresponding parsing rules.
#
version: "1.0"

#
# [Optional]. But most apps would have this section so that channel objects can be constructed
# based on the content below. If an app is creating channels, then it likely will not need this
# section.
#
channels:
  # name of the channel
  mychannel:
    # Required. list of orderers designated by the application to use for transactions on this
    # channel. This list can be a result of access control ("org1" can only access "ordererA"), or
    # operational decisions to share loads from applications among the orderers.  The values must
    # be "names" of orgs defined under "organizations/peers"
    orderers:
      - orderer.example.com

    # Required. list of peers from participating orgs
    peers:
      peer0.org1.example.com:
        # [Optional]. will this peer be sent transaction proposals for endorsement? The peer must
        # have the chaincode installed. The app can also use this property to decide which peers
        # to send the chaincode install request. Default: true
        endorsingPeer: true

        # [Optional]. will this peer be sent query proposals? The peer must have the chaincode
        # installed. The app can also use this property to decide which peers to send the
        # chaincode install request. Default: true
        chaincodeQuery: true

        # [Optional]. will this peer be sent query proposals that do not require chaincodes, like
        # queryBlock(), queryTransaction(), etc. Default: true
        ledgerQuery: true

        # [Optional]. will this peer be the target of the SDK's listener registration? All peers can
        # produce events but the app typically only needs to connect to one to listen to events.
        # Default: true
        eventSource: true

#
# list of participating organizations in this network
#
organizations:
  Org1:
    mspid: Org1MSP

    peers:
      - peer0.org1.example.com

    # [Optional]. Certificate Authorities issue certificates for identification purposes in a Fabric based
    # network. Typically certificates provisioning is done in a separate process outside of the
    # runtime network. Fabric-CA is a special certificate authority that provides a REST APIs for
    # dynamic certificate management (enroll, revoke, re-enroll). The following section is only for
    # Fabric-CA servers.
    certificateAuthorities:
      - ca.org1.example.com

#
# List of orderers to send transaction and channel create/update requests to. For the time
# being only one orderer is needed. If more than one is defined, which one get used by the
# SDK is implementation specific. Consult each SDK's documentation for its handling of orderers.
#
orderers:
  orderer.example.com:
    url: grpc://localhost:17050

    # these are standard properties defined by the gRPC library
    # they will be passed in as-is to gRPC client constructor
    grpcOptions:
      ssl-target-name-override: orderer.example.com

#
# List of peers to send various requests to, including endorsement, query
# and event listener registration.
#
peers:
  peer0.org1.example.com:
    # this URL is used to send endorsement and query requests
    url: grpc://localhost:17051

    grpcOptions:
      ssl-target-name-override: peer0.org1.example.com
      request-timeout: 120001

# Fabric-CA is a special kind of Certificate Authority provided by Hyperledger Fabric which allows
# certificate management to be done via REST APIs. Application may choose to use a standard
# Certificate Authority instead of Fabric-CA, in which case this section would not be specified.
#
certificateAuthorities:
  ca.org1.example.com:
    url: http://localhost:17054
    # the properties specified under this object are passed to the 'http' client verbatim when
    # making the request to the Fabric-CA server
    httpOptions:
      verify: false

    # Fabric-CA supports dynamic user enrollment via REST APIs. A "root" user, a.k.a registrar, is
    # needed to enroll and invoke new users.
    registrar:
      - enrollId: admin
        enrollSecret: adminpw
    # [Optional] The optional name of the CA.
    caName: ca.org1.example.com

I've tried adding the full docker container name (ie fabricvscodelocalfabric_peer0.org1.example.com) and still don't get passed the error

davidkel commented 5 years ago

@austingrice I'm I right in thinking you are trying to interact with the VS code local fabric runtime using the peer cli which is in some sort of container ? If so then you would need to make sure that the MSPs generated to run the vscode local fabric are correctly exposed to these containers. Probably the reason it worked prior to 0.4.0 was that the vscode local fabric used the same crypto material stored in the fabric-samples github repo for basic-network. That isn't the case now.

austingrice commented 5 years ago

@davidkel @cazfletch @sstone1

I was trying two things with the goal of getting 1 of them to work.. 1 being connecting commerical paper through the local_fabric and then the second by trying to do it through the ./start.sh script in the basic-network of fabric-samples. Thank you David for the information about the location of the crypto material. I was pulling down the fabric-tools container to install/instantiate the commercial paper contract. I wanted to get this to work with the local_fabric so I went with this route. I looked around and saw that they are stored in /Users/<username>/.fabric-vscode/runtime/crypto-config/ so I mapped that in the fabric-tools container I was pulling down. Then in the addtoWallet.js file, I mapped that as well to /Users/<username>/.fabric-vscode/runtime so that it would pick up Isabella and Balaji and replaced the generated private key from the local_fabric setup. Since the local_fabric has the anchor peer defined, we avoided the endorsement plan issue I posted in the slack channel.

Thank you all for the help with this! Turns out it was just the mapping of the correct crypto material. We can close this as well.