实验环境:chrome、Metamask插件
Remix网页:remix.ethereum.org
智能合约介绍:https://www.bilibili.com/video/BV1sJ411D72u?p=488
在remix网页中,编译部署简单投票合约并给出代码以及结果截图
教程链接:https://www.bilibili.com/video/BV1sJ411D72u?p=489
pragma solidity >0.4.22;
contract Ballot{
struct Voter{
uint weight;
bool voted; // 是否投票
uint8 vote; // 投给谁了
address delegate;
}
struct Proposal{
uint voteCount;
}
address public chairperson; // 主席
Proposal[] proposals;
mapping(address=>Voter) voters; //address到Voter的mapping
constructor(uint _numberProposals){
chairperson = msg.sender;
voters[chairpers