GithubHelp home page GithubHelp logo

isabella232 / web3j-aion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from web3j/web3j-aion

0.0 0.0 0.0 2.21 MB

web3j integration with the Aion network

License: Apache License 2.0

Java 45.79% Kotlin 53.42% Shell 0.79%

web3j-aion's Introduction

web3j Aion

web3j Aion integration Build Status

This project integrates web3j with the Aion network. It enables the deployment and invocation of Aion smart contracts from your Java code using web3j contract wrappers.

It is composed by the following modules:

  • AVM: Contains the encoder and decoder for interoperability with the Aion Virtual Machine.
  • Code generation: Provides a CLI for contract wrapper generation from the ABI and binaries.
  • Common: Contains common functionality like transaction signing and JSON-RPC implementation.

Quick start

The API starting point is the org.web3j.aion.protocol.Aion class. It implements the standard Ethereum JSON-RPC endpoints (eth_call, ethGetBalance, ...) with some Aion-specific features, as well as the administration endpoints (personal_NewAccount, ...).

To instantiate and start using it, create a service pointing to a node (http://localhost:8545 by default):

val service = HttpService()

then create an Aion instance and you start calling the API endpoints:

val aion = Aion.build(service)
aion.ethGetBalance("0x...", DefaultBlockParameterName.LATEST)

Sending signed transactions

Transactions can be signed locally and sent with the AionTransactionManager class.

val manager = AionTransactionManager(
    aion, Ed25519KeyPair("your private key")
)

// Default NRG and value
manager.sendTransaction(
    to = "0x...",
    data = "0x..."
)

To deploy a contract override the default values:

manager.sendTransaction(
    to = "0x...",
    data = "0x...",
    constructor = true,
    nrgLimit = AionConstants.NRG_CREATE_CONTRACT_DEFAULT
)

Generating contract wrappers

To learn how to use the CLI to generate contract wrappers, refer to the code generation module.

You can also checkout the sample repository to start with a configured Gradle project.

Building and testing

To build and run the unit tests:

  1. Clone this repository:

    git clone [email protected]:web3j/web3j-aion.git
  2. Change directory to the cloned repository:

    cd web3j-aion
  3. Run the Gradle build task:

    ./gradlew build

Integration tests

Before running the integration tests, check that your Docker version is at least 1.6.0 and you have more than 2GB of free disk space. To run the integration tests use the command:

./gradlew integrationTest

Work in progress

2-dimensional arrays are not currently supported but we are working in a web3j release to address that.

web3j-aion's People

Contributors

antonydenyer avatar iikirilov avatar xaviarias 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.