'Deploying a smart contract from the 2nd user account
how do I deploy a smart contract using a 2nd account?
const xxx = artifacts.require("xxx");
var web3 = require('web3');
module.exports = function (deployer, accounts) {
deployer.deploy(xxx, {from: accounts[1]});
};
There is an error.
Error: *** Deployment Failed ***
"xxx" -- Provided address e is invalid, the capitalization checksum test failed, or it's an indirect IBAN address which can't be converted. -- Reason given: Custom error (could not decode)..
May I know how to fix it?
Also, what is the difference between accounts[1] and web3.eth.accounts[1]?
Solution 1:[1]
I managed to remove the error by adding 'network' as one of the parameters in the function.
module.exports = function (deployer, network, accounts) {
Let me know if there are alternative ways to do it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | futuristicoptimist |
