0

Vagrant を使用して、ローカル ネットワークのセットアップでブロックチェーン アプリケーションを実行しています。
ネットワーク ( ca および vp ) は Vagrant VM 内で実行されていますが、アプリケーションは Vagrant の外部にあります。セキュリティを無効にしてアプリケーションを実行したところ、すべて正常に動作しました。しかし、セキュリティを有効にして試してみると、次のエラーが表示されます。

himanshus-mbp:BCApplication himanshutyagi$ node app.js 
loading hardcoded peers
loading hardcoded users
[ibc-js] Peer:  vp0-dev_vp0...:5000
[ibc-js] No membership users found after filtering, assuming this is a network w/o membership
[ibc-js] Found chaincode in local file system
[ibc-js] Scanning files [ '.DS_Store', 'chaincode_finished.go', 'finished' ]
[ibc-js] Parsing file for shim version
[ibc-js] Found shim version: github.com/hyperledger/fabric/core/chaincode/shim
[ibc-js] Parsing file for invoke functions - chaincode_finished.go
[ibc-js] Found cc invoke function:  init
[ibc-js] Found cc invoke function:  delete_product
[ibc-js] Found cc invoke function:  delete_offering
[ibc-js] Found cc invoke function:  delete_contract
[ibc-js] Found cc invoke function:  delete_client
[ibc-js] Found cc invoke function:  write
[ibc-js] Found cc invoke function:  init_product
[ibc-js] Found cc invoke function:  init_offering
[ibc-js] Found cc invoke function:  init_contract
[ibc-js] Found cc invoke function:  init_client
[ibc-js] Found cc invoke function:  set_user_type
[ibc-js] Parsing file for query functions - chaincode_finished.go
[ibc-js] Found cc query function:  read
[ibc-js] Found cc query function:  read_product_index
[ibc-js] Found cc query function:  read_offering_index
[ibc-js] Found cc query function:  read_contract_index
[ibc-js] Found cc query function:  read_client_index
[ibc-js] load_chaincode() finished
chaincode summary file indicates chaincode has been previously deployed
------------------------------------------ Chain is up and running ------------------------------------------
Getting Offering List: 
[ibc-js] read  - success: { jsonrpc: '2.0',
  error: 
   { code: -32602,
     message: 'Invalid params',
     data: 'Must supply username for chaincode when security is enabled.' },
  id: 1469460324754 }
read _offeringindex: null { name: 'query() resp error',
  code: 400,
  details: 
   { code: -32602,
     message: 'Invalid params',
     data: 'Must supply username for chaincode when security is enabled.' } }
/Users/himanshutyagi/Desktop/workspace/node_modules/async/lib/async.js:106
        if (!arr.length) {
                ^

TypeError: Cannot read property 'length' of null
    at Object.async.each (/Users/himanshutyagi/Desktop/workspace/node_modules/async/lib/async.js:106:17)
    at /Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/app.js:379:10
    at Object.options.success (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/index.js:1020:22)
    at success (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/lib/rest.js:109:30)
    at IncomingMessage.<anonymous> (/Users/himanshutyagi/Desktop/workspace/BCApplication/BCApplication/node_modules/ibm-blockchain-js/lib/rest.js:192:7)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:921:12)
    at nextTickCallbackWith2Args (node.js:442:9)
    at process._tickCallback (node.js:356:17)

また奇妙なのは、ブロックチェーン js 構成で述べたNo membership users found after filteringのと同じチェーンコードを再デプロイしたことがログに示されていることです。詳細は次のとおりです。enrollID and enrollPWapp.js

var options =   {
                    network:{
                        /*
                        peers: peers,
                        users: users,
                        options: {quiet: true, tls:false, maxRetry: 1}*/
                        'peers': [
                            {
                                        'discovery_host': 'localhost',
                                        'discovery_port': 30303,
                                        'api_host': 'localhost',
                                        'api_port_tls': 443,
                                        'api_port': 5000,
                                        'type': 'peer',
                                        'network_id': 'dev',
                                        'id': 'dev_vp0',
                                        'api_url': 'http://localhost:5000'
                                    }
                            ],
                            "users": [
                          {
                            "username": "tyagi_user_type1",
                            "secret": "1ccf8703ac",
                            "enrollId": "tyagi_type1",
                            "enrollSecret": "1ccf8703ac"
                          }
                        ],
                    options: {quiet: true, tls:false, maxRetry: 1}
                    },
                    ...
};

「チェーンコードのユーザー名を指定する必要があります」とはどういう意味ですか? ローカル ネットワークでセキュリティを有効にして実行しているときに、同様の問題に直面した人はいますか?
更新: そのため、enrillId を に変更しuser_type1_xxxました。「メンバーシップ ユーザーが見つかりません..」というメッセージは表示されなくなりました。しかし、ユーザーが登録しようとすると、接続拒否エラーが発生します。

himanshus-mbp:BCApplication himanshutyagi$ node app.js
loading hardcoded peers
loading hardcoded users
[ibc-js] Peer:  vp0-dev_vp0...:443
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x1 : user_type1_tyagi 500
[ibc-js]    going to try to register again in 30 secs
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x2 : user_type1_tyagi 500
[ibc-js]    going to try to register again in 30 secs
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x3 : user_type1_tyagi 500
[ibc-js]    going to try to register again in 30 secs
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
Query for the product table executed
Query for the offering table executed
Query for the contract table executed
Query for the product table executed
[ibc-js] Registering  vp0-dev_vp0...:443  w/enrollID - user_type1_tyagi
[ibc-js] Register - failure x4 : user_type1_tyagi 500
! looks like an error loading the chaincode or network, app will fail
 { name: 'register() error',
  code: 500,
  details: 
   { [Error: connect ECONNREFUSED 127.0.0.1:443]
     code: 'ECONNREFUSED',
     errno: 'ECONNREFUSED',
     syscall: 'connect',
     address: '127.0.0.1',
     port: 443 } }
4

0 に答える 0