synechron-finlabs / quorum-maker

Utility to create and monitor Quorum nodes
Apache License 2.0
196 stars 97 forks source link

not able to deploy contract on quorum maker network through truffle #102

Open romisalve opened 5 years ago

romisalve commented 5 years ago

I have developed a Quorum maker network and configured the truffle-config.js to connect to it. If I open truffle console, it makes no errors, so I understand is accessing the network. Also, I am able to acces web UI of quorum maker so in fact the network is created.

However, when I tried to deploy a contract through truffle, I got: image

Also, if I deploy the contract directly from quorum maker web UI, the contracts appears to be deployed but if form truffle console I run "networks", I get that no contract is deployed on the network, so something is generating that inconsistency and I don't understand the reason.

hellowodl commented 5 years ago

I had this issue too a short while ago. I fixed the truffle deployment by setting a provider with a corresponding key in the truffle-config through truffle-hdwallet-provider.

My hypothesis is that Truffle tries to use the blockchain node's stored accounts for deployment, which somehow doesn't go too well, even if you unlock the account.

Here's a snip out of my truffle-config.js

const HDWalletProvider = require("truffle-hdwallet-provider")
const mnemonic = 'mnemonic 12 word seed phrase'
const getProvider = (url) => new HDWalletProvider(mnemonic, url)

module.exports = {
    production: {
        network_id: "*",
        gasPrice: 0,
        type: 'quorum',
        provider: getProvider('BLOCKCHAIN NODE'),
        from: 'public key to deploy from'
    },
}

This allowed me to deploy the thing through truffle, and saved me a lot of pain.

romisalve commented 5 years ago

Ok, you have used that configuration to work with Quorum Maker?

I have some doubts on the value of some fields. On the line of "getProvider", the url would be the IP and RPC port of my node?

On setting "provider" on "production" network, at what do you make reference with 'BLOCKCHAIN NODE'? On "from" field on "production" network, where do you get that public key from? Is not supposed to be an address instead of a key?

By using this truffle is still working with my Quorum Maker Network? What happens with the accounts of its nodes? Sorry I am a bit confused

abhayar commented 5 years ago

@romisalve from the above error, truffle version 5.0.14 used to deploy contract . Contract deployement is failed for the same version. It will be deployed with truffle version 4. Will you please try it on degraded version..? And for above error

authentication needed: password or unlock"

Unlock eth account (used in truffle.js or truffle-config.js) from geth console with password from which contracts are about to deploy.

romisalve commented 5 years ago

@abhayar Thanks for your answer, I was able to deploy to the network without degrading it. I have another issue now, I need to consume my smart contract function from a third party, for example something similar to POSTMAN. I understood that there is no way to expose an URL to consume the smart contract functions, but maybe do you know a workaround.

Someone recommended me truffle-contract, but I don´t understand where should I use it, I mean, in which file or directory, or where can I use the "smart contract wrappers"

Thank you!!

lipka00 commented 4 years ago

@romisalve How did you manage the deployment with truffle? I struggle with tehe right configuration.. Thank you!

abhayar commented 4 years ago

@lipka00 truffle framework is use to deploy smart contract

lipka00 commented 4 years ago

@abhayar thank you! Unfortunately i don't manage to get the right truffle-config.js

image

When I use this config there is an error that the HDWalletProvider is not defined.

Maybe you can show a snippet of the right params?

abhayar commented 4 years ago

@lipka00 which network you are using , local network or TestNetwork..?

For rinkeby test network

var HDWalletProvider = require("truffle-hdwallet-provider");
var mnemonic = "<12 seed word> ";
module.exports = {
networks: {
 rinkeby: {
 provider:new HDWalletProvider(mnemonic,"<ri kevu url>"),
 network_id: 4,
 gas: 6712390,
}
}
};

For development network

module.exports = {
  networks: {
    development: {
      host: "<ip address>",
      port: 13000,
      network_id: "*", // Match any network id
      gasPrice: 0,
      gas: 800000000
    }
   }
};
lipka00 commented 4 years ago

@abhayar I using a Quorum Network on an AWS ec2 Ubuntu instance. I got a similar authentification error as above.

abhayar commented 4 years ago

@lipka00 did you try with above configuration?

provider:new HDWalletProvider(mnemonic,"<rinkeby url>"),
lipka00 commented 4 years ago

@abhayar got it! The account at the deployment node was locked. Unlock with truffle console helps. Thank you!