Hypelerdger Indy节点-种子值

时间:2019-11-28 12:42:14

标签: blockchain hyperledger hyperledger-indy

我正在使用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)的演练演示中,管理者集合的种子值等于'000000000000000000000000Steward1'。

如果我更改(或将其留空),则会收到错误消息。另外,在/tmp/indy/poo1.txn中也没有有关此特定值的信息。

我的问题是我们如何知道这是正确的值以及如何获得它?

2 个答案:

答案 0 :(得分:1)

为什么不起作用

000000000000000000000000Steward1是种子(给定默认密钥派生方法)生成DID Th7MpTaRZVRYnPiabds81Y。您可以使用indy-clicommand line tool

进行验证
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

在您使用的网络中,DID VsKV7grR1BUE29mG2Fm2kX的所有者(即,知道其关联的私钥或种子的人)具有steward角色,该角色授予对分类帐执行各种操作的权限。因此,如果您修改种子,它将生成不同的DID,而该DID将不需要执行本教程中进一步使用的操作(例如在分类帐上写入数据)所需的权限。

000000000000000000000000Steward1来自哪里

根据您所说的,我假设您正在使用其中instructions.个实例中的indy-node个实例的indy-sdk存储库运行池中的预构建docker映像 因此,简单的答案是000000000000000000000000Steward1的配置已在其中预烘焙。查看用于构建印地池图像的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

在区块链中,创始文件通常是您最初用于启动网络并可能用一些数据填充网络的文件。如果是超级账本,则有4个“子账本”包含不同类型的交易:domainpoolconfigauditdomain子分类帐是包含诸如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"}

您会看到DID Th7MpTaRZVRYnPiabds81Y在该分类帐上使用了密钥~7TYfekw4GUagBnBVCqPjiC进行了硬编码,该密钥与我们从种子000000000000000000000000Steward1生成的密钥相匹配。您还可以看到它被赋予了角色"2"。如果深入研究,可以在indy-plenum中找到共识算法。 indy使用的项目,其角色ID 2steward role

答案 1 :(得分:0)

种子是一个秘密值,当我们生成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