Remix + Metamask + MyetherWallet
2.在Remix中选择不同的部署网络,并部署

3.然后在Metamask中点击确定

4.获取ABI


5.在MyEtherWallet中初始化合约调用

Truffle+Infura
1.注册Infura账户

2.下载插件
npm install -g truffle-hdwallet-provider
3.将truffle的网络配置换为infura的网络
# 编辑文件
vim truffle.js
var HDWalletProvider = require("truffle-hdwallet-provider");
var infura_apikey = "";
var mnemonic = "";
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
port: 8545,
network_id: "*"
},
ropsten: {
provider: function() {
return new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey)
},
network_id: 3,
gas: 3012388,
gasPrice: 30000000000
},
main: {
provider: function() {
return new HDWalletProvider(mnemonic, "https://mainnet.infura.io/"+infura_apikey)
},
network_id: 3,
gas: 21000,
gasPrice: 1000000000
}
}
};
# 编译
truffle compile
# 部署
truffle migrate --reset --network ropsten
Truffle + Etherum Full Node (Geth,Parity)
1.本地下载以太坊的全节点。
2.部署时选用main的主配置。
vim truffle.js
main: {
host: "127.0.0.1",
port: 8545,
network_id: "*"
}
网友评论