pragma solidity ^0.4.8; | |
contract GlobalEvents { | |
address private owner; | |
event eventEmited(address publisher, string data_url, string hash); | |
function GlobalEvents() { owner = msg.sender; } | |
function kill() { if (msg.sender == owner) selfdestruct(owner); } | |
function emitEvent(string data_url, string hash) { | |
eventEmited(msg.sender, data_url, hash); | |
} | |
} |
Stay updated! We are starting to open up FirePin for public usage!
How to become a beta tester? Just mail us facebookchatbot.fire
// How to connect to Etherium Blockchain Platform | |
// Emitting events and listening for events within blockchain network | |
var Web3 = require('web3'); | |
const HOST = ''; | |
const ACCOUNT = ''; | |
const ContractData = {...}; | |
// Connection | |
var provider = new Web3.providers.HttpProvider(HOST); | |
var web3 = new Web3(provider); | |
web3.eth.defaultAccount = ACCOUNT; | |
// Initializing contract | |
var contract = web3.eth.contract(ContractData.ABI); | |
var contractInstance = contract.at(ContractData.address); | |
// Emitting event | |
contractInstance.emitEvent(ACCOUNT, 'data', 'some_hast', { gas: 200000 }); | |
// Listening events | |
contractInstance.allEvents().watch(function(error, event) { | |
// Received event | |
}); |
SpaceApps is a NASA incubator innovation program.