Coder Social home page Coder Social logo

jquentin / ethereumc2plugin Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 8.0 372 KB

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

License: MIT License

HTML 0.33% JavaScript 99.67%
construct2 plugins ethereum ethereum-contract ethereum-dapp web3

ethereumc2plugin's Introduction

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)

ethereumc2plugin's People

Contributors

jquentin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.