Skip to content

Two plugins to integrate the Ethereum Blockchain in your Construct 2 game

License

Notifications You must be signed in to change notification settings

Gamlr/EthereumC2Plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EthereumC2Plugin

Here are two plugins to integrate the Ethereum Blockchain in your Construct 2 game.

Some details

They both use the Web3 Javascript API version 0.2, so it works with all compatible browsers, like Metamask or Mist. Like in Web3, there are 2 ways to call most functions: synchronous or asynchronous (although some nodes like Metamask don't support synchronous calls).

To call a function synchronously:

- Just use the corresponding Expression or Action

To call a function asynchronously:

- Add the corresponding action, with a chosen callbackID parameter
- Add an OnCallback condition with the same callbackID
- Use Ethereum(or the EthereumContract).CurrentCallbackResponse to get the function's response

The plugins:

Ethereum

Contains most functions in the Web3 API (let me know if some useful ones are missing). Go to the page linked higher for a complete list and descriptions.

Ethereum Contract

Facilitates communication with a smart contract. The contract's ABI and address are properties of the plugin, so an instance is created on the plugin's creation. The main actions are:

- Call : Calls a constant function of the contract
- Send : Sends a transaction to the contract

Examples

There is a simple example project in the github project. You can also look at this real life project that uses the plugin.

Possible Improvements

- Multiple contract addresses for the different networks
- Implement CallSuchFunctionAndWait actions to use asynchronous functions like if they were synchronous (in the meantime, you can use WaitForSignal to do that)

About

Two plugins to integrate the Ethereum Blockchain in your Construct 2 game

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 99.7%
  • HTML 0.3%