首页 > 解决方案 > 如何创建 Hyperledger Sawtooth 网络密钥

问题描述

我正在建立一个 Hyperledger Sawtooth 网络。在/etc/sawtooth/validator.toml.example中,我看到了以下内容:

# A Curve ZMQ key pair are used to create a secured network based on side-band
# sharing of a single network key pair to all participating nodes.
# Note if the config file does not exist or these are not set, the network
# will default to being insecure.
network_public_key = 'wFMwoOt>yFqI/ek.G[tfMMILHWw#vXB[Sv}>l>i)'
network_private_key = 'r&oJ5aQDj4+V]p2:Lz70Eu0x#m%IwzBdP(}&hWM*'

谁能告诉我如何创建另一个密钥对?

标签: hyperledger-sawtooth

解决方案


这些是用于与其他节点安全通信的 ZMQ 消息密钥。

如果您已经安装了sawtooth,那么python3 和python3-zmq 将已经安装并在您的系统中可用。这是在 Python 中创建密钥对的示例:

import zmq
(public, secret) = zmq.curve_keypair()
print("network_public_key =", public.decode("utf-8"),
      "\nnetwork_private_key =", secret.decode("utf-8"))

另外,如果您可以使用已编译的二进制工具:

$ sudo apt-get install g++ libzmq3-dev
$ wget https://raw.githubusercontent.com/zeromq/libzmq/master/tools/curve_keygen.cpp
$ g++ curve_keygen.cpp -o curve_keygen -lzmq
$ ./curve_keygen

将对应的公钥输出复制到network_public_key,将私钥输出复制到network_private_key中的字段/etc/sawtooth/validator.toml

以上来自我在https://sawtooth.hyperledger.org/faq/validator/#how-do-i-generate-the-network-public-key-and-network-private-key-in-validator的 Sawtooth 常见问题解答 -toml


推荐阅读