Skip to content

ajb413/eth-event-megaphone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eth-event-megaphone

Whenever a solidity event fires in an Ethereum smart contract, we can harness it, and broadcast it to all of the contract followers using PubNub.

When a new Crowdsale is launched like in this contract, this node.js script can be used to signal to every investor's web browser that the sale has opened, display the buy button UI, and profit $$$.

// Build an ABI using the Truffle framework and Solidity, provide the JSON to this script

let TokenContractABI = web3.eth.contract(ContractBuild.abi);

let TokenContract = TokenContractABI.at('__YOUR_CONTRACT_ADDRESS__');

let crowdsaleDeployedEvent = TokenContract.CrowdsaleDeployed();

crowdsaleDeployedEvent.watch(function(error, result){
  publishMessage(result);
});

PubNub also provides API's for history, APNS, Functions, and more to send every flavor of signal to your customers.

About

Broadcast Web3.js events using PubNub.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages