简体   繁体   English

如何在法定人数下使智能合约私有

[英]How to make smart contract private in quorum

In the 7nodes example ( https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes ) for quorum, the smart contract that is deployed is a private contract between node1 and node7.在法定人数的 7nodes 示例( https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes )中,部署的智能合约是 node1 和 node7 之间的私有合约。 To make it private the script file author used public key passed by private key." sending of a private transaction to generate a (private) smart contract (SimpleStorage) sent from node 1 "for" node 7 (denoted by the public key passed via privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] in the sendTransaction call). "为了使其私有,脚本文件作者使用了由私钥传递的公钥。”发送私人交易以生成从节点 1 “for”节点 7 发送的(私人)智能合约(SimpleStorage)(由通过以下方式传递的公钥表示) privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="] 在 sendTransaction 调用中)。 "

How exactly the key value "ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=" was generated i could not understand?我不明白关键值“ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=”究竟是如何生成的?

Also, after the completion of the JS file script1.js, it gave me the Contract transaction send: TransactionHash", and i never got the contract address. When will the contract address come after the mining is completed ? How do i recognise that this address is my smart contract address ?还有,js文件script1.js完成后,给了我合约交易send:TransactionHash”,我一直没有得到合约地址。挖矿完成后合约地址什么时候来?我怎么识别这个地址是我的智能合约地址吗?

The keys are already generated for the nodes.已经为节点生成了密钥。 When you spin up the environment, each node is assigned a predefined dummy public keys.当您启动环境时,每个节点都会分配一个预定义的虚拟公钥。 this can be found at location : \\quorum-examples\\examples\\7nodes\\keys这可以在以下位置找到:\\quorum-examples\\examples\\7nodes\\keys

In 7Nodes example you can see the 256bit private key in raft/nodekey* files and the corresponding 512bit public key in nodename (enode) text in static-nodes.json.在 7Nodes 示例中,您可以看到 raft/nodekey* 文件中的 256 位私钥和 static-nodes.json 中 nodename (enode) 文本中相应的 512 位公钥。 Use bootnode to create private and public key pairs.使用 bootnode 创建私钥和公钥对。 And use constellation-node to generate .pub and .key files.并使用 constellation-node 生成 .pub 和 .key 文件。

To answer the second part of your question, to get the contract address you can use eth.getTransactionReceipt(__);要回答问题的第二部分,要获取合同地址,您可以使用eth.getTransactionReceipt(__); and copy the txHash you get (quoted) into the blank.并将您获得(引用)的txHash复制到空白处。 Then the contract address should come up in one of the fields returned.然后合约地址应该出现在返回的字段之一中。

Check out this page for more info/details.查看此页面以获取更多信息/详细信息。

The key used here is the public key of transaction manager which is respobsible for sending and receiving private transactions in addition to encrypting communications.这里使用的密钥是交易管理器的公钥,除了加密通信外,它还负责发送和接收私人交易。 You can find this key in file named tm.pub inside data folder of the node alongside its associated private key in file tm.key .您可以在指定的文件中这一关键tm.pub一起在文件中其相应的私钥的节点内部的数据文件夹tm.key

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM