我正在建立Hyperledger锯齿网络。在/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*'
有人可以告诉我如何创建另一个密钥对吗?
答案 0 :(得分:0)
这些是用于与其他节点安全通信的ZMQ消息密钥。
如果已经安装了锯齿,那么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
在/etc/sawtooth/validator.toml
中将相应的公钥输出复制到network_public_key并将私钥输出复制到network_private_key字段
以上内容来自我的锯齿常见问题解答,网址为 https://sawtooth.hyperledger.org/faq/validator/#how-do-i-generate-the-network-public-key-and-network-private-key-in-validator-toml