发布合约到私链

一:环境说明

节点1:
1.ubuntu16.04 64位 (ip:172.16.29.11)
2.golang (1.10.3)
3.geth (1.8.12)
4.Etherum Wallet

节点2:
1.ubuntu16.04 64位 (ip:172.16.29.12)
2.golang (1.10.3)
3.geth (1.8.12)
4.Etherum Wallet
具体搭建步骤,参见以太坊多节点(两个节点)私链搭建

二:编写合约

启动remix-ide,浏览器打开地址http://127.0.0.1:8080/
编写合约(无实际意义的合约):

pragma solidity ^0.4.24;
contract EnumDemo{
    enum ActionChoices{GoLeft,GoRight}
    ActionChoices public choices;
    ActionChoices defaultc = ActionChoices.GoRight;
    function setChoices() public{
        choices = ActionChoices.GoRight;
    }
    function getChoices() public view returns (ActionChoices){
        return choices;
    }
    function defaultChoices() public view returns (uint){
        return uint(defaultc);
    }
}

在remix的settings中选择合约对应的版本:
这里写图片描述
在remix的compile中编译此合约:
这里写图片描述

三:发布合约

启动钱包,点击【CONTRACTS】->【DEPLOY NEW CONTRACT】
这里写图片描述
将合约代码copy,粘贴到【SOLIDITY CONTRACT SOURCE CODE】,如果代码无错误,右侧会出现【SELECT CONTRACT DEPLOY】,否则将提示错误信息。
这里写图片描述
选择你的合约,点击【DEPLOY】,发布完成。

四:挖矿

发布合约后,进行挖矿,使合约创建完成。
这里写图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值