[英]What's wrong with logging into peer network -hyperledger fabric (eca.user)?
有人可以幫我嗎? 我不確定對等網絡(超級賬本結構)的登錄出了什么問題。
在http://hyperledger-fabric.readthedocs.io/en/latest/Setup/Chaincode-setup/
,我按照有關安全功能的說明進行了操作。 我嘗試了所說的。 我做了流浪的ssh, cd $GOPATH/src/github.com/hyperledger/fabric/peer
,然后是
peer network login admin
(membersrvc.yaml的默認文件)。
我確實嘗試了其他用戶名和密碼,但是由於顯示錯誤,它們均無效。 據我了解,當顯示錯誤時,將意味着用戶名和密碼不正確。 但是,我復制並粘貼了用戶名和密碼,但沒有成功。 我能否知道登錄對等網絡(hyperledger fabric-使用git bash)的用戶名和密碼有什么問題?
用戶名和密碼(eca.user-顯示用戶名和密碼)將顯示在下面(membersrvc.yaml):
eca:
# This hierarchy is used to create the Pre-key tree, affiliations is the top of this hierarchy, 'banks_and_institutions' is used to create the key associated to auditors of both banks and
# institu
tions, 'banks' is used to create a key associated to auditors of banks, 'bank_a' is used to create a key associated to auditors of bank_a, etc.
affiliations:
banks_and_institutions:
banks:
- bank_a
- bank_b
- bank_c
institutions:
- institution_a
users:
#
# The fields of each user are as follows:
# <EnrollmentID>: <system_role (1:client, 2: peer, 4: validator, 8: auditor)> <EnrollmentPWD> <Affiliation> <Affiliation_Role> <JSON_Metadata>
#
# The optional JSON_Metadata field is of the following format:
# { "registrar": { "roles": <array-of-role-names>, "delegateRoles": <array-of-role-names> } }
# The 'registrar' section is used to control access to registration of new users directly via the ECAA.RegisterUser GRPC call.
# (See the 'fabric/membersrvc/protos/ca.proto' file for the definition of ECAA.RegisterUser.)
# Note that this also controls who can register users via the client SDK.
#
# Only users with a 'registrar' section may be a registrar to register other users. In particular,
# 1) the "roles" field specifies which member roles may be registered by this user, and
# 2) the "delegateRoles" field specifies which member roles may become the "roles" field of registered users.
# The valid role names are "client", "peer", "validator", and "auditor".
#
# Example1:
# The 'admin' user below can register clients, peers, validators, or auditors; furthermore, the 'admin' user can register other
# users who can then register clients only.
#
# Example2:
# The 'WebAppAdmin' user below can register clients only, but none of the users registered by this user can register other users.
#
admin: 1 Xurw3yU9zI0l institution_a '{"registrar":{"roles":["client","peer","validator","auditor"],"delegateRoles":["client"]}}'
WebAppAdmin: 1 DJY27pEnl16d institution_a '{"registrar":{"roles":["client"]}}'
lukas: 1 NPKYL39uKbkj bank_a
system_chaincode_invoker: 1 DRJ20pEql15a institution_a
diego: 1 DRJ23pEQl16a institution_a
jim: 1 6avZQLwcUe9b bank_a
binhn: 1 7avZQLwcUe9q institution_a
testing: 1 test123 institution_a
# Users for asset transfer with roles test located at
# sdk/node/test/unit/asset-mgmt-with-roles.js
alice: 1 CMS10pEQlB16 bank_a
bob: 1 NOE63pEQbL25 bank_a
assigner: 1 Tc43PeqBl11 bank_a
vp: 4 f3489fy98ghfAD
test_vp0: 4 MwYpmSRjupbT
test_vp1: 4 5wgHK9qqYaPy
test_vp2: 4 vQelbRvja7cJ
test_vp3: 4 9LKqKH5peurL
test_vp4: 4 Pqh90CEW5juZ
test_vp5: 4 FfdvDkAdY81P
test_vp6: 4 QiXJgHyV4t7A
test_vp7: 4 twoKZouEyLyB
test_vp8: 4 BxP7QNh778gI
test_vp9: 4 wu3F1EwJWHvQ
# Uncomment this section to activate devnet setup as specficied in
# devnet-setup.md
#
# vp0: 4 vp0_secret
# vp1: 4 vp1_secret
test_user0: 1 MS9qrN8hFjlE bank_a
test_user1: 1 jGlNl6ImkuDo institution_a
test_user2: 1 zMflqOKezFiA bank_c
test_user3: 1 vWdLCE00vJy0 bank_a
test_user4: 1 4nXSrfoYGFCP institution_a
test_user5: 1 yg5DVhm0er1z bank_b
test_user6: 1 b7pmSxzKNFiw bank_a
test_user7: 1 YsWZD4qQmYxo institution_a
test_user8: 1 W8G0usrU7jRk bank_a
test_user9: 1 H80SiB5ODKKQ institution_a
test_nvp0: 2 iywrPBDEPl0K bank_a
test_nvp1: 2 DcYXuRSocuqd institution_a
test_nvp2: 2 flpChShlY7xt bank_c
test_nvp3: 2 jeruawMomclo bank_a
test_nvp4: 2 RMYVxSZCk370 institution_a
test_nvp5: 2 XHYVCIJGZGK7 bank_b
test_nvp6: 2 4cIn63j8ahYp bank_a
test_nvp7: 2 E7FAJUtWVn2h institution_a
test_nvp8: 2 LJu8DkUilBEH bank_a
test_nvp9: 2 VlEsBsiyXSjw institution_a
以下代碼將是我鍵入git bash以便登錄對等網絡(hyperledger架構)的代碼:
vagrant@hyperledger-devenv:v0.0.11-c6e56d6:/opt/gopath/src/github.com/hyperledger/fabric/peer$ peer network login admin
Enter password for user 'admin': Xurw3yU9zI0l
輸入密碼后,將出現以下錯誤:
2016/09/14 07:05:33 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
2016/09/14 07:05:35 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
2016/09/14 07:05:35 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
Error: Error trying to connect to local peer: grpc: timed out when dialing
Usage:
peer network login <username> [flags]
Flags:
-p, --password string The password for user. You will be requested to enter the password if this flag is not specified.
Global Flags:
--logging-level string Default logging level and overrides, see core.yaml for full syntax
--test.coverprofile string Done (default "coverage.cov")
-v, --version Display current version of fabric peer server
vagrant@hyperledger-devenv:v0.0.11-c6e56d6:/opt/gopath/src/github.com/hyperledger/fabric/peer$
更新:是的,我能夠實現類似的目標
06:04:34.617 [crypto] RegisterClient -> INFO 017 Registering client [admin] with name [admin]...
06:04:34.737 [crypto] Info -> INFO 018 [client.admin] Register crypto engine...
06:04:34.738 [crypto] Info -> INFO 019 [client.admin] Register crypto engine... done.
06:04:34.739 [crypto] RegisterClient -> INFO 01a Registering client [admin] with name [admin]...done!
但是,我可以知道為什么我只能登錄一次嗎? 例如,如果我想再次登錄admin,它不會提示您輸入密碼,並且會有類似這樣的內容
vagrant@hyperledger-devenv:v0.0.11-087d2ea:/opt/gopath/src/github.com/hyperledger/fabric/peer$ peer network login admin
vagrant@hyperledger-devenv:v0.0.11-087d2ea:/opt/gopath/src/github.com/hyperledger/fabric/peer$
您出錯的原因,
2016/09/14 07:05:33 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 0.0.0.0:7051: getsockopt: connection refused"; Reconnecting to {"0.0.0.0:7051" <nil>}
是沒有在0.0.0.0:7051
運行的peer
。
這是你應該做的,
從織物目錄運行membersrvc
第一(讀取此 ,然后在一個單獨終端,運行下面的命令以啟動關於如何設置CA) peer
的方法,
CORE_SECURITY_ENABLED=true CORE_SECURITY_PRIVACY=true peer node start --peer-chaincodedev
請注意,我正在dev
模式下運行它。
打開另一個終端並運行以下命令,
peer network login lukas
出現提示時輸入(或粘貼)密碼。
在第二個窗口(已啟動對等方)中,將看到以下輸出,
08:48:18.978 [crypto] RegisterClient -> INFO 01b Registering client [lukas] with name [lukas]...
08:48:19.179 [crypto] Info -> INFO 01c [client.lukas] Register crypto engine...
08:48:19.181 [crypto] Info -> INFO 01d [client.lukas] Register crypto engine...done.
08:48:19.183 [crypto] RegisterClient -> INFO 01e Registering client [lukas] with name [lukas]...done!
讓我知道是否有幫助。
問題“為什么我只能登錄一次?”第二部分的答案如下:
用戶只能擁有一張注冊證書。 會員服務將在第一個用戶登錄到網絡時生成唯一的注冊證書。 簽發注冊證書后,會員服務將通過覆蓋注冊密碼來“禁用”用戶帳戶。
在您的示例中,當您向同一對等方發送“ login”命令時,該對等方將檢查用戶是否已注冊,並且不會向會員服務發送任何請求。
在具有多個對等方的配置中,用戶只能登錄其中之一。 第二次嘗試通過另一個對等方登錄將導致:
Error: Error on client login: roc error: code = 2 desc = Identity or token does not match.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.