简体   繁体   中英

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. 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). "

How exactly the key value "ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc=" was generated i could not understand?

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 ?

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

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. Use bootnode to create private and public key pairs. And use constellation-node to generate .pub and .key files.

To answer the second part of your question, to get the contract address you can use eth.getTransactionReceipt(__); and copy the txHash you get (quoted) into the blank. 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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