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 falseThe 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.
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 .. && makeYou will find the in3.jar in the build/lib - folder.
In order to use Incubed in android simply follow these steps:
Step 1: Create a top-level CMakeLists.txt in android project inside app folder and link this to gradle. Follow the steps using this guide on howto link.
The Content of the CMakeLists.txt should look like this:
cmake_minimum_required(VERSION 3.4.1)
# turn off FAST_MATH in the evm.
ADD_DEFINITIONS(-DIN3_MATH_LITE)
# loop through the required module and cretae the build-folders
foreach(module
c/src/core
c/src/verifier/eth1/nano
c/src/verifier/eth1/evm
c/src/verifier/eth1/basic
c/src/verifier/eth1/full
java/src
c/src/third-party/crypto
c/src/third-party/tommath
c/src/api/eth1)
file(MAKE_DIRECTORY in3-c/${module}/outputs)
add_subdirectory( in3-c/${module} in3-c/${module}/outputs )
endforeach()Step 2: clone in3-c into the app-folder or use this script to clone and update in3:
#!/usr/bin/env sh
#github-url for in3-c
IN3_SRC=https://github.com/slockit/in3-c.git
cd app
# if it exists we only call git pull
if [ -d in3-c ]; then
cd in3-c
git pull
cd ..
else
# if not we clone it
git clone $IN3_SRC
fi
# copy the java-sources to the main java path
cp -r in3-c/java/src/in3 src/main/java/Step 3: Use methods available in app/src/main/java/in3/IN3.java from android activity to access IN3 functions.
Here is example how to use it:
https://github.com/slockit/in3-example-android
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]);
}
}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
ChainConfiguration chainConfiguration = new ChainConfiguration(Chain.GOERLI, clientConfig);
chainConfiguration.setNeedsUpdate(false);
chainConfiguration.setContract("0xac1b824795e1eb1f6e609fe0da9b9af8beaab60f");
chainConfiguration.setRegistryId("0x23d5345c5c13180a8080bd5ddbe7cde64683755dcce6e734d95b7b573845facb");
in3.setConfig(clientConfig);
Block block = in3.getEth1API().getBlockByNumber(Block.LATEST, true);
System.out.println(block.getHash());
}
}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"});
}
}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");
}
}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);
}
}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});
}
}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});
}
}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);
}
}In order to run those examples, you only need a Java SDK installed.
./build.shwill build all examples in this directory.
In order to run a example use
java -cp $IN3/build/lib/in3.jar:. GetBlockAPIarguments:
========== ==========
``String`` **hash**
========== ==========
arguments:
======== ============
``long`` **number**
======== ============
public
LonggetNumber();
public
voidsetNumber(longblock);
arguments:
======== ===========
``long`` **block**
======== ===========
public
StringgetHash();
public
voidsetHash(Stringhash);
arguments:
========== ==========
``String`` **hash**
========== ==========
public
StringtoJSON();
public
StringtoString();
Constants for Chain-specs.
support for multiple chains, a client can then switch between different chains (but consumes more memory)
Type: static final long
use mainnet
Type: static final long
use kovan testnet
Type: static final long
use tobalaba testnet
Type: static final long
use goerli testnet
Type: static final long
use ewf chain
Type: static final long
use evan testnet
Type: static final long
use ipfs
Type: static final long
use volta test net
Type: static final long
use local client
Type: static final long
use bitcoin client
Type: static final long
This is the main class creating the incubed client.
The client can then be configured.
public IN3();
returns the current configuration.
any changes to the configuration will be applied witth the next request.
public
ClientConfigurationgetConfig();
sets the signer or wallet.
public
voidsetSigner(Signersigner);
arguments:
========================= ============
`Signer <#class-signer>`_ **signer**
========================= ============
returns the signer or wallet.
public
SignergetSigner();
gets the ipfs-api
public
in3.ipfs.APIgetIpfs();
gets the btc-api
public
in3.btc.APIgetBtcAPI();
gets the ethereum-api
public
in3.eth1.APIgetEth1API();
gets the utils/crypto-api
public
CryptogetCrypto();
provides the ability to cache content like nodelists, contract codes and validatorlists
public
voidsetStorageProvider(StorageProviderval);
arguments:
=========================================== =========
`StorageProvider <#class-storageprovider>`_ **val**
=========================================== =========
provides the ability to cache content
public
StorageProvidergetStorageProvider();
sets The transport interface.
This allows to fetch the result of the incubed in a different way.
public
voidsetTransport(IN3TransportnewTransport);
arguments:
================ ==================
``IN3Transport`` **newTransport**
================ ==================
returns the current transport implementation.
public
IN3TransportgetTransport();
servers to filter for the given chain.
The chain-id based on EIP-155.
public
native longgetChainId();
sets the chain to be used.
The chain-id based on EIP-155.
public
native voidsetChainId(longval);
arguments:
======== =========
``long`` **val**
======== =========
send a request.
The request must a valid json-string with method and params
public
Stringsend(Stringrequest);
arguments:
========== =============
``String`` **request**
========== =============
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
Objectsendobject(Stringrequest);
arguments:
========== =============
``String`` **request**
========== =============
send a RPC request by only passing the method and params.
It will create the raw request from it and return the result.
arguments:
============ ============
``String`` **method**
``Object[]`` **params**
============ ============
public
ObjectsendRPCasObject(Stringmethod,Object[]params,booleanuseEnsResolver);
arguments:
============ ====================
``String`` **method**
``Object[]`` **params**
``boolean`` **useEnsResolver**
============ ====================
send a RPC request by only passing the method and params.
It will create the raw request from it and return the result.
public
ObjectsendRPCasObject(Stringmethod,Object[]params);
arguments:
============ ============
``String`` **method**
``Object[]`` **params**
============ ============
clears the cache.
public
booleancacheClear();
restrieves the node list
public
IN3Node[]nodeList();
request for a signature of an already verified hash.
public
SignedBlockHash[]sign(BlockID[]blocks,String[]dataNodeAdresses);
arguments:
============================= ======================
`BlockID[] <#class-blockid>`_ **blocks**
``String[]`` **dataNodeAdresses**
============================= ======================
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)
arguments:
======== =============
``long`` **chainId**
======== =============
returns the current incubed version.
public static
native StringgetVersion();
public static
voidmain(String[]args);
arguments:
============ ==========
``String[]`` **args**
============ ==========
arguments:
============ =============
``String[]`` **urls**
``byte[]`` **payload**
============ =============
public
StringgetUrl();
public
StringgetAddress();
public
intgetIndex();
public
StringgetDeposit();
public
longgetProps();
public
intgetTimeout();
public
intgetRegisterTime();
public
intgetWeight();
public IN3Props();
public
voidsetDataNodes(String[]adresses);
arguments:
============ ==============
``String[]`` **adresses**
============ ==============
public
voidsetSignerNodes(String[]adresses);
arguments:
============ ==============
``String[]`` **adresses**
============ ==============
public
StringtoString();
public
StringtoJSON();
public static
voidloadLibrary();
returns an array of IN3Node
public
IN3Node[]getNodes();
Type: static final long
Type: static final long
Type: static final long
Type: static final long
Type: static final long
Type: static final long
Type: static final long
public
StringgetBlockHash();
public
longgetBlock();
public
StringgetR();
public
StringgetS();
public
longgetV();
public
StringgetMsgHash();
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.
============== = =====================================================================
arguments:
============ =============
``String[]`` **urls**
``byte[]`` **payload**
============ =============
API for handling BitCoin data.
Use it when connected to Chain.BTC.
creates a btc.API using the given incubed instance.
public API(
IN3in3);
arguments:
=================== =========
`IN3 <#class-in3>`_ **in3**
=================== =========
Retrieves the transaction and returns the data as json.
public
TransactiongetTransaction(Stringtxid);
arguments:
========== ==========
``String`` **txid**
========== ==========
Retrieves the serialized transaction (bytes).
public
byte[]getTransactionBytes(Stringtxid);
arguments:
========== ==========
``String`` **txid**
========== ==========
Retrieves the blockheader.
public
BlockHeadergetBlockHeader(StringblockHash);
arguments:
========== ===============
``String`` **blockHash**
========== ===============
Retrieves the byte array representing teh serialized blockheader data.
public
byte[]getBlockHeaderBytes(StringblockHash);
arguments:
========== ===============
``String`` **blockHash**
========== ===============
Retrieves the block including the full transaction data.
Use Api::GetBlockWithTxIds" for only the transaction ids.
arguments:
========== ===============
``String`` **blockHash**
========== ===============
Retrieves the block including only transaction ids.
Use Api::GetBlockWithTxData for the full transaction data.
arguments:
========== ===============
``String`` **blockHash**
========== ===============
Retrieves the serialized block in bytes.
public
byte[]getBlockBytes(StringblockHash);
arguments:
========== ===============
``String`` **blockHash**
========== ===============
A Block.
Transactions or Transaction of a block.
public
Transaction[]getTransactions();
Transactions or Transaction ids of a block.
public
String[]getTransactionHashes();
Size of this block in bytes.
public
longgetSize();
Weight of this block in bytes.
public
longgetWeight();
A Block header.
The hash of the blockheader.
public
StringgetHash();
Number of confirmations or blocks mined on top of the containing block.
public
longgetConfirmations();
Block number.
public
longgetHeight();
Used version.
public
longgetVersion();
Version as hex.
public
StringgetVersionHex();
Merkle root of the trie of all transactions in the block.
public
StringgetMerkleroot();
Unix timestamp in seconds since 1970.
public
longgetTime();
Unix timestamp in seconds since 1970.
public
longgetMediantime();
Nonce-field of the block.
public
longgetNonce();
Bits (target) for the block as hex.
public
StringgetBits();
Difficulty of the block.
public
floatgetDifficulty();
Total amount of work since genesis.
public
StringgetChainwork();
Number of transactions in the block.
public
longgetNTx();
Hash of the parent blockheader.
public
StringgetPreviousblockhash();
Hash of the next blockheader.
public
StringgetNextblockhash();
Script on a transaction output.
The hash of the blockheader.
public
StringgetAsm();
The raw hex data.
public
StringgetHex();
The required sigs.
public
longgetReqSigs();
The type e.g.
: pubkeyhash.
public
StringgetType();
List of addresses.
public
String[]getAddresses();
Script on a transaction input.
public ScriptSig(
JSONdata);
arguments:
===================== ==========
`JSON <#class-json>`_ **data**
===================== ==========
The asm data.
public
StringgetAsm();
The raw hex data.
public
StringgetHex();
A BitCoin Transaction.
public static
TransactionasTransaction(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
public static
Transaction[]asTransactions(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
Transaction Id.
public
StringgetTxid();
The transaction hash (differs from txid for witness transactions).
public
StringgetHash();
The version.
public
longgetVersion();
The serialized transaction size.
public
longgetSize();
The virtual transaction size (differs from size for witness transactions).
public
longgetVsize();
The transactions weight (between vsize4-3 and vsize4).
public
longgetWeight();
The locktime.
public
longgetLocktime();
The hex representation of raw data.
public
StringgetHex();
The block hash of the block containing this transaction.
public
StringgetBlockhash();
The confirmations.
public
longgetConfirmations();
The transaction time in seconds since epoch (Jan 1 1970 GMT).
public
longgetTime();
The block time in seconds since epoch (Jan 1 1970 GMT).
public
longgetBlocktime();
The transaction inputs.
public
TransactionInput[]getVin();
The transaction outputs.
public
TransactionOutput[]getVout();
Input of a transaction.
The transaction id.
public
StringgetTxid();
The index of the transactionoutput.
public
longgetYout();
The script.
public
ScriptSiggetScriptSig();
Hex-encoded witness data (if any).
public
String[]getTxinwitness();
The script sequence number.
public
longgetSequence();
A BitCoin Transaction.
public TransactionOutput(
JSONdata);
arguments:
===================== ==========
`JSON <#class-json>`_ **data**
===================== ==========
The value in bitcoins.
public
floatgetValue();
The index in the transaction.
public
longgetN();
The script of the transaction.
public
ScriptPubKeygetScriptPubKey();
Part of the configuration hierarchy for IN3 Client.
Holds the configuration a node group in a particular Chain.
Type: NodeConfigurationArrayList< , >
public ChainConfiguration(
longchain,ClientConfigurationconfig);
arguments:
=================================================== ============
``long`` **chain**
`ClientConfiguration <#class-clientconfiguration>`_ **config**
=================================================== ============
public
longgetChain();
public
BooleanisNeedsUpdate();
public
voidsetNeedsUpdate(booleanneedsUpdate);
arguments:
=========== =================
``boolean`` **needsUpdate**
=========== =================
public
StringgetContract();
public
voidsetContract(Stringcontract);
arguments:
========== ==============
``String`` **contract**
========== ==============
public
StringgetRegistryId();
public
voidsetRegistryId(StringregistryId);
arguments:
========== ================
``String`` **registryId**
========== ================
public
StringgetWhiteListContract();
public
voidsetWhiteListContract(StringwhiteListContract);
arguments:
========== =======================
``String`` **whiteListContract**
========== =======================
public
String[]getWhiteList();
public
voidsetWhiteList(String[]whiteList);
arguments:
============ ===============
``String[]`` **whiteList**
============ ===============
generates a json-string based on the internal data.
public
StringtoJSON();
public
StringtoString();
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()
public
IntegergetRequestCount();
sets the number of requests send when getting a first answer
public
voidsetRequestCount(intrequestCount);
arguments:
======= ==================
``int`` **requestCount**
======= ==================
public
BooleanisAutoUpdateList();
activates the auto update.if true the nodelist will be automaticly updated if the lastBlock is newer
public
voidsetAutoUpdateList(booleanautoUpdateList);
arguments:
=========== ====================
``boolean`` **autoUpdateList**
=========== ====================
public
ProofgetProof();
sets the type of proof used
public
voidsetProof(Proofproof);
arguments:
======================= ===========
`Proof <#class-proof>`_ **proof**
======================= ===========
public
IntegergetMaxAttempts();
sets the max number of attempts before giving up
public
voidsetMaxAttempts(intmaxAttempts);
arguments:
======= =================
``int`` **maxAttempts**
======= =================
public
IntegergetSignatureCount();
sets the number of signatures used to proof the blockhash.
public
voidsetSignatureCount(intsignatureCount);
arguments:
======= ====================
``int`` **signatureCount**
======= ====================
public
BooleanisStats();
if true (default) the request will be counted as part of the regular stats, if not they are not shown as part of the dashboard.
public
voidsetStats(booleanstats);
arguments:
=========== ===========
``boolean`` **stats**
=========== ===========
public
IntegergetFinality();
sets the number of signatures in percent required for the request
public
voidsetFinality(intfinality);
arguments:
======= ==============
``int`` **finality**
======= ==============
public
BooleanisIncludeCode();
public
voidsetIncludeCode(booleanincludeCode);
arguments:
=========== =================
``boolean`` **includeCode**
=========== =================
public
BooleanisBootWeights();
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 availabkle from cache.
public
voidsetBootWeights(booleanvalue);
arguments:
=========== ===========
``boolean`` **value**
=========== ===========
public
BooleanisKeepIn3();
public
voidsetKeepIn3(booleankeepIn3);
arguments:
=========== =============
``boolean`` **keepIn3**
=========== =============
public
BooleanisUseHttp();
public
voidsetUseHttp(booleanuseHttp);
arguments:
=========== =============
``boolean`` **useHttp**
=========== =============
public
LonggetTimeout();
specifies the number of milliseconds before the request times out.
increasing may be helpful if the device uses a slow connection.
public
voidsetTimeout(longtimeout);
arguments:
======== =============
``long`` **timeout**
======== =============
public
LonggetMinDeposit();
sets min stake of the server.
Only nodes owning at least this amount will be chosen.
public
voidsetMinDeposit(longminDeposit);
arguments:
======== ================
``long`` **minDeposit**
======== ================
public
LonggetNodeProps();
public
voidsetNodeProps(longnodeProps);
arguments:
======== ===============
``long`` **nodeProps**
======== ===============
public
LonggetNodeLimit();
sets the limit of nodes to store in the client.
public
voidsetNodeLimit(longnodeLimit);
arguments:
======== ===============
``long`` **nodeLimit**
======== ===============
public
IntegergetReplaceLatestBlock();
replaces the latest with blockNumber- specified value
public
voidsetReplaceLatestBlock(intreplaceLatestBlock);
arguments:
======= ========================
``int`` **replaceLatestBlock**
======= ========================
public
StringgetRpc();
setup an custom rpc source for requests by setting Chain to local and proof to none
public
voidsetRpc(Stringrpc);
arguments:
========== =========
``String`` **rpc**
========== =========
public
ChainConfigurationHashMap< Long, , >getNodesConfig();
public
voidsetChainsConfig(HashMap<Long,ChainConfiguration>);
arguments:
=================================================================== ==================
`ChainConfigurationHashMap< Long, , > <#class-chainconfiguration>`_ **chainsConfig**
=================================================================== ==================
public
voidmarkAsSynced();
public
booleanisSynced();
public
StringtoString();
generates a json-string based on the internal data.
public
StringtoJSON();
Configuration Object for Incubed Client.
It represents the node of a nodelist.
public NodeConfiguration(
ChainConfigurationconfig);
arguments:
================================================= ============
`ChainConfiguration <#class-chainconfiguration>`_ **config**
================================================= ============
public
StringgetUrl();
public
voidsetUrl(Stringurl);
arguments:
========== =========
``String`` **url**
========== =========
public
longgetProps();
public
voidsetProps(longprops);
arguments:
======== ===========
``long`` **props**
======== ===========
public
StringgetAddress();
public
voidsetAddress(Stringaddress);
arguments:
========== =============
``String`` **address**
========== =============
public
StringtoString();
an Interface class, which is able to generate a JSON-String.
generates a json-string based on the internal data.
public
StringtoJSON();
a Wrapper for the incubed client offering Type-safe Access and additional helper functions.
creates an eth1.API using the given incubed instance.
public API(
IN3in3);
arguments:
=================== =========
`IN3 <#class-in3>`_ **in3**
=================== =========
finds the Block as specified by the number.
use Block.LATEST for getting the lastest block.
public
BlockgetBlockByNumber(longblock,booleanincludeTransactions);
arguments:
=========== ========================= ================================================================================================
``long`` **block**
``boolean`` **includeTransactions** < the Blocknumber < if true all Transactions will be includes, if not only the transactionhashes
=========== ========================= ================================================================================================
Returns information about a block by hash.
public
BlockgetBlockByHash(StringblockHash,booleanincludeTransactions);
arguments:
=========== ========================= ================================================================================================
``String`` **blockHash**
``boolean`` **includeTransactions** < the Blocknumber < if true all Transactions will be includes, if not only the transactionhashes
=========== ========================= ================================================================================================
the current BlockNumber.
public
longgetBlockNumber();
the current Gas Price.
public
longgetGasPrice();
Returns the EIP155 chain ID used for transaction signing at the current best block.
Null is returned if not available.
public
StringgetChainId();
calls a function of a smart contract and returns the result.
public
Objectcall(TransactionRequestrequest,longblock);
arguments:
================================================= ============= =============================================================
`TransactionRequest <#class-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.
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
longestimateGas(TransactionRequestrequest,longblock);
arguments:
================================================= ============= =============================================================
`TransactionRequest <#class-transactionrequest>`_ **request**
``long`` **block** < the transaction to call. < the Block used to for the state.
================================================= ============= =============================================================
returns: long : the gas required to call the function.
Returns the balance of the account of given address in wei.
arguments:
========== =============
``String`` **address**
``long`` **block**
========== =============
Returns code at a given address.
arguments:
========== =============
``String`` **address**
``long`` **block**
========== =============
Returns the value from a storage position at a given address.
public
StringgetStorageAt(Stringaddress,BigIntegerposition,longblock);
arguments:
============== ==============
``String`` **address**
``BigInteger`` **position**
``long`` **block**
============== ==============
Returns the number of transactions in a block from a block matching the given block hash.
public
longgetBlockTransactionCountByHash(StringblockHash);
arguments:
========== ===============
``String`` **blockHash**
========== ===============
Returns the number of transactions in a block from a block matching the given block number.
public
longgetBlockTransactionCountByNumber(longblock);
arguments:
======== ===========
``long`` **block**
======== ===========
Polling method for a filter, which returns an array of logs which occurred since last poll.
arguments:
======== ========
``long`` **id**
======== ========
Polling method for a filter, which returns an array of logs which occurred since last poll.
public
String[]getFilterChangesFromBlocks(longid);
arguments:
======== ========
``long`` **id**
======== ========
Polling method for a filter, which returns an array of logs which occurred since last poll.
arguments:
======== ========
``long`` **id**
======== ========
Polling method for a filter, which returns an array of logs which occurred since last poll.
arguments:
=============================== ============
`LogFilter <#class-logfilter>`_ **filter**
=============================== ============
Returns information about a transaction by block hash and transaction index position.
public
TransactiongetTransactionByBlockHashAndIndex(StringblockHash,intindex);
arguments:
========== ===============
``String`` **blockHash**
``int`` **index**
========== ===============
Returns information about a transaction by block number and transaction index position.
public
TransactiongetTransactionByBlockNumberAndIndex(longblock,intindex);
arguments:
======== ===========
``long`` **block**
``int`` **index**
======== ===========
Returns the information about a transaction requested by transaction hash.
public
TransactiongetTransactionByHash(StringtransactionHash);
arguments:
========== =====================
``String`` **transactionHash**
========== =====================
Returns the number of transactions sent from an address.
public
BigIntegergetTransactionCount(Stringaddress,longblock);
arguments:
========== =============
``String`` **address**
``long`` **block**
========== =============
Returns the number of transactions sent from an address.
public
TransactionReceiptgetTransactionReceipt(StringtransactionHash);
arguments:
========== =====================
``String`` **transactionHash**
========== =====================
Returns information about a uncle of a block number and uncle index position.
Note: An uncle doesn't contain individual transactions.
public
BlockgetUncleByBlockNumberAndIndex(longblock,intpos);
arguments:
======== ===========
``long`` **block**
``int`` **pos**
======== ===========
Returns the number of uncles in a block from a block matching the given block hash.
public
longgetUncleCountByBlockHash(Stringblock);
arguments:
========== ===========
``String`` **block**
========== ===========
Returns the number of uncles in a block from a block matching the given block hash.
public
longgetUncleCountByBlockNumber(longblock);
arguments:
======== ===========
``long`` **block**
======== ===========
Creates a filter in the node, to notify when a new block arrives.
To check if the state has changed, call eth_getFilterChanges.
public
longnewBlockFilter();
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
longnewLogFilter(LogFilterfilter);
arguments:
=============================== ============
`LogFilter <#class-logfilter>`_ **filter**
=============================== ============
uninstall filter.
public
booleanuninstallFilter(longfilter);
arguments:
======== ============
``long`` **filter**
======== ============
Creates new message call transaction or a contract creation for signed transactions.
public
StringsendRawTransaction(Stringdata);
arguments:
========== ==========
``String`` **data**
========== ==========
returns: String : transactionHash
encodes the arguments as described in the method signature using ABI-Encoding.
arguments:
============ ===============
``String`` **signature**
``String[]`` **params**
============ ===============
decodes the data based on the signature.
public
String[]abiDecode(Stringsignature,Stringencoded);
arguments:
========== ===============
``String`` **signature**
``String`` **encoded**
========== ===============
converts the given address to a checksum address.
public
StringchecksumAddress(Stringaddress);
arguments:
========== =============
``String`` **address**
========== =============
converts the given address to a checksum address.
Second parameter includes the chainId.
public
StringchecksumAddress(Stringaddress,BooleanuseChainId);
arguments:
=========== ================
``String`` **address**
``Boolean`` **useChainId**
=========== ================
resolve ens-name.
public
Stringens(Stringname);
arguments:
========== ==========
``String`` **name**
========== ==========
resolve ens-name.
Second parameter especifies if it is an address, owner, resolver or hash.
arguments:
=============================== ==========
``String`` **name**
`ENSMethod <#class-ensmethod>`_ **type**
=============================== ==========
sends a Transaction as described by the TransactionRequest.
This will require a signer to be set in order to sign the transaction.
public
StringsendTransaction(TransactionRequesttx);
arguments:
================================================= ========
`TransactionRequest <#class-transactionrequest>`_ **tx**
================================================= ========
the current Gas Price.
public
Objectcall(Stringto,Stringfunction,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.
represents a Block in ethereum.
The latest Block Number.
Type: static long
The Genesis Block.
Type: static long
returns the total Difficulty as a sum of all difficulties starting from genesis.
public
BigIntegergetTotalDifficulty();
the gas limit of the block.
public
BigIntegergetGasLimit();
the extra data of the block.
public
StringgetExtraData();
the difficulty of the block.
public
BigIntegergetDifficulty();
the author or miner of the block.
public
StringgetAuthor();
the roothash of the merkletree containing all transaction of the block.
public
StringgetTransactionsRoot();
the roothash of the merkletree containing all transaction receipts of the block.
public
StringgetTransactionReceiptsRoot();
the roothash of the merkletree containing the complete state.
public
StringgetStateRoot();
the transaction hashes of the transactions in the block.
public
String[]getTransactionHashes();
the transactions of the block.
public
Transaction[]getTransactions();
the unix timestamp in seconds since 1970.
public
longgetTimeStamp();
the roothash of the merkletree containing all uncles of the block.
public
StringgetSha3Uncles();
the size of the block.
public
longgetSize();
the seal fields used for proof of authority.
public
String[]getSealFields();
the block hash of the of the header.
public
StringgetHash();
the bloom filter of the block.
public
StringgetLogsBloom();
the mix hash of the block.
(only valid of proof of work)
public
StringgetMixHash();
the mix hash of the block.
(only valid of proof of work)
public
StringgetNonce();
the block number
public
longgetNumber();
the hash of the parent-block.
public
StringgetParentHash();
returns the blockhashes of all uncles-blocks.
public
String[]getUncles();
public
inthashCode();
public
booleanequals(Objectobj);
arguments:
========== =========
``Object`` **obj**
========== =========
a log entry of a transaction receipt.
true when the log was removed, due to a chain reorganization.
false if its a valid log.
public
booleanisRemoved();
integer of the log index position in the block.
null when its pending log.
public
intgetLogIndex();
integer of the transactions index position log was created from.
null when its pending log.
public
intgettTansactionIndex();
Hash, 32 Bytes - hash of the transactions this log was created from.
null when its pending log.
public
StringgetTransactionHash();
Hash, 32 Bytes - hash of the block where this log was in.
null when its pending. null when its pending log.
public
StringgetBlockHash();
the block number where this log was in.
null when its pending. null when its pending log.
public
longgetBlockNumber();
20 Bytes - address from which this log originated.
public
StringgetAddress();
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();
Log configuration for search logs.
public
longgetFromBlock();
public
voidsetFromBlock(longfromBlock);
arguments:
======== ===============
``long`` **fromBlock**
======== ===============
public
longgetToBlock();
public
voidsetToBlock(longtoBlock);
arguments:
======== =============
``long`` **toBlock**
======== =============
public
StringgetAddress();
public
voidsetAddress(Stringaddress);
arguments:
========== =============
``String`` **address**
========== =============
public
Object[]getTopics();
public
voidsetTopics(Object[]topics);
arguments:
============ ============
``Object[]`` **topics**
============ ============
public
intgetLimit();
public
voidsetLimit(intlimit);
arguments:
======= ===========
``int`` **limit**
======= ===========
creates a JSON-String.
public
StringtoString();
a simple Implementation for holding private keys to sing data or transactions.
adds a key to the wallet and returns its public address.
public
StringaddRawKey(Stringdata);
arguments:
========== ==========
``String`` **data**
========== ==========
adds a key to the wallet and returns its public address.
public
StringaddKeyStore(StringjsonData,Stringpassphrase);
arguments:
========== ================
``String`` **jsonData**
``String`` **passphrase**
========== ================
optiional method which allows to change the transaction-data before sending it.
This can be used for redirecting it through a multisig.
public
TransactionRequestprepareTransaction(IN3in3,TransactionRequesttx);
arguments:
================================================= =========
`IN3 <#class-in3>`_ **in3**
`TransactionRequest <#class-transactionrequest>`_ **tx**
================================================= =========
returns true if the account is supported (or unlocked)
public
booleancanSign(Stringaddress);
arguments:
========== =============
``String`` **address**
========== =============
signing of the raw data.
arguments:
========== =============
``String`` **data**
``String`` **address**
========== =============
represents a Transaction in ethereum.
public static
TransactionasTransaction(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
the blockhash of the block containing this transaction.
public
StringgetBlockHash();
the block number of the block containing this transaction.
public
longgetBlockNumber();
the chainId of this transaction.
public
StringgetChainId();
the address of the deployed contract (if successfull)
public
StringgetCreatedContractAddress();
the address of the sender.
public
StringgetFrom();
the Transaction hash.
public
StringgetHash();
the Transaction data or input data.
public
StringgetData();
the nonce used in the transaction.
public
longgetNonce();
the public key of the sender.
public
StringgetPublicKey();
the value send in wei.
public
BigIntegergetValue();
the raw transaction as rlp encoded data.
public
StringgetRaw();
the address of the receipient or contract.
public
StringgetTo();
the signature of the sender - a array of the [ r, s, v]
public
String[]getSignature();
the gas price provided by the sender.
public
longgetGasPrice();
the gas provided by the sender.
public
longgetGas();
represents a Transaction receipt in ethereum.
the blockhash of the block containing this transaction.
public
StringgetBlockHash();
the block number of the block containing this transaction.
public
longgetBlockNumber();
the address of the deployed contract (if successfull)
public
StringgetCreatedContractAddress();
the address of the sender.
public
StringgetFrom();
the Transaction hash.
public
StringgetTransactionHash();
the Transaction index.
public
intgetTransactionIndex();
20 Bytes - The address of the receiver.
null when it's a contract creation transaction.
public
StringgetTo();
The amount of gas used by this specific transaction alone.
public
longgetGasUsed();
Array of log objects, which this transaction generated.
public
Log[]getLogs();
256 Bytes - A bloom filter of logs/events generated by contracts during transaction execution.
Used to efficiently rule out transactions without expected logs
public
StringgetLogsBloom();
32 Bytes - Merkle root of the state trie after the transaction has been executed (optional after Byzantium hard fork EIP609).
public
StringgetRoot();
success of a Transaction.
true indicates transaction failure , false indicates transaction success. Set for blocks mined after Byzantium hard fork EIP609, null before.
public
booleangetStatus();
represents a Transaction Request which should be send or called.
public
StringgetFrom();
public
voidsetFrom(Stringfrom);
arguments:
========== ==========
``String`` **from**
========== ==========
public
StringgetTo();
public
voidsetTo(Stringto);
arguments:
========== ========
``String`` **to**
========== ========
public
BigIntegergetValue();
public
voidsetValue(BigIntegervalue);
arguments:
============== ===========
``BigInteger`` **value**
============== ===========
public
longgetNonce();
public
voidsetNonce(longnonce);
arguments:
======== ===========
``long`` **nonce**
======== ===========
public
longgetGas();
public
voidsetGas(longgas);
arguments:
======== =========
``long`` **gas**
======== =========
public
longgetGasPrice();
public
voidsetGasPrice(longgasPrice);
arguments:
======== ==============
``long`` **gasPrice**
======== ==============
public
StringgetFunction();
public
voidsetFunction(Stringfunction);
arguments:
========== ==============
``String`` **function**
========== ==============
public
Object[]getParams();
public
voidsetParams(Object[]params);
arguments:
============ ============
``Object[]`` **params**
============ ============
public
voidsetData(Stringdata);
arguments:
========== ==========
``String`` **data**
========== ==========
creates the data based on the function/params values.
public
StringgetData();
public
StringgetTransactionJson();
public
ObjectgetResult(Stringdata);
arguments:
========== ==========
``String`` **data**
========== ==========
The enum type contains the following values:
============== =
**addr** 0
**resolver** 1
**hash** 2
**owner** 3
============== =
API for ipfs custom methods.
To be used along with "Chain.IPFS" on in3 instance.
creates a ipfs.API using the given incubed instance.
public API(
IN3in3);
arguments:
=================== =========
`IN3 <#class-in3>`_ **in3**
=================== =========
Returns the content associated with specified multihash on success OR NULL on error.
public
byte[]get(Stringmultihash);
arguments:
========== ===============
``String`` **multihash**
========== ===============
Returns the IPFS multihash of stored content on success OR NULL on error.
public
Stringput(Stringcontent);
arguments:
========== =============
``String`` **content**
========== =============
Returns the IPFS multihash of stored content on success OR NULL on error.
public
Stringput(byte[]content);
arguments:
========== =============
``byte[]`` **content**
========== =============
The enum type contains the following values:
============ =
**base64** 0
**hex** 1
**utf8** 2
============ =
Pojo that represents the result of an ecrecover operation (see: Crypto class).
address from ecrecover operation.
public
StringgetAddress();
public key from ecrecover operation.
public
StringgetPublicKey();
a Wrapper for crypto-related helper functions.
public Crypto(
IN3in3);
arguments:
=================== =========
`IN3 <#class-in3>`_ **in3**
=================== =========
returns a signature given a message and a key.
public
SignaturesignData(Stringmsg,Stringkey,SignatureTypesigType);
arguments:
======================================= =============
``String`` **msg**
``String`` **key**
`SignatureType <#class-signaturetype>`_ **sigType**
======================================= =============
arguments:
========== ================
``String`` **key**
``String`` **passphrase**
========== ================
extracts the public address from a private key.
public
Stringpk2address(Stringkey);
arguments:
========== =========
``String`` **key**
========== =========
extracts the public key from a private key.
public
Stringpk2public(Stringkey);
arguments:
========== =========
``String`` **key**
========== =========
extracts the address and public key from a signature.
arguments:
========== =========
``String`` **msg**
``String`` **sig**
========== =========
extracts the address and public key from a signature.
public
Accountecrecover(Stringmsg,Stringsig,SignatureTypesigType);
arguments:
======================================= =============
``String`` **msg**
``String`` **sig**
`SignatureType <#class-signaturetype>`_ **sigType**
======================================= =============
returns a signature given a message and a key.
arguments:
========== =========
``String`` **msg**
``String`` **key**
========== =========
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.
gets the property
public
Objectget(Stringprop);
arguments:
========== ========== =========================
``String`` **prop** the name of the property.
========== ========== =========================
returns: Object : the raw object.
adds values.
This function will be called from the JNI-Iterface.
Internal use only!
arguments:
========== ========= ===================
``int`` **key** the hash of the key
``Object`` **val** the value object
========== ========= ===================
returns the property as long
public
longgetLong(Stringkey);
arguments:
========== ========= ================
``String`` **key** the propertyName
========== ========= ================
returns: long : the long value
returns the property as BigInteger
public
BigIntegergetBigInteger(Stringkey);
arguments:
========== ========= ================
``String`` **key** the propertyName
========== ========= ================
returns: BigInteger : the BigInteger value
returns the property as StringArray
public
String[]getStringArray(Stringkey);
arguments:
========== ========= ================
``String`` **key** the propertyName
========== ========= ================
returns: String[] : the array or null
returns the property as String or in case of a number as hexstring.
public
StringgetString(Stringkey);
arguments:
========== ========= ================
``String`` **key** the propertyName
========== ========= ================
returns: String : the hexstring
public
StringtoString();
public
inthashCode();
public
booleanequals(Objectobj);
arguments:
========== =========
``Object`` **obj**
========== =========
casts the object to a String[]
public static
String[]asStringArray(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
public static
BigIntegerasBigInteger(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
public static
longasLong(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
public static
intasInt(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
public static
StringasString(Objecto);
arguments:
========== =======
``Object`` **o**
========== =======
public static
StringtoJson(Objectob);
arguments:
========== ========
``Object`` **ob**
========== ========
public static
voidappendKey(StringBuildersb,Stringkey,Objectvalue);
arguments:
================= ===========
``StringBuilder`` **sb**
``String`` **key**
``Object`` **value**
================= ===========
public
StringgetMessage();
public
StringgetMessageHash();
public
StringgetSignature();
public
StringgetR();
public
StringgetS();
public
longgetV();
a simple Storage Provider storing the cache in the temp-folder.
returns a item from cache ()
public
byte[]getItem(Stringkey);
arguments:
========== ========= ====================
``String`` **key** the key for the item
========== ========= ====================
returns: byte[] : the bytes or null if not found.
stores a item in the cache.
arguments:
========== ============= ====================
``String`` **key** the key for the item
``byte[]`` **content** the value to store
========== ============= ====================
clear the cache.
public
booleanclear();
The enum type contains the following values:
============== =
**eth_sign** 0
**raw** 1
**hash** 2
============== =
a Interface responsible for signing data or transactions.
optiional method which allows to change the transaction-data before sending it.
This can be used for redirecting it through a multisig.
public
TransactionRequestprepareTransaction(IN3in3,TransactionRequesttx);
arguments:
================================================= =========
`IN3 <#class-in3>`_ **in3**
`TransactionRequest <#class-transactionrequest>`_ **tx**
================================================= =========
returns true if the account is supported (or unlocked)
public
booleancanSign(Stringaddress);
arguments:
========== =============
``String`` **address**
========== =============
signing of the raw data.
arguments:
========== =============
``String`` **data**
``String`` **address**
========== =============
Provider methods to cache data.
These data could be nodelists, contract codes or validator changes.
returns a item from cache ()
public
byte[]getItem(Stringkey);
arguments:
========== ========= ====================
``String`` **key** the key for the item
========== ========= ====================
returns: byte[] : the bytes or null if not found.
stores a item in the cache.
arguments:
========== ============= ====================
``String`` **key** the key for the item
``byte[]`` **content** the value to store
========== ============= ====================
clear the cache.
public
booleanclear();