Giter Club home page Giter Club logo

iotex-android-sdk's Introduction

IoTeX Android SDK

LICENSE

Welcome to the official Java implementation of IoTeX Android SDK! IoTeX is building the next generation of the decentralized network for IoT powered by scalability- and privacy-centric blockchains. Please refer to IoTeX whitepaper for details.

Get started

Add to your project

// through git submodule
git submodule add --force [email protected]:iotexproject/iotex-android-framework.git iotex-android-framework

Install By Maven

<dependency>
  <groupId>com.github.iotexproject</groupId>
  <artifactId>iotex-android-sdk</artifactId>
  <version>0.3.0</version>
</dependency>

Install by Gradle

implementation 'com.github.iotexproject:iotex-android-sdk:0.3.0'

Sample

// create account from private key
Account account = IotexAccount.create(IotexAccountTest.TEST_PRIVATE);
IOTX iotx = new IOTX("api.testnet.iotex.one:80");

// create KeyStore file
KeystoreFile walletFile = Keystore.createStandard("123456", Numeric.toBigInt(account.privateKey()));

// transfer
TransferRequest request = new TransferRequest();
request.setNonce(1l); // optional, can be null
request.setGasLimit(100000l); // optional, can be null
request.setGasPrice("1000000000000"); // optional, can be null
request.setAccount(account);
request.setAmount("100");
request.setRecipient("io13zt8sznez2pf0q0hqdz2hyl938wak2fsjgdeml");
request.setPayload("68656c6c6f20776f726c6421"); // optional, can be null

String hash = iotx.sendTransfer(request);

// contract deploy
Contract contract = new Contract(iotx.currentProvider(), CONTRACT_ABI, Numeric.hexStringToByteArray(CONTRACT_BIN));
String hash = contract.deploy(null, 100000l, "1000000000000", account, "0", 5);

// contract execute
Contract contract = new Contract(provider, CONTRACT_ADDRESS, CONTRACT_ABI);
String hash = contract.execute(null, 100000l, "1000000000000", account, "set", "0", 10);

iotex-android-sdk's People

Contributors

ququzone avatar xiaxiangzhou avatar

Watchers

James Cloos 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.