环境
注册infura获取API-KEY
编写truffle配置文件
npm install truffle-hdwallet-provider
- truffle-config.js
var HDWalletProvider = require("truffle-hdwallet-provider");
var infura_apikey = "CsS9shwaAab0z7B4LP2d";
var mnemonic = "drill hunt food team moment mistake bird attitude tunnel ecology sister resist";
module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*"
},
private: {
host: "localhost",
port: 8545,
network_id: "*"
},
ropsten: {
provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey),
network_id: 3,
gas: 3012388,
gasPrice: 30000000000
},
main: {
provider: new HDWalletProvider(mnemonic, "https://mainnet.infura.io/"+infura_apikey),
network_id: 3,
gas: 3012388,
gasPrice: 1000000000
}
}
};
部署到主网
--
备注