我正在使用 indy-sdk,在步骤 3 (https://github.com/hyperledger/indy-sdk/blob/master/docs/getting-started/indy-walkthrough.md#step-3-getting-the-ownership-for-stewards-verinym( 的演练演示中,Steward 的种子值设置为等于 '00000000000000000000000000Steward1'。
如果我更改它(或将其留空(,则会出现错误。此外,在/tmp/indy/poo1.txn 中没有关于此特定值的信息。
我的问题是,我们如何知道这是正确的价值,我们如何才能获得它?
为什么它不起作用
000000000000000000000000Steward1
是种子(给定默认密钥派生方法(生成 DIDTh7MpTaRZVRYnPiabds81Y
。您可以使用indy-cli
(命令行工具(验证自己
indy> wallet create test key=123
Wallet "test" has been created
indy> wallet open test key=123
Wallet "test" has been opened
wallet(test):indy> did new seed=000000000000000000000000Steward1
Did "Th7MpTaRZVRYnPiabds81Y" has been created with "~7TYfekw4GUagBnBVCqPjiC" verkey
在您使用的网络中,DIDVsKV7grR1BUE29mG2Fm2kX
的所有者(即了解其相关私钥或种子的人(具有steward
角色,该角色授予对账本执行各种操作的权限。因此,如果您修改种子,它将生成不同的 DID,这些 DID 没有执行本教程中进一步使用的操作(例如在账本上写入数据(所需的权限。
000000000000000000000000Steward1
从何而来
从您所说的内容来看,我假设您正在使用来自 indy-sdk 存储库的预构建 docker 映像,运行其中的indy-node
个实例池,按照其中一些说明进行操作。 所以简单的答案是000000000000000000000000Steward1
的配置是预先烘焙的。查看用于构建 indy-pool 映像的 dockerfile 。请注意这些行
RUN awk '{if (index($1, "NETWORK_NAME") != 0) {print("NETWORK_NAME = "sandbox"")} else print($0)}' /etc/indy/indy_config.py> /tmp/indy_config.py
RUN mv /tmp/indy_config.py /etc/indy/indy_config.py
让我们看看这些文件里有什么
docker exec indylocalhost cat '/etc/indy/indy_config.py'
# Current network
# Disable stdout logging
enableStdOutLogging = False
# Directory to store ledger.
LEDGER_DIR = '/var/lib/indy'
# Directory to store logs.
LOG_DIR = '/var/log/indy'
# Directory to store keys.
KEYS_DIR = '/var/lib/indy'
# Directory to store genesis transactions files.
GENESIS_DIR = '/var/lib/indy'
# Directory to store backups.
BACKUP_DIR = '/var/lib/indy/backup'
# Directory to store plugins.
PLUGINS_DIR = '/var/lib/indy/plugins'
# Directory to store node info.
NODE_INFO_DIR = '/var/lib/indy'
NETWORK_NAME = 'sandbox'%
这
# Directory to store genesis transactions files.
GENESIS_DIR = '/var/lib/indy'
看起来像我们正在寻找的。让我们看看那里有什么
docker exec indylocalhost ls '/var/lib/indy/sandbox'
data
domain_transactions_genesis
keys
node1_additional_info.json
node1_info.json
node1_version_info.json
node2_additional_info.json
node2_info.json
node2_version_info.json
node3_additional_info.json
node3_info.json
node3_version_info.json
node4_additional_info.json
node4_info.json
node4_version_info.json
pool_transactions_genesis
在区块链中,创世文件通常是您最初用于启动网络的文件,并且可能会用一些数据填充网络。在Hyperledger-indy的情况下,有4个"子分类账"包含不同类型的交易:domain
,pool
,config
,audit
。domain
子分类账是包含诸如DID
,凭据架构或凭据定义之类的内容的子分类帐。我们正在寻找一个 DID,所以让我们看看文件域创世文件。
docker exec indylocalhost cat '/var/lib/indy/sandbox/domain_transactions_genesis'
{"reqSignature":{},"txn":{"data":{"dest":"V4SGRU86Z58d6TV7PBUe6f","role":"0","verkey":"~CoRER63DVYnWZtK8uAzNbx"},"metadata":{},"type":"1"},"txnMetadata":{"seqNo":1},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"Th7MpTaRZVRYnPiabds81Y","role":"2","verkey":"~7TYfekw4GUagBnBVCqPjiC"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":2},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"EbP4aYNeTHL6q385GuVpRV","role":"2","verkey":"~RHGNtfvkgPEUQzQNtNxLNu"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":3},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"4cU41vWW82ArfxJxHkzXPG","role":"2","verkey":"~EMoPA6HrpiExVihsVfxD3H"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":4},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"TWwCRQRZ2ZHMJFn9TzLp7W","role":"2","verkey":"~UhP7K35SAXbix1kCQV4Upx"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":5},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"7JhapNNMLnwkbiC2ZmPZSE","verkey":"~LgpYPrzkB6awcHMTPZ9TVn"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":6},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"MEPecrczs4Wh6FA12u519D","verkey":"~A4rMgHYboWYS1DXibCgo9W"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":7},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"EAPtwgevBpzP8hkj9sxuzy","verkey":"~gmzSzu3feXC6g2djF7ar4"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":8},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"LuL1HK1sDruwkfm68jrVfD","verkey":"~Nyv9BKUJuvjgMbfbwk8CFD"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":9},"ver":"1"}
{"reqSignature":{},"txn":{"data":{"dest":"462p8mtcX6jpa9ky565YEL","verkey":"~LCgq4hnSvMvB8nKd9vgsTD"},"metadata":{"from":"V4SGRU86Z58d6TV7PBUe6f"},"type":"1"},"txnMetadata":{"seqNo":10},"ver":"1"}
你可以看到 DIDTh7MpTaRZVRYnPiabds81Y
是使用 verkey~7TYfekw4GUagBnBVCqPjiC
在这个账本上进行硬编码的,这与我们从种子000000000000000000000000Steward1
生成的内容相匹配。您还可以看到它被赋予了角色"2"
。如果你深入挖掘,你可以在indy-plenum
中找到 indy 使用的共识 alg. 项目,角色 ID2
是steward
角色。
种子是一个秘密值,当我们生成 Indy 网络的创世交易时,我们使用来自该秘密种子值的公共信息/密钥。
要知道写入种子值,要使用Actor生成的密钥创建自定义网络并生成pool_transactions_genesis和domain_transactions_genesis文件,您必须使用indy-plenum。
您可以在以下教程中找到详细信息:
https://taseen-junaid.medium.com/hyperledger-indy-custom-network-with-indy-node-plenum-protocol-ledger-85fd10eb5bf5
您可以在以下链接中找到该教程的代码库:
https://github.com/Ta-SeenJunaid/Hyperledger-Indy-Tutorial