API Reference Dotnet

Dotnet bindings and library for in3. Go to our readthedocs page for more on usage.

This library is based on the C version of Incubed.

Runtimes

Since this is built on top of the native library, it is limited to the followin runtimes (RID)

  • osx-x64
  • linux-x86
  • linux-x64
  • win-x64
  • linux-arm64

For more information, see Rid Catalog.

Quickstart

Install with nuget

dotnet add package Blockchains.In3

Examples

CallSmartContractFunction

source : in3-c/dotnet/Examples/CallSmartContractFunction//CallSmartContractFunction

using System;
using System.Numerics;
using System.Threading.Tasks;
using In3;
using In3.Configuration;
using In3.Eth1;
using In3.Utils;

namespace CallSmartContractFunction
{
    public class Program
    {
        public static async Task Main()
        {
            // Set it to mainnet
            IN3 mainnetClient = IN3.ForChain(Chain.Mainnet);
            ClientConfiguration cfg = mainnetClient.Configuration;
            cfg.Proof = Proof.Standard;

            string contractAddress = "0x2736D225f85740f42D17987100dc8d58e9e16252";

            // Create the query transaction
            TransactionRequest serverCountQuery = new TransactionRequest();
            serverCountQuery.To = contractAddress;

            // Define the function and the parameters to query the total in3 servers
            serverCountQuery.Function = "totalServers():uint256";
            serverCountQuery.Params = new object[0];

            string[] serverCountResult = (string[])await mainnetClient.Eth1.Call(serverCountQuery, BlockParameter.Latest);
            BigInteger servers = DataTypeConverter.HexStringToBigint(serverCountResult[0]);

            for (int i = 0; i < servers; i++)
            {
                TransactionRequest serverDetailQuery = new TransactionRequest();
                serverDetailQuery.To = contractAddress;

                // Define the function and the parameters to query the in3 servers detail
                serverDetailQuery.Function = "servers(uint256):(string,address,uint32,uint256,uint256,address)";
                serverDetailQuery.Params = new object[] { i }; // index of the server (uint256) as per solidity function signature

                string[] serverDetailResult = (string[])await mainnetClient.Eth1.Call(serverDetailQuery, BlockParameter.Latest);
                Console.Out.WriteLine($"Server url: {serverDetailResult[0]}");
            }
        }
    }
}

ConnectToEthereum

source : in3-c/dotnet/Examples/ConnectToEthereum//ConnectToEthereum

using System;
using System.Numerics;
using System.Threading.Tasks;
using In3;

namespace ConnectToEthereum
{
    class Program
    {
        static async Task Main()
        {
            Console.Out.WriteLine("Ethereum Main Network");
            IN3 mainnetClient = IN3.ForChain(Chain.Mainnet);
            BigInteger mainnetLatest = await mainnetClient.Eth1.BlockNumber();
            BigInteger mainnetCurrentGasPrice = await mainnetClient.Eth1.GetGasPrice();
            Console.Out.WriteLine($"Latest Block Number: {mainnetLatest}");
            Console.Out.WriteLine($"Gas Price: {mainnetCurrentGasPrice} Wei");

            Console.Out.WriteLine("Ethereum Goerli Test Network");
            IN3 goerliClient = IN3.ForChain(Chain.Goerli);
            BigInteger goerliLatest = await goerliClient.Eth1.BlockNumber();
            BigInteger clientCurrentGasPrice = await goerliClient.Eth1.GetGasPrice();
            Console.Out.WriteLine($"Latest Block Number: {goerliLatest}");
            Console.Out.WriteLine($"Gas Price: {clientCurrentGasPrice} Wei");
        }
    }
}

EnsResolver

source : in3-c/dotnet/Examples/EnsResolver//EnsResolver

using System;
using System.Threading.Tasks;
using In3;

namespace EnsResolver
{
    public class Program
    {
        static async Task Main()
        {
            IN3 in3 = IN3.ForChain(Chain.Mainnet);

            string cryptoKittiesDomain = "cryptokitties.eth";
            string resolver = await in3.Eth1.Ens(cryptoKittiesDomain, ENSParameter.Resolver);
            string owner = await in3.Eth1.Ens(cryptoKittiesDomain, ENSParameter.Owner);

            Console.Out.WriteLine($"The owner of {cryptoKittiesDomain} is {owner}, resolver is {resolver}.");
        }
    }
}

Ipfs

source : in3-c/dotnet/Examples/Ipfs//Ipfs

using System;
using System.Text;
using System.Threading.Tasks;
using In3;

namespace Ipfs
{
    class Program
    {
        static async Task Main()
        {
            // Content to be stored
            string toStore = "LOREM_IPSUM";

            // Connect to ipfs.
            IN3 ipfsClient = IN3.ForChain(Chain.Ipfs);

            // Store the hash since it will be needed to fetch the content back.
            string hash = await ipfsClient.Ipfs.Put(toStore);

            //
            byte[] storedBytes = await ipfsClient.Ipfs.Get(hash);
            string storedStging = Encoding.UTF8.GetString(storedBytes, 0, storedBytes.Length);
            Console.Out.WriteLine($"The stored string is: {storedStging}");
        }
    }
}

Logs

source : in3-c/dotnet/Examples/Logs//Logs

using System;
using System.Threading;
using System.Threading.Tasks;
using In3;
using In3.Eth1;

namespace Logs
{
    class Program
    {
        static async Task Main()
        {
            // Define an upper limit for poll since we dont want our application potentially running forever.
            int maxIterations = 500;
            int oneSecond = 1000; // in ms

            // Connect to mainnet.
            IN3 mainnetClient = IN3.ForChain(Chain.Mainnet);

            // Create a filter object pointing, in this case, to an "eventful" contract address.
            LogFilter tetherUsFilter = new LogFilter {Address = "0xdAC17F958D2ee523a2206206994597C13D831ec7"};

            // Create the filter to be polled for logs.
            long filterId = await mainnetClient.Eth1.NewLogFilter(tetherUsFilter);

            // Loop to initiate the poll for the logs.
            for (int i = 0; i < maxIterations; i++)
            {
                // Query for the log events since the creation of the filter or the previous poll (this method in NOT idempotent as it retrieves a diff).
                Log[] tetherLogs = await mainnetClient.Eth1.GetFilterChangesFromLogs(filterId);
                if (tetherLogs.Length > 0)
                {
                    Console.Out.WriteLine("Logs found: " + tetherLogs.Length);
                    break;
                }

                // Wait before next query.
                Thread.Sleep(oneSecond);
            }
        }
    }
}

SendTransaction

source : in3-c/dotnet/Examples/SendTransaction//SendTransaction

using System;
using System.Threading;
using System.Threading.Tasks;
using In3;
using In3.Crypto;
using In3.Eth1;

namespace SendTransaction
{
    public class Program
    {
        static async Task Main()
        {
            IN3 goerliClient = IN3.ForChain(Chain.Goerli);

            string myPrivateKey = "0x0829B3C639A3A8F2226C8057F100128D4F7AE8102C92048BA6DE38CF4D3BC6F1";
            string receivingAddress = "0x6FA33809667A99A805b610C49EE2042863b1bb83";

            // Get the wallet, which is the default signer.
            SimpleWallet myAccountWallet = (SimpleWallet)goerliClient.Signer;

            string myAccount = myAccountWallet.AddRawKey(myPrivateKey);

            // Create the transaction request
            TransactionRequest transferWei = new TransactionRequest();
            transferWei.To = receivingAddress;
            transferWei.From = myAccount;
            transferWei.Value = 300;

            // Get the current gas prices
            long currentGasPrice = await goerliClient.Eth1.GetGasPrice();
            transferWei.GasPrice = currentGasPrice;

            long estimatedSpentGas = await goerliClient.Eth1.EstimateGas(transferWei, BlockParameter.Latest);
            Console.Out.WriteLine($"Estimated gas to spend: {estimatedSpentGas}");

            string transactionHash = await goerliClient.Eth1.SendTransaction(transferWei);
            Console.Out.WriteLine($"Transaction {transactionHash} sent.");
            Thread.Sleep(30000);

            TransactionReceipt receipt = await goerliClient.Eth1.GetTransactionReceipt(transactionHash);
            Console.Out.WriteLine($"Transaction {transactionHash} mined on block {receipt.BlockNumber}.");
        }
    }
}

Build Examples

To setup and run the example projects, simply run on the respective project folder:

dotnet run

To build all of them, on the solution folder, run:

dotnet build

\n## Index\n

Account type

In3.Crypto

Composite entity that holds address and public key. It represents and Ethereum acount. Entity returned from EcRecover.

Address property

The address.

PublicKey property

The public key.

Api type

In3.Btc

API for handling BitCoin data. Use it when connected to Btc.

Api type

In3.Crypto

Class that exposes utility methods for cryptographic utilities. Relies on IN3 functionality.

Api type

In3.Eth1

Module based on Ethereum’s api and web3. Works as a general parent for all Ethereum-specific operations.

Api type

In3.Ipfs

API for ipfs realted methods. To be used along with Ipfs on IN3. Ipfs stands for and is a peer-to-peer hypermedia protocol designed to make the web faster, safer, and more open.

GetBlockBytes(blockHash) method

Retrieves the serialized block in bytes.

Returns

The bytes of the block.

Parameters
Example
byte[] blockBytes = in3.Btc.GetBlockBytes("000000000000000000064ba7512ecc70cabd7ed17e31c06f2205d5ecdadd6d22");

GetBlockHeader(blockHash) method

Retrieves the blockheader.

Returns

The Block header.

Parameters
Example
BlockHeader header = in3.Btc.GetBlockHeader("0000000000000000000cd3c5d7638014e78a5fba33be5fa5cb10ef9f03d99e60");

GetBlockHeaderBytes(blockHash) method

Retrieves the byte array representing teh serialized blockheader data.

Returns

The Block header in bytes.

Parameters
Example
byte[] header = in3.Btc.GetBlockHeaderBytes("0000000000000000000cd3c5d7638014e78a5fba33be5fa5cb10ef9f03d99e60");

GetBlockWithTxData(blockHash) method

Retrieves the block including the full transaction data. Use GetBlockWithTxIds for only the transaction ids.

Returns

The block of type Block`1.

Parameters
Example
Block{Transaction} block = in3.Btc.GetBlockWithTxData("000000000000000000064ba7512ecc70cabd7ed17e31c06f2205d5ecdadd6d22");
Transaction t1 = block.Tx[0];

GetBlockWithTxIds(blockHash) method

Retrieves the block including only transaction ids. Use GetBlockWithTxData for the full transaction data.

Returns

The block of type Block`1.

Parameters
Example
Block{string} block = in3.Btc.GetBlockWithTxIds("000000000000000000064ba7512ecc70cabd7ed17e31c06f2205d5ecdadd6d22");
string t1 = block.Tx[0];

GetTransaction(txid) method

Retrieves the transaction and returns the data as json.

Returns

The transaction object.

Parameters
Example
Transaction desiredTransaction = in3.Btc.GetTransaction("1427c7d1698e61afe061950226f1c149990b8c1e1b157320b0c4acf7d6b5605d");

GetTransactionBytes(txid) method

Retrieves the serialized transaction (bytes).

Returns

The byte array for the Transaction.

Parameters
Example
byte[] serializedTransaction = in3.Btc.GetTransactionBytes("1427c7d1698e61afe061950226f1c149990b8c1e1b157320b0c4acf7d6b5605d");

DecryptKey(pk,passphrase) method

Decryot an encrypted private key.

Returns

Decrypted key.

Parameters

EcRecover(signedData,signature,signatureType) method

Recovers the account associated with the signed data.

Returns

The account.

Parameters

Pk2Address(pk) method

Derives an address from the given private (pk) key using SHA-3 algorithm.

Returns

The address.

Parameters

Pk2Public(pk) method

Derives public key from the given private (pk) key using SHA-3 algorithm.

Returns

The public key.

Parameters

Sha3(data) method

Hash the input data using sha3 algorithm.

Returns

Hashed output.

Parameters

SignData(msg,pk,sigType) method

Signs the data msg with a given private key. Refer to SignedData for more information.

Returns

The signed data.

Parameters

AbiDecode(signature,encodedData) method

ABI decoder. Used to parse rpc responses from the EVM. Based on the Solidity specification .

Returns

The decoded argugments for the function call given the encded data.

Parameters
  • System.String signature - Function signature i.e. or . In case of the latter, the function signature will be ignored and only the return types will be parsed.
  • System.String encodedData - Abi encoded values. Usually the string returned from a rpc to the EVM.

AbiEncode(signature,args) method

ABI encoder. Used to serialize a rpc to the EVM. Based on the Solidity specification . Note: Parameters refers to the list of variables in a method declaration. Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the arguments used must match the declaration’s parameters in type and order.

Returns

The encoded data.

Parameters
  • System.String signature - Function signature, with parameters. i.e. , can contain the return types but will be ignored.
  • System.Object[] args - Function parameters, in the same order as in passed on to .

BlockNumber() method

Returns the number of the most recent block the in3 network can collect signatures to verify. Can be changed by ReplaceLatestBlock. If you need the very latest block, change SignatureCount to 0.

Returns

The number of the block.

Parameters

This method has no parameters.

Call(request,blockNumber) method

Calls a smart-contract method. Will be executed locally by Incubed’s EVM or signed and sent over to save the state changes. Check https://ethereum.stackexchange.com/questions/3514/how-to-call-a-contract-method-using-the-eth-call-json-rpc-api for more.

Returns

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

Parameters

ChecksumAddress(address,shouldUseChainId) method

Will convert an upper or lowercase Ethereum address to a checksum address, that uses case to encode values. See EIP55.

Returns

EIP-55 compliant, mixed-case address.

Parameters

Ens(name,type) method

Resolves ENS domain name.

Returns

The resolved entity for the domain.

Parameters
Remarks

The actual semantics of the returning value changes according to type.

EstimateGas(request,blockNumber) method

Gas estimation for transaction. Used to fill transaction.gas field. Check RawTransaction docs for more on gas.

Returns

Estimated gas in Wei.

Parameters

GetBalance(address,blockNumber) method

Returns the balance of the account of given address.

Returns

The current balance in wei.

Parameters

GetBlockByHash(blockHash,shouldIncludeTransactions) method

Blocks can be identified by root hash of the block merkle tree (this), or sequential number in which it was mined GetBlockByNumber.

Returns

The Block of the requested (if exists).

Parameters
  • System.String blockHash - Desired block hash.
  • System.Boolean shouldIncludeTransactions - If true, returns the full transaction objects, otherwise only its hashes. The default value is false.
Remarks

Returning Block must be cast to TransactionBlock or TransactionHashBlock to access the transaction data.

GetBlockByNumber(blockNumber,shouldIncludeTransactions) method

Blocks can be identified by sequential number in which it was mined, or root hash of the block merkle tree GetBlockByHash.

Returns

The Block of the requested (if exists).

Parameters
Example
TransactionBlock latest = (TransactionBlock) _client.Eth1.GetBlockByNumber(BlockParameter.Latest, true);
TransactionHashBlock earliest = (TransactionHashBlock) _client.Eth1.GetBlockByNumber(BlockParameter.Earliest, false);
Remarks

Returning Block must be cast to TransactionBlock or TransactionHashBlock to access the transaction data.

GetBlockTransactionCountByHash(blockHash) method

The total transactions on a block. See also GetBlockTransactionCountByNumber.

Returns

The number (count) of Transaction.

Parameters

GetBlockTransactionCountByNumber(blockNumber) method

The total transactions on a block. See also GetBlockTransactionCountByHash.

Returns

The number (count) of Transaction.

Parameters

GetChainId() method

Get the Chain which the client is currently connected to.

Returns

The Chain.

Parameters

This method has no parameters.

GetCode(address,blockNumber) method

Smart-Contract bytecode in hexadecimal. If the account is a simple wallet the function will return ‘0x’.

Returns

Smart-Contract bytecode in hexadecimal.

Parameters

GetFilterChangesFromLogs(filterId) method

Retrieve the logs for a certain filter. Logs marks changes of state on the chan for events. Equivalent to GetFilterLogs.

Returns

Array of logs which occurred since last poll.

Parameters
  • System.Int64 filterId - Id returned during the filter creation.
Remarks

Since the return is the since last poll, executing this multiple times changes the state making this a “non-idempotent” getter.

GetFilterLogs(filterId) method

Retrieve the logs for a certain filter. Logs marks changes of state on the blockchain for events. Equivalent to GetFilterChangesFromLogs.

Returns

Array of logs which occurred since last poll.

Parameters
  • System.Int64 filterId - Id returned during the filter creation.
Remarks

Since the return is the Log[] since last poll, executing this multiple times changes the state making this a “non-idempotent” getter.

GetGasPrice() method

The current gas price in Wei (1 ETH equals 1000000000000000000 Wei ).

Returns

The gas price.

Parameters

This method has no parameters.

GetLogs(filter) method

Retrieve the logs for a certain filter. Logs marks changes of state on the blockchain for events. Unlike GetFilterChangesFromLogs or GetFilterLogs this is made to be used in a non-incremental manner (aka no poll) and will return the Logs that satisfy the filter condition.

Returns

Logs that satisfy the filter.

Parameters

GetStorageAt(address,position,blockNumber) method

Stored value in designed position at a given address. Storage can be used to store a smart contract state, constructor or just any data. Each contract consists of a EVM bytecode handling the execution and a storage to save the state of the contract.

Returns

Stored value in designed position.

Parameters

GetTransactionByBlockHashAndIndex(blockHash,index) method

Transactions can be identified by root hash of the transaction merkle tree (this) or by its position in the block transactions merkle tree. Every transaction hash is unique for the whole chain. Collision could in theory happen, chances are 67148E-63%. See also GetTransactionByBlockNumberAndIndex.

Returns

The Transaction (if it exists).

Parameters

GetTransactionByBlockNumberAndIndex(blockNumber,index) method

Transactions can be identified by root hash of the transaction merkle tree (this) or by its position in the block transactions merkle tree. Every transaction hash is unique for the whole chain. Collision could in theory happen, chances are 67148E-63%.

Returns

The Transaction (if it exists).

Parameters

GetTransactionByHash(transactionHash) method

Transactions can be identified by root hash of the transaction merkle tree (this) or by its position in the block transactions merkle tree. Every transaction hash is unique for the whole chain. Collision could in theory happen, chances are 67148E-63%.

Returns

The Transaction (if it exists).

Parameters

GetTransactionCount(address,blockNumber) method

Number of transactions mined from this address. Used to set transaction nonce. Nonce is a value that will make a transaction fail in case it is different from (transaction count + 1). It exists to mitigate replay attacks.

Returns

Number of transactions mined from this address.

Parameters

GetTransactionReceipt(transactionHash) method

After a transaction is received the by the client, it returns the transaction hash. With it, it is possible to gather the receipt, once a miner has mined and it is part of an acknowledged block. Because how it is possible, in distributed systems, that data is asymmetric in different parts of the system, the transaction is only “final” once a certain number of blocks was mined after it, and still it can be possible that the transaction is discarded after some time. But, in general terms, it is accepted that after 6 to 8 blocks from latest, that it is very likely that the transaction will stay in the chain.

Returns

The mined transaction data including event logs.

Parameters

GetUncleByBlockNumberAndIndex(blockNumber,position) method

Retrieve the of uncle of a block for the given blockNumber and a position. Uncle blocks are valid blocks and are mined in a genuine manner, but get rejected from the main blockchain.

Returns

The uncle block.

Parameters

GetUncleCountByBlockHash(blockHash) method

Retrieve the total of uncles of a block for the given blockHash. Uncle blocks are valid blocks and are mined in a genuine manner, but get rejected from the main blockchain. See GetUncleCountByBlockNumber.

Returns

The number of uncles in a block.

Parameters

GetUncleCountByBlockNumber(blockNumber) method

Retrieve the total of uncles of a block for the given blockNumber. Uncle blocks are valid and are mined in a genuine manner, but get rejected from the main blockchain. See GetUncleCountByBlockHash.

Returns

The number of uncles in a block.

Parameters

NewBlockFilter() method

Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call GetFilterChangesFromLogs. Filters are event catchers running on the Ethereum Client. Incubed has a client-side implementation. An event will be stored in case it is within to and from blocks, or in the block of blockhash, contains a transaction to the designed address, and has a word listed on topics.

Returns

The filter id.

Parameters

This method has no parameters.

Remarks

Use the returned filter id to perform other filter operations.

NewLogFilter(filter) method

Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call GetFilterChangesFromLogs. Filters are event catchers running on the Ethereum Client. Incubed has a client-side implementation. An event will be stored in case it is within to and from blocks, or in the block of blockhash, contains a transaction to the designed address, and has a word listed on topics.

Returns

The filter id.

Parameters
Remarks

Use the returned filter id to perform other filter operations.

SendRawTransaction(transactionData) method

Sends a signed and encoded transaction.

Returns

Transaction hash, used to get the receipt and check if the transaction was mined.

Parameters
  • System.String transactionData - Signed keccak hash of the serialized transaction.
Remarks

Client will add the other required fields, gas and chaind id.

SendTransaction(tx) method

Signs and sends the assigned transaction. The Signer used to sign the transaction is the one set by Signer. Transactions change the state of an account, just the balance, or additionally, the storage and the code. Every transaction has a cost, gas, paid in Wei. The transaction gas is calculated over estimated gas times the gas cost, plus an additional miner fee, if the sender wants to be sure that the transaction will be mined in the latest block. See SendTransactionAndWait to wait for the TransactionReceipt in the same call.

Returns

Transaction hash, used to get the receipt and check if the transaction was mined.

Parameters
Example
 SimpleWallet wallet = (SimpleWallet) client.Signer;
 TransactionRequest tx = new TransactionRequest();
 tx.From = wallet.AddRawKey(pk);;
 tx.To = "0x3940256B93c4BE0B1d5931A6A036608c25706B0c";
 tx.Gas = 21000;
 tx.Value = 100000000;
 client.Eth1.SendTransaction(tx);

SendTransactionAndWait(tx) method

Signs and sends the assigned transaction. The Signer used to sign the transaction is the one set by Signer. Transactions change the state of an account, just the balance, or additionally, the storage and the code. Every transaction has a cost, gas, paid in Wei. The transaction gas is calculated over estimated gas times the gas cost, plus an additional miner fee, if the sender wants to be sure that the transaction will be mined in the latest block. In this particular case, the transaction will wait the receipt. See SendTransaction if that is not desirable.

Returns

The receipt associated with the performed transaction.

Parameters
Example
 SimpleWallet wallet = (SimpleWallet) client.Signer;
 TransactionRequest tx = new TransactionRequest();
 tx.From = wallet.AddRawKey(pk);;
 tx.To = "0x3940256B93c4BE0B1d5931A6A036608c25706B0c";
 tx.Gas = 21000;
 tx.Value = 100000000;
 client.Eth1.SendTransactionAndWait(tx);

UninstallFilter(filterId) method

Uninstalls a previously created filter.

Returns

The result of the operation, true on success or false on failure.

Parameters

Get(multihash) method

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

Returns

The content that was stored by Put or Put.

Parameters

Put(content) method

Stores content on ipfs.

Returns

The multihash.

Parameters
  • System.String content - The content that will be stored via ipfs.

Put(content) method

Stores content on ipfs. The content is encoded as base64 before storing.

Returns

The multihash.

Parameters
  • System.Byte[] content - The content that will be stored via ipfs.

BaseConfiguration type

In3.Configuration

Base class for all configuration classes.

Block type

In3.Eth1

Class that represents as Ethereum block.

Author property

The miner of the block.

Difficulty property

Dificulty of the block.

ExtraData property

Extra data.

GasLimit property

Gas limit.

Hash property

The block hash.

LogsBloom property

The logsBloom data of the block.

MixHash property

The mix hash of the block. (only valid of proof of work).

Nonce property

The nonce.

Number property

The index of the block.

ParentHash property

The parent block`s hash.

ReceiptsRoot property

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

Sha3Uncles property

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

Size property

Size of the block.

StateRoot property

The roothash of the merkletree containing the complete state.

Timestamp property

Epoch timestamp when the block was created.

TotalDifficulty property

Total Difficulty as a sum of all difficulties starting from genesis.

TransactionsRoot property

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

Uncles property

List of uncle hashes.

BlockHeader type

In3.Btc

A Block header.

Bits property

Bits (target) for the block as hex.

Chainwork property

Total amount of work since genesis.

Confirmations property

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

Difficulty property

Difficulty of the block.

Hash property

The hash of the blockheader.

Height property

Block number.

Mediantime property

Unix timestamp in seconds since 1970.

Merkleroot property

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

NTx property

Number of transactions in the block.

Nextblockhash property

Hash of the next blockheader.

Nonce property

Nonce-field of the block.

Previousblockhash property

Hash of the parent blockheader.

Time property

Unix timestamp in seconds since 1970.

Version property

Used version.

VersionHex property

Version as hex.

BlockParameter type

In3

Enum-like class that defines constants to be used with Api.

Earliest property

Genesis block.

Latest property

Constant associated with the latest mined block in the chain.

Remarks

While the parameter itself is constant the current “latest” block changes everytime a new block is mined. The result of the operations are also related to ReplaceLatestBlock on ClientConfiguration.

Block`1 type

In3.Btc

A Block.

Size property

Size of this block in bytes.

Tx property

Transactions or Transaction ids of a block. GetBlockWithTxData or GetBlockWithTxIds.

Weight property

Weight of this block in bytes.

Chain type

In3

Represents the multiple chains supported by Incubed.

Btc constants

Bitcoin chain.

Evan constants

Evan testnet.

Ewc constants

Ewf chain.

Goerli constants

Goerli testnet.

Ipfs constants

Ipfs (InterPlanetary File System).

Local constants

Local client.

Mainnet constants

Ethereum mainnet.

Multichain constants

Support for multiple chains, a client can then switch between different chains (but consumes more memory).

Tobalaba constants

Tobalaba testnet.

Volta constants

Volta testnet.

ChainConfiguration type

In3.Configuration

Class that represents part of the configuration to be applied on the IN3 (in particular to each chain). This is a child of ClientConfiguration and have many NodeConfiguration.

#ctor(chain,clientConfiguration) constructor

Constructor.

Parameters
Example
ChainConfiguration goerliConfiguration = new ChainConfiguration(Chain.Goerli, in3Client.Configuration);

Contract property

Incubed registry contract from which the list was taken.

NeedsUpdate property

Preemptively update the node list.

NodesConfiguration property

Getter for the list of elements that represent the configuration for each node.

Remarks

This is a read-only property. To add configuration for nodes, Use NodeConfiguration constructor.

RegistryId property

Uuid of this incubed network. one chain could contain more than one incubed networks.

WhiteList property

Node addresses that constitute the white list of nodes.

WhiteListContract property

Address of whiteList contract.

ClientConfiguration type

In3.Configuration

Class that represents the configuration to be applied on IN3. Due to the 1-to-1 relationship with the client, this class should never be instantiated. To obtain a reference of the client configuration use Configuration instead.

Remarks

Use in conjunction with ChainConfiguration and NodeConfiguration.

AutoUpdateList property

If true the nodelist will be automatically updated. False may compromise data security.

BootWeights property

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.

ChainsConfiguration property

Configuration for the chains. Read-only attribute.

Finality property

Remarks

Beware that the semantics of the values change greatly from chain to chain. The value of 8 would mean 8 blocks mined on top of the requested one while with the POW algorithm while, for POA, it would mean 8% of validators.

IncludeCode property

Code is included when sending eth_call-requests.

KeepIn3 property

Tthe in3-section (custom node on the RPC call) with the proof will also returned.

MaxAttempts property

Maximum times the client will retry to contact a certain node.

MinDeposit property

Only nodes owning at least this amount will be chosen to sign responses to your requests.

NodeLimit property

Limit nodes stored in the client.

NodeProps property

Props define the capabilities of the nodes. Accepts a combination of values.

Example
clientConfiguration.NodeProps = Props.NodePropProof | Props.NodePropArchive;

Proof property

One of Proof. Full gets the whole block Patricia-Merkle-Tree, Standard only verifies the specific tree branch concerning the request, None only verifies the root hashes, like a light-client does.

ReplaceLatestBlock property

Distance considered safe, consensus wise, from the very latest block. Higher values exponentially increases state finality, and therefore data security, as well guaranteeded responses from in3 nodes.

RequestCount property

Useful when SignatureCount is less then 1. The client will check for consensus in responses.

Rpc property

Setup an custom rpc source for requests by setting chain to Local and proof to None.

SignatureCount property

Node signatures attesting the response to your request. Will send a separate request for each.

Example

When set to 3, 3 nodes will have to sign the response.

Timeout property

Milliseconds before a request times out.

UseHttp property

Disable ssl on the Http connection.

Context type

In3.Context

Acts as the main orchestrator for the execution of an rpc. Holds a reference to the native context (ctx) and wraps behavior around it.

#ctor(ctx,nativeClient) constructor

Standard constructor, private so people use FromRpc.

Parameters

CreateNativeCtx(nativeIn3Ptr,rpc) method

Method to manage the creation of the native ctx request.

Returns

Native rpc pointer

Parameters
Exceptions

| Name | Description |

| In3.Error.ContextException | |

Dispose() method

Destructor method for the native ctx encapsulated by the Context object.

Parameters

This method has no parameters.

Execute() method

Proxy to in3_req_execute, every invocation generates a new state.

Returns

The state as computed by in3_req_execute.

Parameters

This method has no parameters.

FromRpc(wrapper,rpc) method

Factory-like method to build a Context object from an rpc request.

Returns

An instance of context.

Parameters

GetErrorMessage() method

Retrieve the error result on the context.

Returns

A string describing the encountered error.

Parameters

This method has no parameters.

GetLastWaiting() method

Method responsible to fetch the pending context references in the current context.

Returns

A context object.

Parameters

This method has no parameters.

GetResponse() method

Method to get the consolidated response of a request.

Returns

The final result.

Parameters

This method has no parameters.

GetType() method

Method to get the consolidated response of a request.

Returns

The final result.

Parameters

This method has no parameters.

HandleRequest() method

Handle rpc request in an asynchronous manner.

Parameters

This method has no parameters.

HandleSign() method

Handle signing request in an asynchronous manner.

Parameters

This method has no parameters.

IsValid() method

Conditional to verify if the encapsulated pointer actually points to something.

Returns

if its valid, false if it is not.

Parameters

This method has no parameters.

ReportError() method

Setter for the error on the current context. Proxies it to the native context.

Parameters

This method has no parameters.

ContextException type

In3.Error

Exception thrown when there is an issue with the Context engine.

DataTypeConverter type

In3.Utils

General util class for conversion between blockchain types.

HexStringToBigint(source) method

Converts a zero-prefixed hex (e.g.: 0x05) to BigInteger

Returns

The number representation of source.

Parameters

DefaultTransport type

In3.Transport

Basic implementation for synchronous http transport for Incubed client.

#ctor() constructor

Standard construction.

Parameters

This constructor has no parameters.

Handle(url,payload) method

Method that handles, sychronously the http requests.

Returns

The http json response.

Parameters

ENSParameter type

In3

Defines the kind of entity associated with the ENS Resolved. Used along with Ens.

Addr property

Address.

Hash property

Hash.

Owner property

Owner.

Resolver property

Resolver.

IN3 type

In3

Incubed network client. Connect to the blockchain via a list of bootnodes, then gets the latest list of nodes in the network and ask a certain number of the to sign the block header of given list, putting their deposit at stake. Once with the latest list at hand, the client can request any other on-chain information using the same scheme.

#ctor(chainId) constructor

Standard constructor, use ForChain instead.

Parameters
  • In3.Chain chainId - The chainId to connect to.

Btc property

Gets Api object.

Configuration property

Gets ClientConfiguration object. Any changes in the object will be automaticaly applied to the client before each method invocation.

Crypto property

Gets Api object.

Eth1 property

Gets Api object.

Ipfs property

Gets Api object.

Signer property

Get or Sets Signer object. If not set SimpleWallet will be used.

Storage property

Get or Sets Storage object. If not set InMemoryStorage will be used.

Transport property

Gets or sets Transport object. If not set DefaultTransport will be used.

Finalize() method

Finalizer for the client.

Parameters

This method has no parameters.

ForChain(chain) method

Creates a new instance of IN3.

Returns

An Incubed instance.

Parameters
Example
IN3 client = IN3.ForChain(Chain.Mainnet);

SendRpc(method,args,in3) method

Method used to communicate with the client. In general, its preferably to use the API.

Returns

The result of the Rpc operation as JSON.

Parameters

In3Exception type

In3.Error

General purpose, all-encompassing, Incubed specific Exception class.

InMemoryStorage type

In3.Storage

Default implementation of Storage. It caches all cacheable data in memory.

#ctor() constructor

Standard constructor.

Parameters

This constructor has no parameters.

Clear() method

Empty the in-memory cache.

Returns

Result for the clear operation.

Parameters

This method has no parameters.

GetItem(key) method

Fetches the data from memory.

Returns

The cached value as a byte[].

Parameters

SetItem(key,content) method

Stores a value in memory for a given key.

Parameters
  • System.String key - A unique identifier for the data that is being cached.
  • System.Byte[] content - The value that is being cached.

InvalidSignerException type

In3.Error

Exception thrown when there is no available Signer to sign.

InvalidTransactionRequestException type

In3.Error

Exception thrown when the state of TransactionRequest is invalid.

Log type

In3.Eth1

Logs marks changes of state on the blockchain for events. The Log is a data object with information from logs.

Address property

Address from which this log originated.

BlockHash property

Hash of the block this log was in. null when its pending log.

BlockNumber property

Number of the block this log was in.

Data property

Data associated with the log.

LogIndex property

Index position in the block.

Removed property

Flags log removal (due to chain reorganization).

Topics property

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).

TransactionHash property

Hash of the transactions this log was created from. null when its pending log.

TransactionIndex property

index position log was created from.

Type property

Address from which this log originated.

LogFilter type

In3.Eth1

Filter configuration for search logs. To be used along with the Api filter and methods.

#ctor() constructor

Standard constructor.

Parameters

This constructor has no parameters.

Address property

Address for the filter.

BlockHash property

Blcok hash of the filtered blocks.

Remarks

If present, FromBlock and ToBlock will be ignored.

FromBlock property

Starting block for the filter.

ToBlock property

End block for the filter.

Topics property

Array of 32 Bytes Data topics. Topics are order-dependent. It’s possible to pass in null to match any topic, or a subarray of multiple topics of which one should be matching.

NodeConfiguration type

In3.Configuration

Class that represents part of the configuration to be applied on the IN3 (in particular to each boot node). This is a child of ChainConfiguration.

#ctor(config) constructor

Constructor for the node configuration.

Parameters
Example
NodeConfiguration myDeployedNode = new NodeConfiguration(mainnetChainConfiguration);

Address property

Address of the node, which is the public address it is signing with.

Props property

Props define the capabilities of the node. Accepts a combination of values.

Example
nodeConfiguration.Props = Props.NodePropProof | Props.NodePropArchive;

Url property

Url of the bootnode which the client can connect to.

Proof type

In3.Configuration

Alias for verification levels. Verification is done by calculating Ethereum Trie states requested by the Incubed network ans signed as proofs of a certain state.

Full property

All fields will be validated (including uncles).

None property

No Verification.

Standard property

Standard Verification of the important properties.

Props type

In3.Configuration

Enum that defines the capabilities an incubed node.

NodePropArchive constants

filter out non-archive supporting nodes.

NodePropBinary constants

filter out nodes that don’t support binary encoding.

NodePropData constants

filter out non-data provider nodes.

NodePropHttp constants

filter out non-http nodes.

NodePropMinblockheight constants

filter out nodes that will sign blocks with lower min block height than specified.

NodePropMultichain constants

filter out nodes other then which have capability of the same RPC endpoint may also accept requests for different chains.

NodePropOnion constants

filter out non-onion nodes.

NodePropProof constants

filter out nodes which are providing no proof.

NodePropSigner constants

filter out non-signer nodes.

NodePropStats constants

filter out nodes that do not provide stats.

RpcException type

In3.Error

Custom Exception to be thrown in case of Rpc errors.

Code property

Json-rpc code for the error.

ScriptPubKey type

In3.Btc

Script on a transaction output.

Addresses property

List of addresses.

Asm property

The asm data,

Hex property

The raw hex data.

ReqSigs property

The required sigs.

Type property

The type.

Example

pubkeyhash

ScriptSig type

In3.Btc

Script on a transaction input.

Asm property

The asm data.

Hex property

The raw hex data.

SignatureType type

In3.Crypto

Group of constants to be used along with the methods of Api.

EthSign property

For hashes of the RLP prefixed.

Hash property

For data that was hashed and then signed.

Raw property

For data that was signed directly.

SignedData type

In3.Crypto

Output of SignData.

Message property

Signed message.

MessageHash property

Hash of (Message.

R property

Part of the ECDSA signature.

S property

Part of the ECDSA signature.

Signature property

ECDSA calculated r, s, and parity v, concatenated.

V property

27 + (R % 2).

Signer type

In3.Crypto

Minimum interface to be implemented by a kind of signer. Used by SendTransaction. Set it with Signer.

CanSign(account) method

Queries the Signer if it can sign for a certain key.

Returns

true if it can sign, false if it cant.

Parameters
  • System.String account - The account derived from the private key used to sign transactions.
Remarks

This method is invoked internaly by SendTransaction using From and will throw a SystemException in case false is returned.

PrepareTransaction() method

Optional method which allows to change the transaction-data before sending it. This can be used for redirecting it through a multisig. Invoked just before sending a transaction through SendTransaction.

Returns

Modified transaction request.

Parameters

This method has no parameters.

Sign(data,account) method

Signs the transaction data with the private key associated with the invoked account. Both arguments are automaticaly passed by Incubed client base on TransactionRequest data during a SendTransaction.

Returns

The signed transaction data.

Parameters

SimpleWallet type

In3.Crypto

Default implementation of the Signer. Works as an orchestration of the in order to manage multiple accounts.

#ctor(in3) constructor

Basic constructor.

Parameters

AddRawKey(privateKey) method

Adds a private key to be managed by the wallet and sign transactions.

Returns

The address derived from the privateKey

Parameters
  • System.String privateKey - The private key to be stored by the wallet.

CanSign(address) method

Check if this address is managed by this wallet.

Returns

true if the address is managed by this wallter, false if not.

Parameters

PrepareTransaction(tx) method

Identity function-like method.

Returns

tx

Parameters

Sign(data,address) method

Signs the transaction data by invoking SignData.

Returns

Signed transaction data.

Parameters

Storage type

In3.Storage

Provider methods to cache data. These data could be nodelists, contract codes or validator changes. Any form of cache should implement Storage and be set with Storage.

Clear() method

Clear the cache.

Returns

The result of the operation: true for success and false for failure.

Parameters

This method has no parameters.

GetItem(key) method

returns a item from cache.

Returns

The bytes or null if not found.

Parameters

SetItem(key,content) method

Stores an item to cache.

Parameters

Transaction type

In3.Btc

A BitCoin Transaction.

Transaction type

In3.Eth1

Class representing a transaction that was accepted by the Ethereum chain.

Blockhash property

The block hash of the block containing this transaction.

Blocktime property

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

Confirmations property

The confirmations.

Hash property

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

Hex property

The hex representation of raw data.

Locktime property

The locktime.

Size property

The serialized transaction size.

Time property

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

Txid property

Transaction Id.

Version property

The version.

Vin property

The transaction inputs.

Vout property

The transaction outputs.

Vsize property

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

Weight property

The transaction’s weight (between vsize4-3 and vsize4).

BlockHash property

Hash of the block that this transaction belongs to.

BlockNumber property

Number of the block that this transaction belongs to.

ChainId property

Chain id that this transaction belongs to.

Creates property

Address of the deployed contract (if successfull).

From property

Address whose private key signed this transaction with.

Gas property

Gas for the transaction.

GasPrice property

Gas price (in wei) for each unit of gas.

Hash property

Transaction hash.

Input property

Transaction data.

Nonce property

Nonce for this transaction.

PublicKey property

Public key.

R property

Part of the transaction signature.

Raw property

Transaction as rlp encoded data.

S property

Part of the transaction signature.

StandardV property

Part of the transaction signature. V is parity set by v = 27 + (r % 2).

To property

To address of the transaction.

TransactionIndex property

Transaction index.

V property

The StandardV plus the chain.

Value property

Value of the transaction.

TransactionBlock type

In3.Eth1

Class that holds a block with its full transaction array: Transaction.

Transactions property

Array with the full transactions containing on this block.

Remarks

Returned when shouldIncludeTransactions on Api get block methods are set to true.

TransactionHashBlock type

In3.Eth1

Class that holds a block with its transaction hash array.

Transactions property

Array with the full transactions containing on this block.

Remarks

Returned when shouldIncludeTransactions on Api get block methods are set to false.

TransactionInput type

In3.Btc

Input of a transaction.

ScriptSig property

The script.

Sequence property

The script sequence number.

Txid property

The transaction id.

Txinwitness property

Hex-encoded witness data (if any).

Yout property

The index of the transactionoutput.

TransactionOutput type

In3.Btc

Output of a transaction.

N property

The index in the transaction.

ScriptPubKey property

The script of the transaction.

Value property

The value in bitcoins.

TransactionReceipt type

In3.Eth1

Class that represents a transaction receipt. See GetTransactionReceipt.

BlockHash property

Hash of the block with the transaction which this receipt is associated with.

BlockNumber property

Number of the block with the transaction which this receipt is associated with.

ContractAddress property

Address of the smart contract invoked in the transaction (if any).

From property

Address of the account that signed the transaction.

GasUsed property

Gas used on this transaction.

Logs property

Logs/events for this transaction.

LogsBloom property

A bloom filter of logs/events generated by contracts during transaction execution. Used to efficiently rule out transactions without expected logs.

Root property

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

Status property

Status of the transaction.

To property

Address whose value will be transfered to.

TransactionHash property

Hash of the transaction.

TransactionIndex property

Number of the transaction on the block.

TransactionRequest type

In3.Eth1

Class that holds the state for the transaction request to be submited via SendTransaction.

Data property

Data of the transaction (in the case of a smart contract deployment for exemple).

From property

Address derivated from the private key that will sign the transaction. See Signer.

Function property

Function of the smart contract to be invoked.

Gas property

Gas cost for the transaction. Can be estimated via EstimateGas.

GasPrice property

Gas price (in wei). Can be obtained via GetGasPrice.

Nonce property

Nonce of the transaction.

Params property

Array of parameters for the function (in the same order of its signature), see Function

To property

Address to whom the transaction value will be transfered to or the smart contract address whose function will be invoked.

Value property

Value of the transaction.

Transport type

In3.Transport

Minimum interface for a custom transport. Transport is a mean of communication with the Incubed server.

Handle(url,payload) method

Method to be implemented that will handle the requests to the server. This method may be called once for each url on each batch of requests.

Returns

The rpc response.

Parameters

Examples

CallSmartContractFunction

source : in3-c/dotnet/Examples/CallSmartContractFunction//CallSmartContractFunction

using System;
using System.Numerics;
using System.Threading.Tasks;
using In3;
using In3.Configuration;
using In3.Eth1;
using In3.Utils;

namespace CallSmartContractFunction
{
    public class Program
    {
        public static async Task Main()
        {
            // Set it to mainnet
            IN3 mainnetClient = IN3.ForChain(Chain.Mainnet);
            ClientConfiguration cfg = mainnetClient.Configuration;
            cfg.Proof = Proof.Standard;

            string contractAddress = "0x2736D225f85740f42D17987100dc8d58e9e16252";

            // Create the query transaction
            TransactionRequest serverCountQuery = new TransactionRequest();
            serverCountQuery.To = contractAddress;

            // Define the function and the parameters to query the total in3 servers
            serverCountQuery.Function = "totalServers():uint256";
            serverCountQuery.Params = new object[0];

            string[] serverCountResult = (string[])await mainnetClient.Eth1.Call(serverCountQuery, BlockParameter.Latest);
            BigInteger servers = DataTypeConverter.HexStringToBigint(serverCountResult[0]);

            for (int i = 0; i < servers; i++)
            {
                TransactionRequest serverDetailQuery = new TransactionRequest();
                serverDetailQuery.To = contractAddress;

                // Define the function and the parameters to query the in3 servers detail
                serverDetailQuery.Function = "servers(uint256):(string,address,uint32,uint256,uint256,address)";
                serverDetailQuery.Params = new object[] { i }; // index of the server (uint256) as per solidity function signature

                string[] serverDetailResult = (string[])await mainnetClient.Eth1.Call(serverDetailQuery, BlockParameter.Latest);
                Console.Out.WriteLine($"Server url: {serverDetailResult[0]}");
            }
        }
    }
}

ConnectToEthereum

source : in3-c/dotnet/Examples/ConnectToEthereum//ConnectToEthereum

using System;
using System.Numerics;
using System.Threading.Tasks;
using In3;

namespace ConnectToEthereum
{
    class Program
    {
        static async Task Main()
        {
            Console.Out.WriteLine("Ethereum Main Network");
            IN3 mainnetClient = IN3.ForChain(Chain.Mainnet);
            BigInteger mainnetLatest = await mainnetClient.Eth1.BlockNumber();
            BigInteger mainnetCurrentGasPrice = await mainnetClient.Eth1.GetGasPrice();
            Console.Out.WriteLine($"Latest Block Number: {mainnetLatest}");
            Console.Out.WriteLine($"Gas Price: {mainnetCurrentGasPrice} Wei");

            Console.Out.WriteLine("Ethereum EWC Network");
            IN3 ewcClient = IN3.ForChain(Chain.Ewc);
            BigInteger ewcLatest = await ewcClient.Eth1.BlockNumber();
            BigInteger ewcCurrentGasPrice = await ewcClient.Eth1.GetGasPrice();
            Console.Out.WriteLine($"Latest Block Number: {ewcLatest}");
            Console.Out.WriteLine($"Gas Price: {ewcCurrentGasPrice} Wei");

            Console.Out.WriteLine("Ethereum Goerli Test Network");
            IN3 goerliClient = IN3.ForChain(Chain.Goerli);
            BigInteger goerliLatest = await goerliClient.Eth1.BlockNumber();
            BigInteger clientCurrentGasPrice = await goerliClient.Eth1.GetGasPrice();
            Console.Out.WriteLine($"Latest Block Number: {goerliLatest}");
            Console.Out.WriteLine($"Gas Price: {clientCurrentGasPrice} Wei");
        }
    }
}

EnsResolver

source : in3-c/dotnet/Examples/EnsResolver//EnsResolver

using System;
using System.Threading.Tasks;
using In3;

namespace EnsResolver
{
    public class Program
    {
        static async Task Main()
        {
            IN3 in3 = IN3.ForChain(Chain.Mainnet);

            string cryptoKittiesDomain = "cryptokitties.eth";
            string resolver = await in3.Eth1.Ens(cryptoKittiesDomain, ENSParameter.Resolver);
            string owner = await in3.Eth1.Ens(cryptoKittiesDomain, ENSParameter.Owner);

            Console.Out.WriteLine($"The owner of {cryptoKittiesDomain} is {owner}, resolver is {resolver}.");
        }
    }
}

Ipfs

source : in3-c/dotnet/Examples/Ipfs//Ipfs

using System;
using System.Text;
using System.Threading.Tasks;
using In3;

namespace Ipfs
{
    class Program
    {
        static async Task Main()
        {
            // Content to be stored
            string toStore = "LOREM_IPSUM";

            // Connect to ipfs.
            IN3 ipfsClient = IN3.ForChain(Chain.Ipfs);

            // Store the hash since it will be needed to fetch the content back.
            string hash = await ipfsClient.Ipfs.Put(toStore);

            //
            byte[] storedBytes = await ipfsClient.Ipfs.Get(hash);
            string storedStging = Encoding.UTF8.GetString(storedBytes, 0, storedBytes.Length);
            Console.Out.WriteLine($"The stored string is: {storedStging}");
        }
    }
}

Logs

source : in3-c/dotnet/Examples/Logs//Logs

using System;
using System.Threading;
using System.Threading.Tasks;
using In3;
using In3.Eth1;

namespace Logs
{
    class Program
    {
        static async Task Main()
        {
            // Define an upper limit for poll since we dont want our application potentially running forever.
            int maxIterations = 500;
            int oneSecond = 1000; // in ms

            // Connect to mainnet.
            IN3 mainnetClient = IN3.ForChain(Chain.Mainnet);

            // Create a filter object pointing, in this case, to an "eventful" contract address.
            LogFilter tetherUsFilter = new LogFilter {Address = "0xdAC17F958D2ee523a2206206994597C13D831ec7"};

            // Create the filter to be polled for logs.
            long filterId = await mainnetClient.Eth1.NewLogFilter(tetherUsFilter);

            // Loop to initiate the poll for the logs.
            for (int i = 0; i < maxIterations; i++)
            {
                // Query for the log events since the creation of the filter or the previous poll (this method in NOT idempotent as it retrieves a diff).
                Log[] tetherLogs = await mainnetClient.Eth1.GetFilterChangesFromLogs(filterId);
                if (tetherLogs.Length > 0)
                {
                    Console.Out.WriteLine("Logs found: " + tetherLogs.Length);
                    break;
                }

                // Wait before next query.
                Thread.Sleep(oneSecond);
            }
        }
    }
}

SendTransaction

source : in3-c/dotnet/Examples/SendTransaction//SendTransaction

using System;
using System.Threading;
using System.Threading.Tasks;
using In3;
using In3.Crypto;
using In3.Eth1;

namespace SendTransaction
{
    public class Program
    {
        static async Task Main()
        {
            IN3 goerliClient = IN3.ForChain(Chain.Goerli);

            string myPrivateKey = "0x0829B3C639A3A8F2226C8057F100128D4F7AE8102C92048BA6DE38CF4D3BC6F1";
            string receivingAddress = "0x6FA33809667A99A805b610C49EE2042863b1bb83";

            // Get the wallet, which is the default signer.
            SimpleWallet myAccountWallet = (SimpleWallet)goerliClient.Signer;

            string myAccount = myAccountWallet.AddRawKey(myPrivateKey);

            // Create the transaction request
            TransactionRequest transferWei = new TransactionRequest();
            transferWei.To = receivingAddress;
            transferWei.From = myAccount;
            transferWei.Value = 300;

            // Get the current gas prices
            long currentGasPrice = await goerliClient.Eth1.GetGasPrice();
            transferWei.GasPrice = currentGasPrice;

            long estimatedSpentGas = await goerliClient.Eth1.EstimateGas(transferWei, BlockParameter.Latest);
            Console.Out.WriteLine($"Estimated gas to spend: {estimatedSpentGas}");

            string transactionHash = await goerliClient.Eth1.SendTransaction(transferWei);
            Console.Out.WriteLine($"Transaction {transactionHash} sent.");
            Thread.Sleep(30000);

            TransactionReceipt receipt = await goerliClient.Eth1.GetTransactionReceipt(transactionHash);
            Console.Out.WriteLine($"Transaction {transactionHash} mined on block {receipt.BlockNumber}.");
        }
    }
}

Build Examples

To setup and run the example projects, simply run on the respective project folder:

dotnet run

To build all of them, on the solution folder, run:

dotnet build

Index

Account type

In3.Crypto

Composite entity that holds address and public key. It represents and Ethereum acount. Entity returned from EcRecover.

Address property

The address.

PublicKey property

The public key.

Api type

In3.Btc

API for handling BitCoin data. Use it when connected to Btc.

Api type

In3.Crypto

Class that exposes utility methods for cryptographic utilities. Relies on IN3 functionality.

Api type

In3.Eth1

Module based on Ethereum’s api and web3. Works as a general parent for all Ethereum-specific operations.

Api type

In3.Ipfs

API for ipfs realted methods. To be used along with Ipfs on IN3. Ipfs stands for and is a peer-to-peer hypermedia protocol designed to make the web faster, safer, and more open.

GetBlockBytes(blockHash) method

Retrieves the serialized block in bytes.

Returns

The bytes of the block.

Parameters
Example
byte[] blockBytes = in3.Btc.GetBlockBytes("000000000000000000064ba7512ecc70cabd7ed17e31c06f2205d5ecdadd6d22");

GetBlockHeader(blockHash) method

Retrieves the blockheader.

Returns

The Block header.

Parameters
Example
BlockHeader header = in3.Btc.GetBlockHeader("0000000000000000000cd3c5d7638014e78a5fba33be5fa5cb10ef9f03d99e60");

GetBlockHeaderBytes(blockHash) method

Retrieves the byte array representing teh serialized blockheader data.

Returns

The Block header in bytes.

Parameters
Example
byte[] header = in3.Btc.GetBlockHeaderBytes("0000000000000000000cd3c5d7638014e78a5fba33be5fa5cb10ef9f03d99e60");

GetBlockWithTxData(blockHash) method

Retrieves the block including the full transaction data. Use GetBlockWithTxIds for only the transaction ids.

Returns

The block of type Block`1.

Parameters
Example
Block{Transaction} block = in3.Btc.GetBlockWithTxData("000000000000000000064ba7512ecc70cabd7ed17e31c06f2205d5ecdadd6d22");
Transaction t1 = block.Tx[0];

GetBlockWithTxIds(blockHash) method

Retrieves the block including only transaction ids. Use GetBlockWithTxData for the full transaction data.

Returns

The block of type Block`1.

Parameters
Example
Block{string} block = in3.Btc.GetBlockWithTxIds("000000000000000000064ba7512ecc70cabd7ed17e31c06f2205d5ecdadd6d22");
string t1 = block.Tx[0];

GetTransaction(txid) method

Retrieves the transaction and returns the data as json.

Returns

The transaction object.

Parameters
Example
Transaction desiredTransaction = in3.Btc.GetTransaction("1427c7d1698e61afe061950226f1c149990b8c1e1b157320b0c4acf7d6b5605d");

GetTransactionBytes(txid) method

Retrieves the serialized transaction (bytes).

Returns

The byte array for the Transaction.

Parameters
Example
byte[] serializedTransaction = in3.Btc.GetTransactionBytes("1427c7d1698e61afe061950226f1c149990b8c1e1b157320b0c4acf7d6b5605d");

DecryptKey(pk,passphrase) method

Decryot an encrypted private key.

Returns

Decrypted key.

Parameters

EcRecover(signedData,signature,signatureType) method

Recovers the account associated with the signed data.

Returns

The account.

Parameters

Pk2Address(pk) method

Derives an address from the given private (pk) key using SHA-3 algorithm.

Returns

The address.

Parameters

Pk2Public(pk) method

Derives public key from the given private (pk) key using SHA-3 algorithm.

Returns

The public key.

Parameters

Sha3(data) method

Hash the input data using sha3 algorithm.

Returns

Hashed output.

Parameters

SignData(msg,pk,sigType) method

Signs the data msg with a given private key. Refer to SignedData for more information.

Returns

The signed data.

Parameters

AbiDecode(signature,encodedData) method

ABI decoder. Used to parse rpc responses from the EVM. Based on the Solidity specification .

Returns

The decoded argugments for the function call given the encded data.

Parameters
  • System.String signature - Function signature i.e. or . In case of the latter, the function signature will be ignored and only the return types will be parsed.
  • System.String encodedData - Abi encoded values. Usually the string returned from a rpc to the EVM.

AbiEncode(signature,args) method

ABI encoder. Used to serialize a rpc to the EVM. Based on the Solidity specification . Note: Parameters refers to the list of variables in a method declaration. Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the arguments used must match the declaration’s parameters in type and order.

Returns

The encoded data.

Parameters
  • System.String signature - Function signature, with parameters. i.e. , can contain the return types but will be ignored.
  • System.Object[] args - Function parameters, in the same order as in passed on to .

BlockNumber() method

Returns the number of the most recent block the in3 network can collect signatures to verify. Can be changed by ReplaceLatestBlock. If you need the very latest block, change SignatureCount to 0.

Returns

The number of the block.

Parameters

This method has no parameters.

Call(request,blockNumber) method

Calls a smart-contract method. Will be executed locally by Incubed’s EVM or signed and sent over to save the state changes. Check https://ethereum.stackexchange.com/questions/3514/how-to-call-a-contract-method-using-the-eth-call-json-rpc-api for more.

Returns

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

Parameters

ChecksumAddress(address,shouldUseChainId) method

Will convert an upper or lowercase Ethereum address to a checksum address, that uses case to encode values. See EIP55.

Returns

EIP-55 compliant, mixed-case address.

Parameters

Ens(name,type) method

Resolves ENS domain name.

Returns

The resolved entity for the domain.

Parameters
Remarks

The actual semantics of the returning value changes according to type.

EstimateGas(request,blockNumber) method

Gas estimation for transaction. Used to fill transaction.gas field. Check RawTransaction docs for more on gas.

Returns

Estimated gas in Wei.

Parameters

GetBalance(address,blockNumber) method

Returns the balance of the account of given address.

Returns

The current balance in wei.

Parameters

GetBlockByHash(blockHash,shouldIncludeTransactions) method

Blocks can be identified by root hash of the block merkle tree (this), or sequential number in which it was mined GetBlockByNumber.

Returns

The Block of the requested (if exists).

Parameters
  • System.String blockHash - Desired block hash.
  • System.Boolean shouldIncludeTransactions - If true, returns the full transaction objects, otherwise only its hashes. The default value is false.
Remarks

Returning Block must be cast to TransactionBlock or TransactionHashBlock to access the transaction data.

GetBlockByNumber(blockNumber,shouldIncludeTransactions) method

Blocks can be identified by sequential number in which it was mined, or root hash of the block merkle tree GetBlockByHash.

Returns

The Block of the requested (if exists).

Parameters
Example
TransactionBlock latest = (TransactionBlock) _client.Eth1.GetBlockByNumber(BlockParameter.Latest, true);
TransactionHashBlock earliest = (TransactionHashBlock) _client.Eth1.GetBlockByNumber(BlockParameter.Earliest, false);
Remarks

Returning Block must be cast to TransactionBlock or TransactionHashBlock to access the transaction data.

GetBlockTransactionCountByHash(blockHash) method

The total transactions on a block. See also GetBlockTransactionCountByNumber.

Returns

The number (count) of Transaction.

Parameters

GetBlockTransactionCountByNumber(blockNumber) method

The total transactions on a block. See also GetBlockTransactionCountByHash.

Returns

The number (count) of Transaction.

Parameters

GetChainId() method

Get the Chain which the client is currently connected to.

Returns

The Chain.

Parameters

This method has no parameters.

GetCode(address,blockNumber) method

Smart-Contract bytecode in hexadecimal. If the account is a simple wallet the function will return ‘0x’.

Returns

Smart-Contract bytecode in hexadecimal.

Parameters

GetFilterChangesFromLogs(filterId) method

Retrieve the logs for a certain filter. Logs marks changes of state on the chan for events. Equivalent to GetFilterLogs.

Returns

Array of logs which occurred since last poll.

Parameters
  • System.Int64 filterId - Id returned during the filter creation.
Remarks

Since the return is the since last poll, executing this multiple times changes the state making this a “non-idempotent” getter.

GetFilterLogs(filterId) method

Retrieve the logs for a certain filter. Logs marks changes of state on the blockchain for events. Equivalent to GetFilterChangesFromLogs.

Returns

Array of logs which occurred since last poll.

Parameters
  • System.Int64 filterId - Id returned during the filter creation.
Remarks

Since the return is the Log[] since last poll, executing this multiple times changes the state making this a “non-idempotent” getter.

GetGasPrice() method

The current gas price in Wei (1 ETH equals 1000000000000000000 Wei ).

Returns

The gas price.

Parameters

This method has no parameters.

GetLogs(filter) method

Retrieve the logs for a certain filter. Logs marks changes of state on the blockchain for events. Unlike GetFilterChangesFromLogs or GetFilterLogs this is made to be used in a non-incremental manner (aka no poll) and will return the Logs that satisfy the filter condition.

Returns

Logs that satisfy the filter.

Parameters

GetStorageAt(address,position,blockNumber) method

Stored value in designed position at a given address. Storage can be used to store a smart contract state, constructor or just any data. Each contract consists of a EVM bytecode handling the execution and a storage to save the state of the contract.

Returns

Stored value in designed position.

Parameters

GetTransactionByBlockHashAndIndex(blockHash,index) method

Transactions can be identified by root hash of the transaction merkle tree (this) or by its position in the block transactions merkle tree. Every transaction hash is unique for the whole chain. Collision could in theory happen, chances are 67148E-63%. See also GetTransactionByBlockNumberAndIndex.

Returns

The Transaction (if it exists).

Parameters

GetTransactionByBlockNumberAndIndex(blockNumber,index) method

Transactions can be identified by root hash of the transaction merkle tree (this) or by its position in the block transactions merkle tree. Every transaction hash is unique for the whole chain. Collision could in theory happen, chances are 67148E-63%.

Returns

The Transaction (if it exists).

Parameters

GetTransactionByHash(transactionHash) method

Transactions can be identified by root hash of the transaction merkle tree (this) or by its position in the block transactions merkle tree. Every transaction hash is unique for the whole chain. Collision could in theory happen, chances are 67148E-63%.

Returns

The Transaction (if it exists).

Parameters

GetTransactionCount(address,blockNumber) method

Number of transactions mined from this address. Used to set transaction nonce. Nonce is a value that will make a transaction fail in case it is different from (transaction count + 1). It exists to mitigate replay attacks.

Returns

Number of transactions mined from this address.

Parameters

GetTransactionReceipt(transactionHash) method

After a transaction is received the by the client, it returns the transaction hash. With it, it is possible to gather the receipt, once a miner has mined and it is part of an acknowledged block. Because how it is possible, in distributed systems, that data is asymmetric in different parts of the system, the transaction is only “final” once a certain number of blocks was mined after it, and still it can be possible that the transaction is discarded after some time. But, in general terms, it is accepted that after 6 to 8 blocks from latest, that it is very likely that the transaction will stay in the chain.

Returns

The mined transaction data including event logs.

Parameters

GetUncleByBlockNumberAndIndex(blockNumber,position) method

Retrieve the of uncle of a block for the given blockNumber and a position. Uncle blocks are valid blocks and are mined in a genuine manner, but get rejected from the main blockchain.

Returns

The uncle block.

Parameters

GetUncleCountByBlockHash(blockHash) method

Retrieve the total of uncles of a block for the given blockHash. Uncle blocks are valid blocks and are mined in a genuine manner, but get rejected from the main blockchain. See GetUncleCountByBlockNumber.

Returns

The number of uncles in a block.

Parameters

GetUncleCountByBlockNumber(blockNumber) method

Retrieve the total of uncles of a block for the given blockNumber. Uncle blocks are valid and are mined in a genuine manner, but get rejected from the main blockchain. See GetUncleCountByBlockHash.

Returns

The number of uncles in a block.

Parameters

NewBlockFilter() method

Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call GetFilterChangesFromLogs. Filters are event catchers running on the Ethereum Client. Incubed has a client-side implementation. An event will be stored in case it is within to and from blocks, or in the block of blockhash, contains a transaction to the designed address, and has a word listed on topics.

Returns

The filter id.

Parameters

This method has no parameters.

Remarks

Use the returned filter id to perform other filter operations.

NewLogFilter(filter) method

Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call GetFilterChangesFromLogs. Filters are event catchers running on the Ethereum Client. Incubed has a client-side implementation. An event will be stored in case it is within to and from blocks, or in the block of blockhash, contains a transaction to the designed address, and has a word listed on topics.

Returns

The filter id.

Parameters
Remarks

Use the returned filter id to perform other filter operations.

SendRawTransaction(transactionData) method

Sends a signed and encoded transaction.

Returns

Transaction hash, used to get the receipt and check if the transaction was mined.

Parameters
  • System.String transactionData - Signed keccak hash of the serialized transaction.
Remarks

Client will add the other required fields, gas and chaind id.

SendTransaction(tx) method

Signs and sends the assigned transaction. The Signer used to sign the transaction is the one set by Signer. Transactions change the state of an account, just the balance, or additionally, the storage and the code. Every transaction has a cost, gas, paid in Wei. The transaction gas is calculated over estimated gas times the gas cost, plus an additional miner fee, if the sender wants to be sure that the transaction will be mined in the latest block.

Returns

Transaction hash, used to get the receipt and check if the transaction was mined.

Parameters
Example
 SimpleWallet wallet = (SimpleWallet) client.Signer;
 TransactionRequest tx = new TransactionRequest();
 tx.From = wallet.AddRawKey(pk);;
 tx.To = "0x3940256B93c4BE0B1d5931A6A036608c25706B0c";
 tx.Gas = 21000;
 tx.Value = 100000000;
 client.Eth1.SendTransaction(tx);

UninstallFilter(filterId) method

Uninstalls a previously created filter.

Returns

The result of the operation, true on success or false on failure.

Parameters

Get(multihash) method

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

Returns

The content that was stored by Put or Put.

Parameters

Put(content) method

Stores content on ipfs.

Returns

The multihash.

Parameters
  • System.String content - The content that will be stored via ipfs.

Put(content) method

Stores content on ipfs. The content is encoded as base64 before storing.

Returns

The multihash.

Parameters
  • System.Byte[] content - The content that will be stored via ipfs.

BaseConfiguration type

In3.Configuration

Base class for all configuration classes.

Block type

In3.Eth1

Class that represents as Ethereum block.

Author property

The miner of the block.

Difficulty property

Dificulty of the block.

ExtraData property

Extra data.

GasLimit property

Gas limit.

Hash property

The block hash.

LogsBloom property

The logsBloom data of the block.

MixHash property

The mix hash of the block. (only valid of proof of work).

Nonce property

The nonce.

Number property

The index of the block.

ParentHash property

The parent block`s hash.

ReceiptsRoot property

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

Sha3Uncles property

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

Size property

Size of the block.

StateRoot property

The roothash of the merkletree containing the complete state.

Timestamp property

Epoch timestamp when the block was created.

TotalDifficulty property

Total Difficulty as a sum of all difficulties starting from genesis.

TransactionsRoot property

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

Uncles property

List of uncle hashes.

BlockHeader type

In3.Btc

A Block header.

Bits property

Bits (target) for the block as hex.

Chainwork property

Total amount of work since genesis.

Confirmations property

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

Difficulty property

Difficulty of the block.

Hash property

The hash of the blockheader.

Height property

Block number.

Mediantime property

Unix timestamp in seconds since 1970.

Merkleroot property

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

NTx property

Number of transactions in the block.

Nextblockhash property

Hash of the next blockheader.

Nonce property

Nonce-field of the block.

Previousblockhash property

Hash of the parent blockheader.

Time property

Unix timestamp in seconds since 1970.

Version property

Used version.

VersionHex property

Version as hex.

BlockParameter type

In3

Enum-like class that defines constants to be used with Api.

Earliest property

Genesis block.

Latest property

Constant associated with the latest mined block in the chain.

Remarks

While the parameter itself is constant the current “latest” block changes everytime a new block is mined. The result of the operations are also related to ReplaceLatestBlock on ClientConfiguration.

Block`1 type

In3.Btc

A Block.

Size property

Size of this block in bytes.

Tx property

Transactions or Transaction ids of a block. GetBlockWithTxData or GetBlockWithTxIds.

Weight property

Weight of this block in bytes.

Chain type

In3

Represents the multiple chains supported by Incubed.

Btc constants

Bitcoin chain.

Evan constants

Evan testnet.

Ewc constants

Ewf chain.

Goerli constants

Goerli testnet.

Ipfs constants

Ipfs (InterPlanetary File System).

Kovan constants

Kovan testnet.

Local constants

Local client.

Mainnet constants

Ethereum mainnet.

Multichain constants

Support for multiple chains, a client can then switch between different chains (but consumes more memory).

Tobalaba constants

Tobalaba testnet.

Volta constants

Volta testnet.

ChainConfiguration type

In3.Configuration

Class that represents part of the configuration to be applied on the IN3 (in particular to each chain). This is a child of ClientConfiguration and have many NodeConfiguration.

#ctor(chain,clientConfiguration) constructor

Constructor.

Parameters
Example
ChainConfiguration goerliConfiguration = new ChainConfiguration(Chain.Goerli, in3Client.Configuration);

Contract property

Incubed registry contract from which the list was taken.

NeedsUpdate property

Preemptively update the node list.

NodesConfiguration property

Getter for the list of elements that represent the configuration for each node.

Remarks

This is a read-only property. To add configuration for nodes, Use NodeConfiguration constructor.

RegistryId property

Uuid of this incubed network. one chain could contain more than one incubed networks.

WhiteList property

Node addresses that constitute the white list of nodes.

WhiteListContract property

Address of whiteList contract.

ClientConfiguration type

In3.Configuration

Class that represents the configuration to be applied on IN3. Due to the 1-to-1 relationship with the client, this class should never be instantiated. To obtain a reference of the client configuration use Configuration instead.

Remarks

Use in conjunction with ChainConfiguration and NodeConfiguration.

AutoUpdateList property

If true the nodelist will be automatically updated. False may compromise data security.

BootWeights property

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.

ChainsConfiguration property

Configuration for the chains. Read-only attribute.

Finality property

Remarks

Beware that the semantics of the values change greatly from chain to chain. The value of 8 would mean 8 blocks mined on top of the requested one while with the POW algorithm while, for POA, it would mean 8% of validators.

IncludeCode property

Code is included when sending eth_call-requests.

KeepIn3 property

Tthe in3-section (custom node on the RPC call) with the proof will also returned.

MaxAttempts property

Maximum times the client will retry to contact a certain node.

MinDeposit property

Only nodes owning at least this amount will be chosen to sign responses to your requests.

NodeLimit property

Limit nodes stored in the client.

NodeProps property

Props define the capabilities of the nodes. Accepts a combination of values.

Example
clientConfiguration.NodeProps = Props.NodePropProof | Props.NodePropArchive;

Proof property

One of Proof. Full gets the whole block Patricia-Merkle-Tree, Standard only verifies the specific tree branch concerning the request, None only verifies the root hashes, like a light-client does.

ReplaceLatestBlock property

Distance considered safe, consensus wise, from the very latest block. Higher values exponentially increases state finality, and therefore data security, as well guaranteeded responses from in3 nodes.

RequestCount property

Useful when SignatureCount is less then 1. The client will check for consensus in responses.

Rpc property

Setup an custom rpc source for requests by setting chain to Local and proof to None.

SignatureCount property

Node signatures attesting the response to your request. Will send a separate request for each.

Example

When set to 3, 3 nodes will have to sign the response.

Timeout property

Milliseconds before a request times out.

UseHttp property

Disable ssl on the Http connection.

Context type

In3.Context

Acts as the main orchestrator for the execution of an rpc. Holds a reference to the native context (ctx) and wraps behavior around it.

#ctor(ctx,nativeClient) constructor

Standard constructor, private so people use FromRpc.

Parameters

CreateNativeCtx(nativeIn3Ptr,rpc) method

Method to manage the creation of the native ctx request.

Returns

Native rpc pointer

Parameters
Exceptions

| Name | Description |

| In3.Exceptions.RpcException | |

Dispose() method

Destructor method for the native ctx encapsulated by the Context object.

Parameters

This method has no parameters.

Execute() method

Proxy to in3_req_execute, every invocation generates a new state.

Returns

The state as computed by in3_req_execute.

Parameters

This method has no parameters.

FromRpc(wrapper,rpc) method

Factory-like method to build a Context object from an rpc request.

Returns

An instance of context.

Parameters

GetErrorMessage() method

Retrieve the error result on the context.

Returns

A string describing the encountered error.

Parameters

This method has no parameters.

GetLastWaiting() method

Method responsible to fetch the pending context references in the current context.

Returns

A context object.

Parameters

This method has no parameters.

GetResponse() method

Method to get the consolidated response of a request.

Returns

The final result.

Parameters

This method has no parameters.

GetType() method

Method to get the consolidated response of a request.

Returns

The final result.

Parameters

This method has no parameters.

HandleRequest() method

Handle rpc request in an asynchronous manner.

Parameters

This method has no parameters.

HandleSign() method

Handle signing request in an asynchronous manner.

Parameters

This method has no parameters.

IsValid() method

Conditional to verify if the encapsulated pointer actually points to something.

Returns

if its valid, false if it is not.

Parameters

This method has no parameters.

ReportError() method

Setter for the error on the current context. Proxies it to the native context.

Parameters

This method has no parameters.

DataTypeConverter type

In3.Utils

General util class for conversion between blockchain types.

HexStringToBigint(source) method

Converts a zero-prefixed hex (e.g.: 0x05) to BigInteger

Returns

The number representation of source.

Parameters

DefaultTransport type

In3.Transport

Basic implementation for synchronous http transport for Incubed client.

#ctor() constructor

Standard construction.

Parameters

This constructor has no parameters.

Handle(url,payload) method

Method that handles, sychronously the http requests.

Returns

The http json response.

Parameters

ENSParameter type

In3

Defines the kind of entity associated with the ENS Resolved. Used along with Ens.

Addr property

Address.

Hash property

Hash.

Owner property

Owner.

Resolver property

Resolver.

IN3 type

In3

Incubed network client. Connect to the blockchain via a list of bootnodes, then gets the latest list of nodes in the network and ask a certain number of the to sign the block header of given list, putting their deposit at stake. Once with the latest list at hand, the client can request any other on-chain information using the same scheme.

#ctor(chainId) constructor

Standard constructor, use ForChain instead.

Parameters
  • In3.Chain chainId - The chainId to connect to.

Btc property

Gets Api object.

Configuration property

Gets ClientConfiguration object. Any changes in the object will be automaticaly applied to the client before each method invocation.

Crypto property

Gets Api object.

Eth1 property

Gets Api object.

Ipfs property

Gets Api object.

Signer property

Get or Sets Signer object. If not set SimpleWallet will be used.

Storage property

Get or Sets Storage object. If not set InMemoryStorage will be used.

Transport property

Gets or sets Transport object. If not set DefaultTransport will be used.

Finalize() method

Finalizer for the client.

Parameters

This method has no parameters.

ForChain(chain) method

Creates a new instance of IN3.

Returns

An Incubed instance.

Parameters
Example
IN3 client = IN3.ForChain(Chain.Mainnet);

SendRpc(method,args,in3) method

Method used to communicate with the client. In general, its preferably to use the API.

Returns

The result of the Rpc operation as JSON.

Parameters

InMemoryStorage type

In3.Storage

Default implementation of Storage. It caches all cacheable data in memory.

#ctor() constructor

Standard constructor.

Parameters

This constructor has no parameters.

Clear() method

Empty the in-memory cache.

Returns

Result for the clear operation.

Parameters

This method has no parameters.

GetItem(key) method

Fetches the data from memory.

Returns

The cached value as a byte[].

Parameters

SetItem(key,content) method

Stores a value in memory for a given key.

Parameters
  • System.String key - A unique identifier for the data that is being cached.
  • System.Byte[] content - The value that is being cached.

Log type

In3.Eth1

Logs marks changes of state on the blockchain for events. The Log is a data object with information from logs.

Address property

Address from which this log originated.

BlockHash property

Hash of the block this log was in. null when its pending log.

BlockNumber property

Number of the block this log was in.

Data property

Data associated with the log.

LogIndex property

Index position in the block.

Removed property

Flags log removal (due to chain reorganization).

Topics property

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).

TransactionHash property

Hash of the transactions this log was created from. null when its pending log.

TransactionIndex property

index position log was created from.

Type property

Address from which this log originated.

LogFilter type

In3.Eth1

Filter configuration for search logs. To be used along with the Api filter and methods.

#ctor() constructor

Standard constructor.

Parameters

This constructor has no parameters.

Address property

Address for the filter.

BlockHash property

Blcok hash of the filtered blocks.

Remarks

If present, FromBlock and ToBlock will be ignored.

FromBlock property

Starting block for the filter.

ToBlock property

End block for the filter.

Topics property

Array of 32 Bytes Data topics. Topics are order-dependent. It’s possible to pass in null to match any topic, or a subarray of multiple topics of which one should be matching.

NodeConfiguration type

In3.Configuration

Class that represents part of the configuration to be applied on the IN3 (in particular to each boot node). This is a child of ChainConfiguration.

#ctor(config) constructor

Constructor for the node configuration.

Parameters
Example
NodeConfiguration myDeployedNode = new NodeConfiguration(mainnetChainConfiguration);

Address property

Address of the node, which is the public address it is signing with.

Props property

Props define the capabilities of the node. Accepts a combination of values.

Example
nodeConfiguration.Props = Props.NodePropProof | Props.NodePropArchive;

Url property

Url of the bootnode which the client can connect to.

Proof type

In3.Configuration

Alias for verification levels. Verification is done by calculating Ethereum Trie states requested by the Incubed network ans signed as proofs of a certain state.

Full property

All fields will be validated (including uncles).

None property

No Verification.

Standard property

Standard Verification of the important properties.

Props type

In3.Configuration

Enum that defines the capabilities an incubed node.

NodePropArchive constants

filter out non-archive supporting nodes.

NodePropBinary constants

filter out nodes that don’t support binary encoding.

NodePropData constants

filter out non-data provider nodes.

NodePropHttp constants

filter out non-http nodes.

NodePropMinblockheight constants

filter out nodes that will sign blocks with lower min block height than specified.

NodePropMultichain constants

filter out nodes other then which have capability of the same RPC endpoint may also accept requests for different chains.

NodePropOnion constants

filter out non-onion nodes.

NodePropProof constants

filter out nodes which are providing no proof.

NodePropSigner constants

filter out non-signer nodes.

NodePropStats constants

filter out nodes that do not provide stats.

RpcException type

In3.Exceptions

Custom Exception to be thrown during the

ScriptPubKey type

In3.Btc

Script on a transaction output.

Addresses property

List of addresses.

Asm property

The asm data,

Hex property

The raw hex data.

ReqSigs property

The required sigs.

Type property

The type.

Example

pubkeyhash

ScriptSig type

In3.Btc

Script on a transaction input.

Asm property

The asm data.

Hex property

The raw hex data.

SignatureType type

In3.Crypto

Group of constants to be used along with the methods of Api.

EthSign property

For hashes of the RLP prefixed.

Hash property

For data that was hashed and then signed.

Raw property

For data that was signed directly.

SignedData type

In3.Crypto

Output of SignData.

Message property

Signed message.

MessageHash property

Hash of (Message.

R property

Part of the ECDSA signature.

S property

Part of the ECDSA signature.

Signature property

ECDSA calculated r, s, and parity v, concatenated.

V property

27 + (R % 2).

Signer type

In3.Crypto

Minimum interface to be implemented by a kind of signer. Used by SendTransaction. Set it with Signer.

CanSign(account) method

Queries the Signer if it can sign for a certain key.

Returns

true if it can sign, false if it cant.

Parameters
  • System.String account - The account derived from the private key used to sign transactions.
Remarks

This method is invoked internaly by SendTransaction using From and will throw a SystemException in case false is returned.

PrepareTransaction() method

Optional method which allows to change the transaction-data before sending it. This can be used for redirecting it through a multisig. Invoked just before sending a transaction through SendTransaction.

Returns

Modified transaction request.

Parameters

This method has no parameters.

Sign(data,account) method

Signs the transaction data with the private key associated with the invoked account. Both arguments are automaticaly passed by Incubed client base on TransactionRequest data during a SendTransaction.

Returns

The signed transaction data.

Parameters

SimpleWallet type

In3.Crypto

Default implementation of the Signer. Works as an orchestration of the in order to manage multiple accounts.

#ctor(in3) constructor

Basic constructor.

Parameters

AddRawKey(privateKey) method

Adds a private key to be managed by the wallet and sign transactions.

Returns

The address derived from the privateKey

Parameters
  • System.String privateKey - The private key to be stored by the wallet.

CanSign(address) method

Check if this address is managed by this wallet.

Returns

true if the address is managed by this wallter, false if not.

Parameters

PrepareTransaction(tx) method

Identity function-like method.

Returns

tx

Parameters

Sign(data,address) method

Signs the transaction data by invoking SignData.

Returns

Signed transaction data.

Parameters

Storage type

In3.Storage

Provider methods to cache data. These data could be nodelists, contract codes or validator changes. Any form of cache should implement Storage and be set with Storage.

Clear() method

Clear the cache.

Returns

The result of the operation: true for success and false for failure.

Parameters

This method has no parameters.

GetItem(key) method

returns a item from cache.

Returns

The bytes or null if not found.

Parameters

SetItem(key,content) method

Stores an item to cache.

Parameters

Transaction type

In3.Btc

A BitCoin Transaction.

Transaction type

In3.Eth1

Class representing a transaction that was accepted by the Ethereum chain.

Blockhash property

The block hash of the block containing this transaction.

Blocktime property

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

Confirmations property

The confirmations.

Hash property

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

Hex property

The hex representation of raw data.

Locktime property

The locktime.

Size property

The serialized transaction size.

Time property

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

Txid property

Transaction Id.

Version property

The version.

Vin property

The transaction inputs.

Vout property

The transaction outputs.

Vsize property

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

Weight property

The transaction’s weight (between vsize4-3 and vsize4).

BlockHash property

Hash of the block that this transaction belongs to.

BlockNumber property

Number of the block that this transaction belongs to.

ChainId property

Chain id that this transaction belongs to.

Creates property

Address of the deployed contract (if successfull).

From property

Address whose private key signed this transaction with.

Gas property

Gas for the transaction.

GasPrice property

Gas price (in wei) for each unit of gas.

Hash property

Transaction hash.

Input property

Transaction data.

Nonce property

Nonce for this transaction.

PublicKey property

Public key.

R property

Part of the transaction signature.

Raw property

Transaction as rlp encoded data.

S property

Part of the transaction signature.

StandardV property

Part of the transaction signature. V is parity set by v = 27 + (r % 2).

To property

To address of the transaction.

TransactionIndex property

Transaction index.

V property

The StandardV plus the chain.

Value property

Value of the transaction.

TransactionBlock type

In3.Eth1

Class that holds a block with its full transaction array: Transaction.

Transactions property

Array with the full transactions containing on this block.

Remarks

Returned when shouldIncludeTransactions on Api get block methods are set to true.

TransactionHashBlock type

In3.Eth1

Class that holds a block with its transaction hash array.

Transactions property

Array with the full transactions containing on this block.

Remarks

Returned when shouldIncludeTransactions on Api get block methods are set to false.

TransactionInput type

In3.Btc

Input of a transaction.

ScriptSig property

The script.

Sequence property

The script sequence number.

Txid property

The transaction id.

Txinwitness property

Hex-encoded witness data (if any).

Yout property

The index of the transactionoutput.

TransactionOutput type

In3.Btc

Output of a transaction.

N property

The index in the transaction.

ScriptPubKey property

The script of the transaction.

Value property

The value in bitcoins.

TransactionReceipt type

In3.Eth1

Class that represents a transaction receipt. See GetTransactionReceipt.

BlockHash property

Hash of the block with the transaction which this receipt is associated with.

BlockNumber property

Number of the block with the transaction which this receipt is associated with.

ContractAddress property

Address of the smart contract invoked in the transaction (if any).

From property

Address of the account that signed the transaction.

GasUsed property

Gas used on this transaction.

Logs property

Logs/events for this transaction.

LogsBloom property

A bloom filter of logs/events generated by contracts during transaction execution. Used to efficiently rule out transactions without expected logs.

Root property

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

Status property

Status of the transaction.

To property

Address whose value will be transfered to.

TransactionHash property

Hash of the transaction.

TransactionIndex property

Number of the transaction on the block.

TransactionRequest type

In3.Eth1

Class that holds the state for the transaction request to be submited via SendTransaction.

Data property

Data of the transaction (in the case of a smart contract deployment for exemple).

From property

Address derivated from the private key that will sign the transaction. See Signer.

Function property

Function of the smart contract to be invoked.

Gas property

Gas cost for the transaction. Can be estimated via EstimateGas.

GasPrice property

Gas price (in wei). Can be obtained via GetGasPrice.

Nonce property

Nonce of the transaction.

Params property

Array of parameters for the function (in the same order of its signature), see Function

To property

Address to whom the transaction value will be transfered to or the smart contract address whose function will be invoked.

Value property

Value of the transaction.

Transport type

In3.Transport

Minimum interface for a custom transport. Transport is a mean of communication with the Incubed server.

Handle(url,payload) method

Method to be implemented that will handle the requests to the server. This method may be called once for each url on each batch of requests.

Returns

The rpc response.

Parameters