API Reference Java

Installing

The Incubed Java client uses JNI in order to call native functions. But all the native-libraries are bundled inside the jar-file. This jar file ha no dependencies and can even be used standalone:

like

java -cp in3.jar in3.IN3 eth_getBlockByNumber latest false

How to use IN3 in android project.

  1. clone in3 in your project (or use script to update it):
#!/usr/bin/env sh
if [ -f in3/CMakeLists.txt ]; then
    cd in3
    git pull
    cd ..
else
    git clone https://github.com/blockchainsllc/in3.git
fi
  1. add the native-build section and the additional source-set in your build.gradle in the app-folder inside the android-section:
externalNativeBuild {
    cmake {
        path file('../in3/CMakeLists.txt')
    }
}
sourceSets {
  main.java.srcDirs += ['../in3/java/src']
}

if you want to configure which modules should be included, you can also specify the externalNativeBuild in the ,defaultConfig,:`

defaultConfig {
    externalNativeBuild {
        cmake {
            arguments "-DBTC=OFF", "-DZKSYNC=OFF"
        }
    }
}

For possible options, see https://in3.readthedocs.io/en/develop/api-c.html#cmake-options

Now you can use any Functions as defined here https://in3.readthedocs.io/en/develop/api-java.html

Here is example how to use it:

https://github.com/blockchainsllc/in3-example-android

Downloading

The jar file can be downloaded from the latest release. here.

Alternatively, If you wish to download Incubed using the maven package manager, add this to your pom.xml

<dependency>
  <groupId>it.slock</groupId>
  <artifactId>in3</artifactId>
  <version>2.21</version>
</dependency>

After which, install in3 with mvn install.

Building

For building the shared library you need to enable java by using the -DJAVA=true flag:

git clone git@github.com:slockit/in3-c.git
mkdir -p in3-c/build
cd in3-c/build
cmake -DJAVA=true .. && make

You will find the in3.jar in the build/lib - folder.

Android

In order to use Incubed in android simply follow these steps:

Examples

CallFunction

source : in3-c/java/examples/CallFunction.java

Calling Functions of Contracts

// This Example shows how to call functions and use the decoded results. Here we get the struct from the registry.

import in3.*;
import in3.eth1.*;

public class CallFunction {
  //
  public static void main(String[] args) {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default)

    // call a contract, which uses eth_call to get the result.
    Object[] result = (Object[]) in3.getEth1API().call(                      // call a function of a contract
        "0x2736D225f85740f42D17987100dc8d58e9e16252",                        // address of the contract
        "servers(uint256):(string,address,uint256,uint256,uint256,address)", // function signature
        1);                                                                  // first argument, which is the index of the node we are looking for.

    System.out.println("url     : " + result[0]);
    System.out.println("owner   : " + result[1]);
    System.out.println("deposit : " + result[2]);
    System.out.println("props   : " + result[3]);
  }
}

Configure

source : in3-c/java/examples/Configure.java

Changing the default configuration

// In order to change the default configuration, just use the classes inside in3.config package.

package in3;

import in3.*;
import in3.config.*;
import in3.eth1.Block;

public class Configure {
  //
  public static void main(String[] args) {
    // create incubed client
    IN3 in3 = IN3.forChain(Chain.GOERLI); // set it to goerli

    // Setup a Configuration object for the client
    ClientConfiguration clientConfig = in3.getConfig();
    clientConfig.setReplaceLatestBlock(6); // define that latest will be -6
    clientConfig.setAutoUpdateList(false); // prevents node automatic update
    clientConfig.setMaxAttempts(1);        // sets max attempts to 1 before giving up
    clientConfig.setProof(Proof.none);     // does not require proof (not recommended)

    // Setup the ChainConfiguration object for the nodes on a certain chain
    NodeRegistryConfiguration chainConfiguration = clientConfig.getNodeRegistry();
    chainConfiguration.setNeedsUpdate(false);
    chainConfiguration.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f");
    chainConfiguration.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb");

    Block block = in3.getEth1API().getBlockByNumber(Block.LATEST, true);
    System.out.println(block.getHash());
  }
}

GetBalance

source : in3-c/java/examples/GetBalance.java

getting the Balance with or without API

import in3.*;
import in3.eth1.*;
import java.math.BigInteger;
import java.util.*;

public class GetBalance {

  static String AC_ADDR = "0xc94770007dda54cF92009BFF0dE90c06F603a09f";

  public static void main(String[] args) throws Exception {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default)

    System.out.println("Balance API" + getBalanceAPI(in3).longValue());

    System.out.println("Balance RPC " + getBalanceRPC(in3));
  }

  static BigInteger getBalanceAPI(IN3 in3) {
    return in3.getEth1API().getBalance(AC_ADDR, Block.LATEST);
  }

  static String getBalanceRPC(IN3 in3) {
    return in3.sendRPC("eth_getBalance", new Object[] {AC_ADDR, "latest"});
  }
}

GetBlockAPI

source : in3-c/java/examples/GetBlockAPI.java

getting a block with API

import in3.*;
import in3.eth1.*;
import java.math.BigInteger;
import java.util.*;

public class GetBlockAPI {
  //
  public static void main(String[] args) throws Exception {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default)

    // read the latest Block including all Transactions.
    Block latestBlock = in3.getEth1API().getBlockByNumber(Block.LATEST, true);

    // Use the getters to retrieve all containing data
    System.out.println("current BlockNumber : " + latestBlock.getNumber());
    System.out.println("minded at : " + new Date(latestBlock.getTimeStamp()) + " by " + latestBlock.getAuthor());

    // get all Transaction of the Block
    Transaction[] transactions = latestBlock.getTransactions();

    BigInteger sum = BigInteger.valueOf(0);
    for (int i = 0; i < transactions.length; i++)
      sum = sum.add(transactions[i].getValue());

    System.out.println("total Value transfered in all Transactions : " + sum + " wei");
  }
}

GetBlockRPC

source : in3-c/java/examples/GetBlockRPC.java

getting a block without API

import in3.*;
import in3.eth1.*;
import java.math.BigInteger;
import java.util.*;

public class GetBlockRPC {
  //
  public static void main(String[] args) throws Exception {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also the default)

    // read the latest Block without the Transactions.
    String result = in3.sendRPC("eth_getBlockByNumber", new Object[] {"latest", false});

    // print the json-data
    System.out.println("current Block : " + result);
  }
}

GetTransaction

source : in3-c/java/examples/GetTransaction.java

getting a Transaction with or without API

import in3.*;
import in3.eth1.*;
import java.math.BigInteger;
import java.util.*;

public class GetTransaction {

  static String TXN_HASH = "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab5252287c34bc5d12457eab0e";

  public static void main(String[] args) throws Exception {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default)

    Transaction txn = getTransactionAPI(in3);
    System.out.println("Transaction API #blockNumber: " + txn.getBlockNumber());

    System.out.println("Transaction RPC :" + getTransactionRPC(in3));
  }

  static Transaction getTransactionAPI(IN3 in3) {
    return in3.getEth1API().getTransactionByHash(TXN_HASH);
  }

  static String getTransactionRPC(IN3 in3) {
    return in3.sendRPC("eth_getTransactionByHash", new Object[] {TXN_HASH});
  }
}

GetTransactionReceipt

source : in3-c/java/examples/GetTransactionReceipt.java

getting a TransactionReceipt with or without API

import in3.*;
import in3.eth1.*;
import java.math.BigInteger;
import java.util.*;

public class GetTransactionReceipt {
  static String TRANSACTION_HASH = "0xdd80249a0631cf0f1593c7a9c9f9b8545e6c88ab5252287c34bc5d12457eab0e";

  //
  public static void main(String[] args) throws Exception {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also the default)

    TransactionReceipt txn = getTransactionReceiptAPI(in3);
    System.out.println("TransactionRerceipt API : for txIndex " + txn.getTransactionIndex() + " Block num " + txn.getBlockNumber() + " Gas used " + txn.getGasUsed() + " status " + txn.getStatus());

    System.out.println("TransactionReceipt RPC : " + getTransactionReceiptRPC(in3));
  }

  static TransactionReceipt getTransactionReceiptAPI(IN3 in3) {
    return in3.getEth1API().getTransactionReceipt(TRANSACTION_HASH);
  }

  static String getTransactionReceiptRPC(IN3 in3) {
    return in3.sendRPC("eth_getTransactionReceipt", new Object[] {TRANSACTION_HASH});
  }
}

SendTransaction

source : in3-c/java/examples/SendTransaction.java

Sending Transactions

// In order to send, you need a Signer. The SimpleWallet class is a basic implementation which can be used.

package in3;

import in3.*;
import in3.eth1.*;
import java.io.IOException;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

public class SendTransaction {
  //
  public static void main(String[] args) throws IOException {
    // create incubed
    IN3 in3 = IN3.forChain(Chain.MAINNET); // set it to mainnet (which is also dthe default)

    // create a wallet managing the private keys
    SimpleWallet wallet = new SimpleWallet();

    // add accounts by adding the private keys
    String keyFile      = "myKey.json";
    String myPassphrase = "<secrect>";

    // read the keyfile and decoded the private key
    String account = wallet.addKeyStore(
        Files.readString(Paths.get(keyFile)),
        myPassphrase);

    // use the wallet as signer
    in3.setSigner(wallet);

    String     receipient = "0x1234567890123456789012345678901234567890";
    BigInteger value      = BigInteger.valueOf(100000);

    // create a Transaction
    TransactionRequest tx = new TransactionRequest();
    tx.setFrom(account);
    tx.setTo("0x1234567890123456789012345678901234567890");
    tx.setFunction("transfer(address,uint256)");
    tx.setParams(new Object[] {receipient, value});

    String txHash = in3.getEth1API().sendTransaction(tx);

    System.out.println("Transaction sent with hash = " + txHash);
  }
}

Building

In order to run those examples, you only need a Java SDK installed.

./build.sh

will build all examples in this directory.

In order to run a example use

java -cp $IN3/build/lib/in3.jar:. GetBlockAPI

Package in3

class BlockID

fromHash

public static BlockID fromHash(String hash);

arguments:

String hash

fromNumber

public static BlockID fromNumber(long number);

arguments:

long number

getNumber

public Long getNumber();

setNumber

public void setNumber(long block);

arguments:

long block

getHash

public String getHash();

setHash

public void setHash(String hash);

arguments:

String hash

toJSON

public String toJSON();

toString

public String toString();

class Chain

Constants for Chain-specs.

MAINNET

use mainnet

Type: static final long

TOBALABA

use tobalaba testnet

Type: static final long

GOERLI

use goerli testnet

Type: static final long

EWC

use ewf chain

Type: static final long

IPFS

use ipfs

Type: static final long

VOLTA

use volta test net

Type: static final long

LOCAL

use local client

Type: static final long

BTC

use bitcoin client

Type: static final long

class IN3

This is the main class creating the incubed client.

The client can then be configured.

forChain

create a Incubed client using the chain-config.

if chainId is Chain.MULTICHAIN, the client can later be switched between different chains, for all other chains, it will be initialized only with the chainspec for this one chain (safes memory)

public static IN3 forChain(long chainId);

arguments:

long chainId

getVersion

returns the current incubed version.

public static native String getVersion();

main

public static void main(String[] args);

arguments:

String[] args

getConfig

returns the current configuration.

any changes to the configuration will be applied witth the next request.

public ClientConfiguration getConfig();

setSigner

sets the signer or wallet.

public void setSigner(Signer signer);

arguments:

Signer signer

getSigner

returns the signer or wallet.

public Signer getSigner();

getIpfs

gets the ipfs-api

public in3.ipfs.API getIpfs();

getZksync

gets the zksync-api

public in3.zksync.API getZksync();

getBtcAPI

gets the btc-api

public in3.btc.API getBtcAPI();

getEth1API

gets the ethereum-api

public in3.eth1.API getEth1API();

getCrypto

gets the utils/crypto-api

public Crypto getCrypto();

setStorageProvider

provides the ability to cache content like nodelists, contract codes and validatorlists

public void setStorageProvider(StorageProvider val);

arguments:

StorageProvider val

getStorageProvider

provides the ability to cache content

public StorageProvider getStorageProvider();

setTransport

sets The transport interface.

This allows to fetch the result of the incubed in a different way.

public void setTransport(IN3Transport newTransport);

arguments:

IN3Transport newTransport

getTransport

returns the current transport implementation.

public IN3Transport getTransport();

getChainId

servers to filter for the given chain.

The chain-id based on EIP-155.

public native long getChainId();

setChainId

sets the chain to be used.

The chain-id based on EIP-155.

public native void setChainId(long val);

arguments:

long val

send

send a request.

The request must a valid json-string with method and params

public String send(String request);

arguments:

String request

sendobject

send a request but returns a object like array or map with the parsed response.

The request must a valid json-string with method and params

public Object sendobject(String request);

arguments:

String request

sendRPC

send a RPC request by only passing the method and params.

It will create the raw request from it and return the result.

public String sendRPC(String method, Object[] params);

arguments:

String method
Object[] params

sendRPCasObject

public Object sendRPCasObject(String method, Object[] params, boolean useEnsResolver);

arguments:

String method
Object[] params
boolean useEnsResolver

sendRPCasObject

send a RPC request by only passing the method and params.

It will create the raw request from it and return the result.

public Object sendRPCasObject(String method, Object[] params);

arguments:

String method
Object[] params

cacheClear

clears the cache.

public boolean cacheClear();

nodeList

restrieves the node list

public IN3Node[] nodeList();

sign

request for a signature of an already verified hash.

public SignedBlockHash[] sign(BlockID[] blocks, String[] dataNodeAdresses);

arguments:

BlockID[] blocks
String[] dataNodeAdresses

class IN3DefaultTransport

handle

public byte[][] handle(String method, String[] urls, byte[] payload, String[] headers);

arguments:

String method
String[] urls
byte[] payload
String[] headers

class IN3Node

getUrl

public String getUrl();

getAddress

public String getAddress();

getIndex

public int getIndex();

getDeposit

public String getDeposit();

getProps

public long getProps();

getTimeout

public int getTimeout();

getRegisterTime

public int getRegisterTime();

getWeight

public int getWeight();

class IN3Props

IN3Props

public IN3Props();

setDataNodes

public void setDataNodes(String[] adresses);

arguments:

String[] adresses

setSignerNodes

public void setSignerNodes(String[] adresses);

arguments:

String[] adresses

toString

public String toString();

toJSON

public String toJSON();

class Loader

loadLibrary

public static void loadLibrary();

class NodeList

getNodes

returns an array of IN3Node

public IN3Node[] getNodes();

class NodeProps

NODE_PROP_PROOF

Type: static final long

NODE_PROP_MULTICHAIN

Type: static final long

NODE_PROP_ARCHIVE

Type: static final long

NODE_PROP_HTTP

Type: static final long

NODE_PROP_BINARY

Type: static final long

NODE_PROP_ONION

Type: static final long

NODE_PROP_STATS

Type: static final long

class SignedBlockHash

getBlockHash

public String getBlockHash();

getBlock

public long getBlock();

getR

public String getR();

getS

public String getS();

getV

public long getV();

getMsgHash

public String getMsgHash();

enum Proof

The Proof type indicating how much proof is required.

The enum type contains the following values:

none 0 No Verification.
standard 1 Standard Verification of the important properties.
full 2 Full Verification including even uncles wich leads to higher payload.

interface IN3Transport

handle

public byte[][] handle(String method, String[] urls, byte[] payload, String[] headers);

arguments:

String method
String[] urls
byte[] payload
String[] headers

Package in3.btc

class API

API for handling BitCoin data.

Use it when connected to Chain.BTC.

API

creates a btc.API using the given incubed instance.

public API(IN3 in3);

arguments:

IN3 in3

getTransaction

Retrieves the transaction and returns the data as json.

public Transaction getTransaction(String txid);

arguments:

String txid

getTransactionBytes

Retrieves the serialized transaction (bytes).

public byte[] getTransactionBytes(String txid);

arguments:

String txid

getBlockHeader

Retrieves the blockheader.

public BlockHeader getBlockHeader(String blockHash);

arguments:

String blockHash

getBlockHeaderBytes

Retrieves the byte array representing the serialized blockheader data.

public byte[] getBlockHeaderBytes(String blockHash);

arguments:

String blockHash

getBlockWithTxData

Retrieves the block including the full transaction data.

Use Api::GetBlockWithTxIds” for only the transaction ids.

public Block getBlockWithTxData(String blockHash);

arguments:

String blockHash

getBlockWithTxIds

Retrieves the block including only transaction ids.

Use Api::GetBlockWithTxData for the full transaction data.

public Block getBlockWithTxIds(String blockHash);

arguments:

String blockHash

getBlockBytes

Retrieves the serialized block in bytes.

public byte[] getBlockBytes(String blockHash);

arguments:

String blockHash

class Block

A Block.

getTransactions

Transactions or Transaction of a block.

public Transaction[] getTransactions();

getTransactionHashes

Transactions or Transaction ids of a block.

public String[] getTransactionHashes();

getSize

Size of this block in bytes.

public long getSize();

getWeight

Weight of this block in bytes.

public long getWeight();

class BlockHeader

A Block header.

getHash

The hash of the blockheader.

public String getHash();

getConfirmations

Number of confirmations or blocks mined on top of the containing block.

public long getConfirmations();

getHeight

Block number.

public long getHeight();

getVersion

Used version.

public long getVersion();

getVersionHex

Version as hex.

public String getVersionHex();

getMerkleroot

Merkle root of the trie of all transactions in the block.

public String getMerkleroot();

getTime

Unix timestamp in seconds since 1970.

public long getTime();

getMediantime

Unix timestamp in seconds since 1970.

public long getMediantime();

getNonce

Nonce-field of the block.

public long getNonce();

getBits

Bits (target) for the block as hex.

public String getBits();

getDifficulty

Difficulty of the block.

public float getDifficulty();

getChainwork

Total amount of work since genesis.

public String getChainwork();

getNTx

Number of transactions in the block.

public long getNTx();

getPreviousblockhash

Hash of the parent blockheader.

public String getPreviousblockhash();

getNextblockhash

Hash of the next blockheader.

public String getNextblockhash();

class ScriptPubKey

Script on a transaction output.

getAsm

The hash of the blockheader.

public String getAsm();

getHex

The raw hex data.

public String getHex();

getReqSigs

The required sigs.

public long getReqSigs();

getType

The type e.g.

: pubkeyhash.

public String getType();

getAddresses

List of addresses.

public String[] getAddresses();

class ScriptSig

Script on a transaction input.

ScriptSig

public ScriptSig(JSON data);

arguments:

JSON data

getAsm

The asm data.

public String getAsm();

getHex

The raw hex data.

public String getHex();

class Transaction

A BitCoin Transaction.

asTransaction

public static Transaction asTransaction(Object o);

arguments:

Object o

asTransactions

public static Transaction[] asTransactions(Object o);

arguments:

Object o

getTxid

Transaction Id.

public String getTxid();

getHash

The transaction hash (differs from txid for witness transactions).

public String getHash();

getVersion

The version.

public long getVersion();

getSize

The serialized transaction size.

public long getSize();

getVsize

The virtual transaction size (differs from size for witness transactions).

public long getVsize();

getWeight

The transactions weight (between vsize4-3 and vsize4).

public long getWeight();

getLocktime

The locktime.

public long getLocktime();

getHex

The hex representation of raw data.

public String getHex();

getBlockhash

The block hash of the block containing this transaction.

public String getBlockhash();

getConfirmations

The confirmations.

public long getConfirmations();

getTime

The transaction time in seconds since epoch (Jan 1 1970 GMT).

public long getTime();

getBlocktime

The block time in seconds since epoch (Jan 1 1970 GMT).

public long getBlocktime();

getVin

The transaction inputs.

public TransactionInput[] getVin();

getVout

The transaction outputs.

public TransactionOutput[] getVout();

class TransactionInput

Input of a transaction.

getTxid

The transaction id.

public String getTxid();

getYout

The index of the transactionoutput.

public long getYout();

getScriptSig

The script.

public ScriptSig getScriptSig();

getTxinwitness

Hex-encoded witness data (if any).

public String[] getTxinwitness();

getSequence

The script sequence number.

public long getSequence();

class TransactionOutput

A BitCoin Transaction.

TransactionOutput

public TransactionOutput(JSON data);

arguments:

JSON data

getValue

The value in bitcoins.

public float getValue();

getN

The index in the transaction.

public long getN();

getScriptPubKey

The script of the transaction.

public ScriptPubKey getScriptPubKey();

Package in3.config

class ClientConfiguration

Configuration Object for Incubed Client.

It holds the state for the root of the configuration tree. Should be retrieved from the client instance as IN3::getConfig()

ClientConfiguration

public ClientConfiguration(Object json);

arguments:

Object json

getRequestCount

public Integer getRequestCount();

setRequestCount

sets the number of requests send when getting a first answer

public void setRequestCount(Integer requestCount);

arguments:

Integer requestCount

isAutoUpdateList

public Boolean isAutoUpdateList();

setAutoUpdateList

activates the auto update.if true the nodelist will be automatically updated if the lastBlock is newer

public void setAutoUpdateList(boolean autoUpdateList);

arguments:

boolean autoUpdateList

getProof

public Proof getProof();

setProof

sets the type of proof used

public void setProof(Proof proof);

arguments:

Proof proof

getMaxAttempts

public Integer getMaxAttempts();

setMaxAttempts

sets the max number of attempts before giving up

public void setMaxAttempts(int maxAttempts);

arguments:

int maxAttempts

getSignatureCount

public Integer getSignatureCount();

setSignatureCount

sets the number of signatures used to proof the blockhash.

public void setSignatureCount(int signatureCount);

arguments:

int signatureCount

getFinality

public Integer getFinality();

setFinality

sets the number of signatures in percent required for the request

public void setFinality(int finality);

arguments:

int finality

isIncludeCode

public Boolean isIncludeCode();

setIncludeCode

public void setIncludeCode(boolean includeCode);

arguments:

boolean includeCode

isBootWeights

public Boolean isBootWeights();

setBootWeights

if true, the first request (updating the nodelist) will also fetch the current health status and use it for blacklisting unhealthy nodes.

This is used only if no nodelist is available from cache.

public void setBootWeights(boolean bootWeights);

arguments:

boolean bootWeights

isKeepIn3

public Boolean isKeepIn3();

setKeepIn3

public void setKeepIn3(boolean keepIn3);

arguments:

boolean keepIn3

isUseHttp

public Boolean isUseHttp();

setUseHttp

public void setUseHttp(boolean useHttp);

arguments:

boolean useHttp

isExperimental

public Boolean isExperimental();

setExperimental

public void setExperimental(boolean val);

arguments:

boolean val

getTimeout

public Long getTimeout();

setTimeout

specifies the number of milliseconds before the request times out.

increasing may be helpful if the device uses a slow connection.

public void setTimeout(long timeout);

arguments:

long timeout

getMinDeposit

public Long getMinDeposit();

setMinDeposit

sets min stake of the server.

Only nodes owning at least this amount will be chosen.

public void setMinDeposit(long minDeposit);

arguments:

long minDeposit

getNodeProps

public Long getNodeProps();

setNodeProps

public void setNodeProps(long nodeProps);

arguments:

long nodeProps

getNodeLimit

public Long getNodeLimit();

setNodeLimit

sets the limit of nodes to store in the client.

public void setNodeLimit(long nodeLimit);

arguments:

long nodeLimit

getNodeRegistry

public NodeRegistryConfiguration getNodeRegistry();

getReplaceLatestBlock

public Integer getReplaceLatestBlock();

setReplaceLatestBlock

replaces the latest with blockNumber- specified value

public void setReplaceLatestBlock(int replaceLatestBlock);

arguments:

int replaceLatestBlock

getRpc

public String getRpc();

setRpc

setup an custom rpc source for requests by setting Chain to local and proof to none

public void setRpc(String rpc);

arguments:

String rpc

isSynced

public boolean isSynced();

markAsSynced

public void markAsSynced();

toString

public String toString();

toJSON

generates a json-string based on the internal data.

public String toJSON();

class NodeConfiguration

Configuration Object for Incubed Client.

It represents the node of a nodelist.

NodeConfiguration

public NodeConfiguration(NodeRegistryConfiguration parent);

arguments:

NodeRegistryConfiguration parent

getUrl

public String getUrl();

setUrl

public void setUrl(String url);

arguments:

String url

getProps

public long getProps();

setProps

public void setProps(long props);

arguments:

long props

getAddress

public String getAddress();

setAddress

public void setAddress(String address);

arguments:

String address

toString

public String toString();

toJSON

generates a json-string based on the internal data.

public String toJSON();

markAsSynced

public void markAsSynced();

isSynced

public boolean isSynced();

class NodeRegistryConfiguration

Part of the configuration hierarchy for IN3 Client.

Holds the configuration a node group in a particular Chain.

isNeedsUpdate

public Boolean isNeedsUpdate();

setNeedsUpdate

public void setNeedsUpdate(boolean needsUpdate);

arguments:

boolean needsUpdate

getContract

public String getContract();

setContract

public void setContract(String contract);

arguments:

String contract

getRegistryId

public String getRegistryId();

setRegistryId

public void setRegistryId(String registryId);

arguments:

String registryId

getWhiteListContract

public String getWhiteListContract();

setWhiteListContract

public void setWhiteListContract(String whiteListContract);

arguments:

String whiteListContract

getWhiteList

public String[] getWhiteList();

setWhiteList

public void setWhiteList(String[] whiteList);

arguments:

String[] whiteList

toJSON

generates a json-string based on the internal data.

public String toJSON();

isSynced

public boolean isSynced();

markAsSynced

public void markAsSynced();

getNodesConfiguration

public NodeConfiguration[] getNodesConfiguration();

toString

public String toString();

interface Configuration

an Interface class, which is able to generate a JSON-String.

toJSON

generates a json-string based on the internal data.

public String toJSON();

markAsSynced

public void markAsSynced();

isSynced

public boolean isSynced();

Package in3.eth1

class API

a Wrapper for the incubed client offering Type-safe Access and additional helper functions.

API

creates an eth1.API using the given incubed instance.

public API(IN3 in3);

arguments:

IN3 in3

getBlockByNumber

finds the Block as specified by the number.

use Block.LATEST for getting the lastest block.

public Block getBlockByNumber(long block, boolean includeTransactions);

arguments:

long block  
boolean includeTransactions < the Blocknumber < if true all Transactions will be includes, if not only the transactionhashes

getBlockByHash

Returns information about a block by hash.

public Block getBlockByHash(String blockHash, boolean includeTransactions);

arguments:

String blockHash  
boolean includeTransactions < the Blocknumber < if true all Transactions will be includes, if not only the transactionhashes

getBlockNumber

the current BlockNumber.

public long getBlockNumber();

getGasPrice

the current Gas Price.

public long getGasPrice();

getChainId

Returns the EIP155 chain ID used for transaction signing at the current best block.

Null is returned if not available.

public String getChainId();

call

calls a function of a smart contract and returns the result.

public Object call(TransactionRequest request, long block);

arguments:

TransactionRequest request  
long block < the transaction to call. < the Block used to for the state.

returns: Object : the decoded result. if only one return value is expected the Object will be returned, if not an array of objects will be the result.

estimateGas

Makes a call or transaction, which won’t be added to the blockchain and returns the used gas, which can be used for estimating the used gas.

public long estimateGas(TransactionRequest request, long block);

arguments:

TransactionRequest request  
long block < the transaction to call. < the Block used to for the state.

returns: long : the gas required to call the function.

getBalance

Returns the balance of the account of given address in wei.

public BigInteger getBalance(String address, long block);

arguments:

String address
long block

getCode

Returns code at a given address.

public String getCode(String address, long block);

arguments:

String address
long block

getStorageAt

Returns the value from a storage position at a given address.

public String getStorageAt(String address, BigInteger position, long block);

arguments:

String address
BigInteger position
long block

getBlockTransactionCountByHash

Returns the number of transactions in a block from a block matching the given block hash.

public long getBlockTransactionCountByHash(String blockHash);

arguments:

String blockHash

getBlockTransactionCountByNumber

Returns the number of transactions in a block from a block matching the given block number.

public long getBlockTransactionCountByNumber(long block);

arguments:

long block

getFilterChangesFromLogs

Polling method for a filter, which returns an array of logs which occurred since last poll.

public Log[] getFilterChangesFromLogs(long id);

arguments:

long id

getFilterChangesFromBlocks

Polling method for a filter, which returns an array of logs which occurred since last poll.

public String[] getFilterChangesFromBlocks(long id);

arguments:

long id

getFilterLogs

Polling method for a filter, which returns an array of logs which occurred since last poll.

public Log[] getFilterLogs(long id);

arguments:

long id

getLogs

Polling method for a filter, which returns an array of logs which occurred since last poll.

public Log[] getLogs(LogFilter filter);

arguments:

LogFilter filter

getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position.

public Transaction getTransactionByBlockHashAndIndex(String blockHash, int index);

arguments:

String blockHash
int index

getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

public Transaction getTransactionByBlockNumberAndIndex(long block, int index);

arguments:

long block
int index

getTransactionByHash

Returns the information about a transaction requested by transaction hash.

public Transaction getTransactionByHash(String transactionHash);

arguments:

String transactionHash

getTransactionCount

Returns the number of transactions sent from an address.

public BigInteger getTransactionCount(String address, long block);

arguments:

String address
long block

getTransactionReceipt

Returns the number of transactions sent from an address.

public TransactionReceipt getTransactionReceipt(String transactionHash);

arguments:

String transactionHash

getUncleByBlockNumberAndIndex

Returns information about a uncle of a block number and uncle index position.

Note: An uncle doesn’t contain individual transactions.

public Block getUncleByBlockNumberAndIndex(long block, int pos);

arguments:

long block
int pos

getUncleCountByBlockHash

Returns the number of uncles in a block from a block matching the given block hash.

public long getUncleCountByBlockHash(String block);

arguments:

String block

getUncleCountByBlockNumber

Returns the number of uncles in a block from a block matching the given block hash.

public long getUncleCountByBlockNumber(long block);

arguments:

long block

newBlockFilter

Creates a filter in the node, to notify when a new block arrives.

To check if the state has changed, call eth_getFilterChanges.

public long newBlockFilter();

newLogFilter

Creates a filter object, based on filter options, to notify when the state changes (logs).

To check if the state has changed, call eth_getFilterChanges.

A note on specifying topic filters: Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters:

[] “anything” [A] “A in first position (and anything after)” [null, B] “anything in first position AND B in second position (and anything after)” [A, B] “A in first position AND B in second position (and anything after)” [[A, B], [A, B]] “(A OR B) in first position AND (A OR B) in second position (and anything after)”

public long newLogFilter(LogFilter filter);

arguments:

LogFilter filter

uninstallFilter

uninstall filter.

public boolean uninstallFilter(long filter);

arguments:

long filter

sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions.

public String sendRawTransaction(String data);

arguments:

String data

returns: String : transactionHash

abiEncode

encodes the arguments as described in the method signature using ABI-Encoding.

public String abiEncode(String signature, String[] params);

arguments:

String signature
String[] params

abiDecode

decodes the data based on the signature.

public String[] abiDecode(String signature, String encoded);

arguments:

String signature
String encoded

checksumAddress

converts the given address to a checksum address.

public String checksumAddress(String address);

arguments:

String address

checksumAddress

converts the given address to a checksum address.

Second parameter includes the chainId.

public String checksumAddress(String address, Boolean useChainId);

arguments:

String address
Boolean useChainId

ens

resolve ens-name.

public String ens(String name);

arguments:

String name

ens

resolve ens-name.

Second parameter especifies if it is an address, owner, resolver or hash.

public String ens(String name, ENSMethod type);

arguments:

String name
ENSMethod type

sendTransaction

sends a Transaction as described by the TransactionRequest.

This will require a signer to be set in order to sign the transaction.

public String sendTransaction(TransactionRequest tx);

arguments:

TransactionRequest tx

call

the current Gas Price.

public Object call(String to, String function, Object... params);

arguments:

String to
String function
Object... params

returns: Object : the decoded result. if only one return value is expected the Object will be returned, if not an array of objects will be the result.

class Block

represents a Block in ethereum.

LATEST

The latest Block Number.

Type: static long

EARLIEST

The Genesis Block.

Type: static long

getTotalDifficulty

returns the total Difficulty as a sum of all difficulties starting from genesis.

public BigInteger getTotalDifficulty();

getGasLimit

the gas limit of the block.

public BigInteger getGasLimit();

getExtraData

the extra data of the block.

public String getExtraData();

getDifficulty

the difficulty of the block.

public BigInteger getDifficulty();

getAuthor

the author or miner of the block.

public String getAuthor();

getTransactionsRoot

the roothash of the merkletree containing all transaction of the block.

public String getTransactionsRoot();

getTransactionReceiptsRoot

the roothash of the merkletree containing all transaction receipts of the block.

public String getTransactionReceiptsRoot();

getStateRoot

the roothash of the merkletree containing the complete state.

public String getStateRoot();

getTransactionHashes

the transaction hashes of the transactions in the block.

public String[] getTransactionHashes();

getTransactions

the transactions of the block.

public Transaction[] getTransactions();

getTimeStamp

the unix timestamp in seconds since 1970.

public long getTimeStamp();

getSha3Uncles

the roothash of the merkletree containing all uncles of the block.

public String getSha3Uncles();

getSize

the size of the block.

public long getSize();

getSealFields

the seal fields used for proof of authority.

public String[] getSealFields();

getHash

the block hash of the of the header.

public String getHash();

getLogsBloom

the bloom filter of the block.

public String getLogsBloom();

getMixHash

the mix hash of the block.

(only valid of proof of work)

public String getMixHash();

getNonce

the mix hash of the block.

(only valid of proof of work)

public String getNonce();

getNumber

the block number

public long getNumber();

getParentHash

the hash of the parent-block.

public String getParentHash();

getUncles

returns the blockhashes of all uncles-blocks.

public String[] getUncles();

hashCode

public int hashCode();

equals

public boolean equals(Object obj);

arguments:

Object obj

class Log

a log entry of a transaction receipt.

isRemoved

true when the log was removed, due to a chain reorganization.

false if its a valid log.

public boolean isRemoved();

getLogIndex

integer of the log index position in the block.

null when its pending log.

public int getLogIndex();

gettTansactionIndex

integer of the transactions index position log was created from.

null when its pending log.

public int gettTansactionIndex();

getTransactionHash

Hash, 32 Bytes - hash of the transactions this log was created from.

null when its pending log.

public String getTransactionHash();

getBlockHash

Hash, 32 Bytes - hash of the block where this log was in.

null when its pending. null when its pending log.

public String getBlockHash();

getBlockNumber

the block number where this log was in.

null when its pending. null when its pending log.

public long getBlockNumber();

getAddress

20 Bytes - address from which this log originated.

public String getAddress();

getTopics

Array of 0 to 4 32 Bytes DATA of indexed log arguments.

(In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)

public String[] getTopics();

class LogFilter

Log configuration for search logs.

getFromBlock

public long getFromBlock();

setFromBlock

public void setFromBlock(long fromBlock);

arguments:

long fromBlock

getToBlock

public long getToBlock();

setToBlock

public void setToBlock(long toBlock);

arguments:

long toBlock

getAddress

public String getAddress();

setAddress

public void setAddress(String address);

arguments:

String address

getTopics

public Object[] getTopics();

setTopics

public void setTopics(Object[] topics);

arguments:

Object[] topics

getLimit

public int getLimit();

setLimit

public void setLimit(int limit);

arguments:

int limit

toString

creates a JSON-String.

public String toString();

class SimpleWallet

a simple Implementation for holding private keys to sing data or transactions.

addRawKey

adds a key to the wallet and returns its public address.

public String addRawKey(String data);

arguments:

String data

addKeyStore

adds a key to the wallet and returns its public address.

public String addKeyStore(String jsonData, String passphrase);

arguments:

String jsonData
String passphrase

prepareTransaction

optiional method which allows to change the transaction-data before sending it.

This can be used for redirecting it through a multisig.

public TransactionRequest prepareTransaction(IN3 in3, TransactionRequest tx);

arguments:

IN3 in3
TransactionRequest tx

canSign

returns true if the account is supported (or unlocked)

public boolean canSign(String address);

arguments:

String address

sign

signing of the raw data.

public String sign(String data, String address);

arguments:

String data
String address

class Transaction

represents a Transaction in ethereum.

asTransaction

public static Transaction asTransaction(Object o);

arguments:

Object o

getBlockHash

the blockhash of the block containing this transaction.

public String getBlockHash();

getBlockNumber

the block number of the block containing this transaction.

public long getBlockNumber();

getChainId

the chainId of this transaction.

public String getChainId();

getCreatedContractAddress

the address of the deployed contract (if successfull)

public String getCreatedContractAddress();

getFrom

the address of the sender.

public String getFrom();

getHash

the Transaction hash.

public String getHash();

getData

the Transaction data or input data.

public String getData();

getNonce

the nonce used in the transaction.

public long getNonce();

getPublicKey

the public key of the sender.

public String getPublicKey();

getValue

the value send in wei.

public BigInteger getValue();

getRaw

the raw transaction as rlp encoded data.

public String getRaw();

getTo

the address of the receipient or contract.

public String getTo();

getSignature

the signature of the sender - a array of the [ r, s, v]

public String[] getSignature();

getGasPrice

the gas price provided by the sender.

public long getGasPrice();

getGas

the gas provided by the sender.

public long getGas();

class TransactionReceipt

represents a Transaction receipt in ethereum.

getBlockHash

the blockhash of the block containing this transaction.

public String getBlockHash();

getBlockNumber

the block number of the block containing this transaction.

public long getBlockNumber();

getCreatedContractAddress

the address of the deployed contract (if successfull)

public String getCreatedContractAddress();

getFrom

the address of the sender.

public String getFrom();

getTransactionHash

the Transaction hash.

public String getTransactionHash();

getTransactionIndex

the Transaction index.

public int getTransactionIndex();

getTo

20 Bytes - The address of the receiver.

null when it’s a contract creation transaction.

public String getTo();

getGasUsed

The amount of gas used by this specific transaction alone.

public long getGasUsed();

getLogs

Array of log objects, which this transaction generated.

public Log[] getLogs();

getLogsBloom

256 Bytes - A bloom filter of logs/events generated by contracts during transaction execution.

Used to efficiently rule out transactions without expected logs

public String getLogsBloom();

getRoot

32 Bytes - Merkle root of the state trie after the transaction has been executed (optional after Byzantium hard fork EIP609).

public String getRoot();

getStatus

success of a Transaction.

true indicates transaction failure , false indicates transaction success. Set for blocks mined after Byzantium hard fork EIP609, null before.

public boolean getStatus();

class TransactionRequest

represents a Transaction Request which should be send or called.

getFrom

public String getFrom();

setFrom

public void setFrom(String from);

arguments:

String from

getTo

public String getTo();

setTo

public void setTo(String to);

arguments:

String to

getValue

public BigInteger getValue();

setValue

public void setValue(BigInteger value);

arguments:

BigInteger value

getNonce

public long getNonce();

setNonce

public void setNonce(long nonce);

arguments:

long nonce

getGas

public long getGas();

setGas

public void setGas(long gas);

arguments:

long gas

getGasPrice

public long getGasPrice();

setGasPrice

public void setGasPrice(long gasPrice);

arguments:

long gasPrice

getFunction

public String getFunction();

setFunction

public void setFunction(String function);

arguments:

String function

getParams

public Object[] getParams();

setParams

public void setParams(Object[] params);

arguments:

Object[] params

setData

public void setData(String data);

arguments:

String data

getData

creates the data based on the function/params values.

public String getData();

getTransactionJson

public String getTransactionJson();

getResult

public Object getResult(String data);

arguments:

String data

enum ENSMethod

The enum type contains the following values:

addr 0
resolver 1
hash 2
owner 3

Package in3.ipfs

class API

API for ipfs custom methods.

To be used along with “Chain.IPFS” on in3 instance.

API

creates a ipfs.API using the given incubed instance.

public API(IN3 in3);

arguments:

IN3 in3

get

Returns the content associated with specified multihash on success OR NULL on error.

public byte[] get(String multihash);

arguments:

String multihash

put

Returns the IPFS multihash of stored content on success OR NULL on error.

public String put(String content);

arguments:

String content

put

Returns the IPFS multihash of stored content on success OR NULL on error.

public String put(byte[] content);

arguments:

byte[] content

Package in3.ipfs.API

enum Encoding

The enum type contains the following values:

base64 0
hex 1
utf8 2

Package in3.utils

class Account

Pojo that represents the result of an ecrecover operation (see: Crypto class).

getAddress

address from ecrecover operation.

public String getAddress();

getPublicKey

public key from ecrecover operation.

public String getPublicKey();

class Crypto

a Wrapper for crypto-related helper functions.

Crypto

public Crypto(IN3 in3);

arguments:

IN3 in3

signData

returns a signature given a message and a key.

public Signature signData(String msg, String key, SignatureType sigType);

arguments:

String msg
String key
SignatureType sigType

decryptKey

public String decryptKey(String key, String passphrase);

arguments:

String key
String passphrase

pk2address

extracts the public address from a private key.

public String pk2address(String key);

arguments:

String key

pk2public

extracts the public key from a private key.

public String pk2public(String key);

arguments:

String key

ecrecover

extracts the address and public key from a signature.

public Account ecrecover(String msg, String sig);

arguments:

String msg
String sig

ecrecover

extracts the address and public key from a signature.

public Account ecrecover(String msg, String sig, SignatureType sigType);

arguments:

String msg
String sig
SignatureType sigType

signData

returns a signature given a message and a key.

public Signature signData(String msg, String key);

arguments:

String msg
String key

class JSON

internal helper tool to represent a JSON-Object.

Since the internal representation of JSON in incubed uses hashes instead of name, the getter will creates these hashes.

get

gets the property

public Object get(String prop);

arguments:

String prop the name of the property.

returns: Object : the raw object.

put

adds values.

This function will be called from the JNI-Iterface.

Internal use only!

public void put(String key, Object val);

arguments:

String key the key
Object val the value object

put

adds values.

This function will be called from the JNI-Iterface.

Internal use only!

public void put(int key, Object val);

arguments:

int key the hash of the key
Object val the value object

getBoolean

returns the property as boolean

public boolean getBoolean(String key);

arguments:

String key the propertyName

returns: boolean : the boolean value

getLong

returns the property as long

public long getLong(String key);

arguments:

String key the propertyName

returns: long : the long value

getObject

returns the property as BigInteger

public Object getObject(String key);

arguments:

String key the propertyName

returns: Object : the BigInteger value

getInteger

returns the property as BigInteger

public Integer getInteger(String key);

arguments:

String key the propertyName

returns: Integer : the BigInteger value

getBigInteger

returns the property as BigInteger

public BigInteger getBigInteger(String key);

arguments:

String key the propertyName

returns: BigInteger : the BigInteger value

getStringArray

returns the property as StringArray

public String[] getStringArray(String key);

arguments:

String key the propertyName

returns: String[] : the array or null

getString

returns the property as String or in case of a number as hexstring.

public String getString(String key);

arguments:

String key the propertyName

returns: String : the hexstring

toString

public String toString();

hashCode

public int hashCode();

equals

public boolean equals(Object obj);

arguments:

Object obj

asStringArray

casts the object to a String[]

public static String[] asStringArray(Object o);

arguments:

Object o

asBigInteger

public static BigInteger asBigInteger(Object o);

arguments:

Object o

asLong

public static long asLong(Object o);

arguments:

Object o

asInt

public static int asInt(Object o);

arguments:

Object o

asBoolean

public static boolean asBoolean(Object o);

arguments:

Object o

asString

public static String asString(Object o);

arguments:

Object o

toJson

public static String toJson(Object ob);

arguments:

Object ob

appendKey

public static void appendKey(StringBuilder sb, String key, Object value);

arguments:

StringBuilder sb
String key
Object value

class Signature

getMessage

public String getMessage();

getMessageHash

public String getMessageHash();

getSignature

public String getSignature();

getR

public String getR();

getS

public String getS();

getV

public long getV();

class TempStorageProvider

a simple Storage Provider storing the cache in the temp-folder.

getItem

returns a item from cache ()

public synchronized byte[] getItem(String key);

arguments:

String key the key for the item

returns: synchronized byte[] : the bytes or null if not found.

setItem

stores a item in the cache.

public synchronized void setItem(String key, byte[] content);

arguments:

String key the key for the item
byte[] content the value to store

clear

clear the cache.

public boolean clear();

class TransportException

Exception to be thrown in case of failed request.

TransportException

constrcutor

public TransportException(String message, int status, int index);

arguments:

String message
int status
int index

getIndex

public int getIndex();

getStatus

the http-status

public int getStatus();

returns: int :

enum SignatureType

The enum type contains the following values:

eth_sign 0
raw 1
hash 2

interface Signer

a Interface responsible for signing data or transactions.

prepareTransaction

optiional method which allows to change the transaction-data before sending it.

This can be used for redirecting it through a multisig.

public TransactionRequest prepareTransaction(IN3 in3, TransactionRequest tx);

arguments:

IN3 in3
TransactionRequest tx

canSign

returns true if the account is supported (or unlocked)

public boolean canSign(String address);

arguments:

String address

sign

signing of the raw data.

public String sign(String data, String address);

arguments:

String data
String address

interface StorageProvider

Provider methods to cache data.

These data could be nodelists, contract codes or validator changes.

getItem

returns a item from cache ()

public byte[] getItem(String key);

arguments:

String key the key for the item

returns: byte[] : the bytes or null if not found.

setItem

stores a item in the cache.

public void setItem(String key, byte[] content);

arguments:

String key the key for the item
byte[] content the value to store

clear

clear the cache.

public boolean clear();

Package in3.zksync

class API

API for handling ZKSYNC transactions.

API

creates a zksync.API using the given incubed instance.

public API(IN3 in3);

arguments:

IN3 in3

getContractAddress

the address of the zksync contract.

public String getContractAddress();

getTokens

the available tokens.

public Token[] getTokens();

getAccountInfo

returns the current balance, nonce and key for the given account.

if address is null, the current configured Account will be used.

public Account getAccountInfo(String address);

arguments:

String address

getTransactionInfo

the Transaction State.

public Tx getTransactionInfo(String txid);

arguments:

String txid

getEthOpInfo

the EthOp State.

(State of a deposit or emergencyWithdraw - Transaction )

public EthOp getEthOpInfo(String txid);

arguments:

String txid

setKey

sets the sync keys and returns the confirmed pubkeyhash

public String setKey(String token);

arguments:

String token

getPubKeyHash

returns the pubkeyhash based on the current config.

public String getPubKeyHash();

getPubKey

returns the public key based on the current config.

public String getPubKey();

getSyncKey

returns the private key based on the current config.

public String getSyncKey();

getAccountAddress

returns the address of the account based on the current config.

public String getAccountAddress();

sign

signs the data and returns a musig schnorr signature.

public String sign(byte[] message);

arguments:

byte[] message

verify

signs the data and returns a musig schnorr signature.

public boolean verify(byte[] message, String signature);

arguments:

byte[] message
String signature

getTxFee

calculates the current tx fees for the specified

public TxFee getTxFee(String txType, String toAddress, String token);

arguments:

String txType
String toAddress
String token

deposit

sends the specified amount of tokens to the zksync contract as deposit for the specified amount (or null if this the same as send) returns the ethopId

public String deposit(BigInteger amount, String token, boolean approveDepositAmountForERC20, String account);

arguments:

BigInteger amount
String token
boolean approveDepositAmountForERC20
String account

transfer

transfers the specified amount of tokens in L2 returns the txid

public String transfer(String toAddress, BigInteger amount, String token, String fromAccount);

arguments:

String toAddress
BigInteger amount
String token
String fromAccount

withdraw

withdraw the specified amount of tokens to L1 returns the txid

public String withdraw(String toAddress, BigInteger amount, String token, String fromAccount);

arguments:

String toAddress
BigInteger amount
String token
String fromAccount

emergencyWithdraw

withdraw all tokens from L2 to L1.

returns the txId

public String emergencyWithdraw(String token);

arguments:

String token

aggregatePubkey

aggregate the pubKey to one pubKeys for signing together as musig Schnorr signatures.

public String aggregatePubkey(String[] pubKeys);

arguments:

String[] pubKeys

class Account

A ZKSync Account.

asAccount

public static Account asAccount(Object o);

arguments:

Object o

asAccounts

public static Account[] asAccounts(Object o);

arguments:

Object o

getAddress

The address of the Account.

public String getAddress();

getId

id or null if it is not assigned yet.

public Integer getId();

getCommited

the commited state

public AccountState getCommited();

getDepositing

the pending depositing state

public AccountState getDepositing();

getVerified

the verified state

public AccountState getVerified();

class AccountState

A ZKSync AccountState.

asAccountState

public static AccountState asAccountState(Object o);

arguments:

Object o

getNonce

The nonce or TransactionCount.

public Integer getNonce();

getPubKeyHash

the assigned pubkeyhash.

public String getPubKeyHash();

getBalance

the balance of the specified token (or null)

public BigInteger getBalance(String token);

arguments:

String token

class EthOp

A ZKSync EthOperation.

asEthOp

public static EthOp asEthOp(Object o);

arguments:

Object o

isExecuted

returns true, if the operation was executed

public boolean isExecuted();

getBlockNumber

returns the BlockNumber or null if it was not executed.

public Long getBlockNumber();

isCommitted

returns true if the operation is commited in L2

public boolean isCommitted();

isVerified

returns true if the operation is verified in L1

public boolean isVerified();

class Token

A ZKSync Token.

asToken

public static Token asToken(Object o);

arguments:

Object o

asTokens

public static Token[] asTokens(Object o);

arguments:

Object o

getAddress

The token-address if the String.

public String getAddress();

getDecimals

The decimals or number of digits after the comma.

public int getDecimals();

getId

id

public int getId();

getSize

The Symbol.

public String getSize();

class Tx

A ZKSync Tx.

asTx

public static Tx asTx(Object o);

arguments:

Object o

getBlock

The Block-number or null.

public Long getBlock();

isExecuted

true if the tx was executed.

public boolean isExecuted();

getId

the reason in case the tx failed.

public String getId();

isSuccess

if the transaction was executed, this will indicate the success.

(or null)

public Boolean isSuccess();

class TxFee

A ZKSync TxFee.

asTxFee

public static TxFee asTxFee(Object o);

arguments:

Object o

getFeeType

the type of fee.

public String getFeeType();

getGasFee

The fee paid for gas costs.

public long getGasFee();

getGasPriceWei

The gas Price in Wei.

public long getGasPriceWei();

getGasTxAmount

The fee for the amount.

public long getGasTxAmount();

getTotalFee

The total amoiunt of fee to be paid for the tx.

public long getTotalFee();

getZkpFee

The zkp fee.

public long getZkpFee();