enter image description hereI am unable to interact with contract using Dapp deployed on Quorum blockchain (using metamask). I am following "https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains". I have successfully set up Quorum 7node blockchain then I created a simple set and get Dapp for the same contract given in the above link. I have managed to import coinbase of each node to metamask. I have created 3 custom RPC, 22003 and 22006 and imported respective coinbase to metamask(following "How to import account form geth console to metamask (private blockchain)"). I have created a simple app.js similar to truffle pet shop tutorial,

App.js file enter image description here

I have deployed contract with privateFor tag in migration and for set function same as shown in truffle quorum 7node example.

But when I try to change the value of storage data from dapp, I am unable to change it (it reflect the same constant value). whereas from geth node I am able to change value of storage data. Even from sampletx.js(using truffle exec sampletx.js) i am able to change storage data value .

1 Answer 1


Yes, I can help you here Steps are

  1. Vagrant up (only one time)
  2. Vagrant ssh(one cmd panel)

You will get like vagrant@ubuntu-xenial:~$

After this go to cd quroum-example/7nodes/

3.on same cmd $./raft-start.sh 4.Run this command vagrant@ubuntu-xenial:~/quorum-examples/7nodes$ geth attach qdata/dd1/geth

Open new terminal and got to directory of quroum-example and and type vagrant ssh

5.open new geth instance here by using 3,4 steps above add geth instance but this time geth attach qdata/dd4/geth

6.this above is your build envirnoment for two geth instance.

7.In the tutorial "https://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains" you will have directory like enter image description here enter image description here

in the terminal of geth attach qdata/dd1/geth use this commands

=> var bytecode = "your smart Contract byte code"
 =>var simpleContract = eth.contract([{ "constant": true,"inputs": [],"name": "storedData","outputs": [{"name": "","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"},{"inputs": [{"name": "initVal1","type": "uint256"}],"payable": false,"stateMutability": "nonpayable","type": "constructor"},{"constant": false,"inputs": [{"name": "x","type": "uint256"}],"name": "set","outputs": [],"payable": false,"stateMutability": "nonpayable","type": "function"},{"constant": true,"inputs": [],"name": "get","outputs": [{"name": "retVal","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"}]) 

> simpleContract.new(20, {from:eth.accounts[0], data: bytecode, gas: 0x47b760,privateFor: ["ROAZBWtSacxXQrOe3FGAqJDyJjFePR5ce4TSIzmJ0Bc="]})

And then check it with var test2 = attaching screeshotsenter image description here

enter image description here

  • Do one thing deployed contract again and set the value of x again , or do one thing please remove "private for" and leave it empty here.Than please check it will work
    – user45383
    Oct 31, 2018 at 11:13
  • actually, you are not using contact Address way, generally If i need to change the values I use contract address to call the smart contract abi. I asked you to remove because it will run for all network peers .
    – user45383
    Oct 31, 2018 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.