i'm noob, I want to deploy my contract on Ropsten network with MetaMask & Truffle, plz explain to me the steps to deploy it.
-
Hi there. I think your question will be flagged as being too broad, I'm afraid. You could ask somewhere like Reddit, and then if you have specific problems, ask them here. www.reddit.com/r/ethereum – Richard Horrocks Jul 30 '17 at 11:16
1 Answers
Solution 1: With you own node
You can easily deploy on the ropsten network if you own a full node running on your machine.
i. Run geth
$ geth --fast --cache=1048 --testnet --unlock "0xmyaddress" --rpc --rpcapi "eth,net,web3" --rpccorsdomain '*' --rpcaddr localhost --rpcport 8545
ii. In truffle.js, add the following configure for the ropsten network
module.exports = {
networks: {
localhost: {
host: "localhost",
port: 8546,
network_id: "*"
},
ropsten: {
host: "localhost",
port: 8545,
network_id: "3"
}
}
};
iii. Deploy on the ropsten network
$ truffle migrate --network ropsten
Solution 2: With a public node like Infura
i. Install the needed libraries
Navigate into the project folder and run the following command:
npm init
npm install truffle-hdwallet-provider --save
ii. In truffle.js, Add the following code to unlock your Metamask account and configure the Infura Ropsten node as entry point by providing the mnemonic phrase (Metamask / Settings / Reveal Seed Words)
var HDWalletProvider = require("truffle-hdwallet-provider");
var infura_apikey = "XXXXXX";
var mnemonic = "twelve words you can find in metamask/settings/reveal seed words blabla";
module.exports = {
networks: {
development: {
host: "localhost",
port: 8545,
network_id: "*" // Match any network id
},
ropsten: {
provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey),
network_id: 3
}
}
};
iii. Deploy on the ropsten network
$ truffle migrate --network ropsten
EDIT: Replace the solution by truffle-hdwallet-provider.Way more simple solution than ethereumjs-wallet bip39 web3-provider-engine web3
- 7,207
- 2
- 19
- 35
-
3
-
With the first solution, you need a local synchronised full node (all blocks). The second solution relies on a third party with a fully synchronised node, you don't need a node at all – Greg Jeanmart Jul 31 '17 at 11:30
-
1i have error when i run second solution
Error: Cannot find module 'ethereumjs-wallet/hdkey'
– TahaBA Jul 31 '17 at 12:38 -
Hi, sorry I forgot one point in the second solution. You need to execute this command first:
npm install ethereumjs-wallet bip39 web3-provider-engine web3 --save(I edited the answer with the details) – Greg Jeanmart Aug 01 '17 at 09:43 -
The problem was not resolved,Error: Cannot find module 'ethereumjs-wallet/hdkey' – TahaBA Aug 01 '17 at 15:54
-
1I pushed my code on github to give you an example : https://github.com/gjeanmart/stackexchange/tree/master/23279-what-is-steps-to-deploy-the-contract-on-ropsten-network – Greg Jeanmart Aug 01 '17 at 22:03
-
i have a lot missing packages like Error: Cannot find module 'babel-register'. can you add some information's to contact you by you'r profile account – TahaBA Aug 01 '17 at 22:53
-
-
For the second solution, I get
AssertionError [ERR_ASSERTION]: The field nonce must not have more 32 bytes. Using truffle-hdwallet-provider 0.0.5. – Paul Razvan Berg May 22 '18 at 14:53 -
I'm so close but I am getting the error: Error encountered, bailing. Network state unknown. Review successful transactions manually. insufficient funds for gas * price + value. I am trying to push 1 billion tokens with the following gas ropsten: { provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/MYAPIADDRESS"), network_id: 3, host: "127.0.0.1", port: 8545, gas: 2900000
How do I get the wallet address so I can fund it will ETH? or is the gas prices I have set wrong?
– JJacquet Jun 09 '18 at 02:27