我正在使用Ethereum智能契约创建一个DApp,它是以稳健性编写的。
我想与合同互动,并向P2P游戏的获胜者支付代币。为了简单起见,游戏可以是石头剪刀。一名证人将主持比赛,并向合同发出通知,向胜利者支付款项。
假设我们有两位玩家:player 1有一个带公钥a1b2c3d4e5 (本轮胜利者)的电子钱包。
player 2拥有f6g7h8i9j0的公钥(这一轮的输家)
证人将如何访问我的可靠智能合同的功能,将支付player 1,从游戏方面?
发布于 2017-09-26 02:51:43
您可以使用登船框架构建与以太块链交互的分散的HTML5应用程序。
Embark包括一个测试库,用于在EVM ()中快速运行和测试您的合同。
支持指规数。
您可以创建智能契约,如:
pragma solidity ^0.4.7;
contract SimpleStorage {
uint public storedData;
function SimpleStorage(uint initialValue) {
storedData = initialValue;
}
function set(uint x) {
storedData = x;
}
function get() constant returns (uint retVal) {
return storedData;
}
}这样的JS框架可能会触发一个事件
myContract.eventName({from: web3.eth.accounts}, 'latest')
.then(function(event) { console.log(event) });通过IPFS连接进行的通信如下所示
//set yourself as the ipfs provider
EmbarkJS.Messages.setProvider('orbit', {server: 'localhost', port: 5001})
EmbarkJS.Messages.sendMessage({topic: "sometopic", data: 'hello world'})https://stackoverflow.com/questions/46391760
复制相似问题