我正在撰写我自己的可靠的智能合同,并试图在Remix中测试。主要的Remix站点似乎正在下降(https://remix.ethereum.org/)。我找到了另一个网站:https://ethereum.github.io/browser-solidity/#optimize=false&version=soljson-v0.4.24+commit.e67f0147.js,并且正在尝试在那里进行测试。我甚至不能测试文档中的示例代码,更不用说我自己的合同了。我看不到从示例代码中调用这些方法的地方。下面是示例代码:
pragma solidity ^0.4.24;
contract Coin {
// The keyword "public" makes those variables
// readable from outside.
address public minter;
mapping (address => uint) public balances;
// Events allow light clients to react on
// changes efficiently.
event Sent(address from, address to, uint amount);
// This is the constructor whose code is
// run only when the contract is created.
constructor() public {
minter = msg.sender;
}
function mint(address receiver, uint amount) public {
if (msg.sender != minter) return;
balances[receiver] += amount;
}
function send(address receiver, uint amount) public {
if (balances[msg.sender] < amount) return;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Sent(msg.sender, receiver, amount);
}
}有人能帮我测试一下吗?我主要关心的是能够测试我的代码。一旦我能够验证示例代码是否有效,我就可以测试我自己的合同。先谢谢你。
发布于 2018-09-10 09:52:26
现在我身边的混音在起作用..。不管怎么说,如果用于生产活动,离线使用它是绝对有用的.如果离线服务器,你继续工作!
您应该使用Nodejs命令在本地安装它。
这样:安装Nodejs (如果没有),然后从Nodejs提示符写
"npm安装-g混合-ide“
它将安装最新版本,即0.6.4,目前我正在编写这篇文章。
(注意:如果您正在处理一些多合同应用程序,现在使用"npm安装-g remix-ide@0.6.3“,以避免在下一个版本中修复的一些bug)。
完成后,在Nodejs控制台上写“remix”,然后在后台打开shell。
然后从您的浏览器转到http://127.0.0.1:8080,您将发现混合工作。
(顺便说一句,这种方法为您提供了从remix直接访问硬盘的宝贵可能性,无论是在读写方面。当代码在remix-ide窗口中被修改时,它将在相关文件中自动更新。搜索“混合”文档以获得详细信息。它很有用,而且很容易使用!)
https://ethereum.stackexchange.com/questions/58410
复制相似问题