API Reference TS

This page contains a list of all Datastructures and Classes used within the TypeScript IN3 Client.

Examples

This is a collection of different incubed-examples.

using Web3

Since incubed works with on a JSON-RPC-Level it can easily be used as Provider for Web3:

// import in3-Module
import In3Client from 'in3'
import * as web3 from 'web3'

// use the In3Client as Http-Provider
const web3 = new Web3(new In3Client({
    proof         : 'standard',
    signatureCount: 1,
    requestCount  : 2,
    chainId       : 'mainnet'
}).createWeb3Provider())

// use the web3
const block = await web.eth.getBlockByNumber('latest')
...

using Incubed API

Incubed includes a light API, allowinng not only to use all RPC-Methods in a typesafe way, but also to sign transactions and call funnctions of a contract without the web3-library.

For more details see the API-Doc

// import in3-Module
import In3Client from 'in3'

// use the In3Client
const in3 = new In3Client({
    proof         : 'standard',
    signatureCount: 1,
    requestCount  : 2,
    chainId       : 'mainnet'
})

// use the api to call a funnction..
const myBalance = await in3.eth.callFn(myTokenContract, 'balanceOf(address):uint', myAccount)

// ot to send a transaction..
const receipt = await in3.eth.sendTransaction({ 
  to           : myTokenContract, 
  method       : 'transfer(address,uint256)',
  args         : [target,amount],
  confirmations: 2,
  pk           : myKey
})

...

Reading event with incubed

// import in3-Module
import In3Client from 'in3'

// use the In3Client
const in3 = new In3Client({
    proof         : 'standard',
    signatureCount: 1,
    requestCount  : 2,
    chainId       : 'mainnet'
})

// use the ABI-String of the smart contract
abi = [{"anonymous":false,"inputs":[{"indexed":false,"name":"name","type":"string"},{"indexed":true,"name":"label","type":"bytes32"},{"indexed":true,"name":"owner","type":"address"},{"indexed":false,"name":"cost","type":"uint256"},{"indexed":false,"name":"expires","type":"uint256"}],"name":"NameRegistered","type":"event"}]

// create a contract-object for a given address
const contract = in3.eth.contractAt(abi, '0xF0AD5cAd05e10572EfcEB849f6Ff0c68f9700455') // ENS contract.

// read all events starting from a specified block until the latest
const logs = await c.events.NameRegistered.getLogs({fromBlock:8022948})) 

// print out the properties of the event.
for (const ev of logs) 
  console.log(`${ev.owner} registered ${ev.name} for ${ev.cost} wei until ${new Date(ev.expires.toNumber()*1000).toString()}`)

...

Main Module

Importing incubed is as easy as

import Client,{util} from "in3"

While the In3Client-class is the default import, the following imports can be used:

Type
the ABI
Interface
the AccountProof
Interface
the AuraValidatoryProof
Type
the BlockData
Type
the BlockType
Interface
the ChainSpec
Class
the IN3Client
Interface
the IN3Config
Interface
the IN3NodeConfig
Interface
the IN3NodeWeight
Interface
the IN3RPCConfig
Interface
the IN3RPCHandlerConfig
Interface
the IN3RPCRequestConfig
Interface
the IN3ResponseConfig
Type
the Log
Type
the LogData
Interface
the LogProof
Interface
the Proof
Interface
the RPCRequest
Interface
the RPCResponse
Type
the ReceiptData
Interface
the ServerList
Interface
the Signature
Type
the Transaction
Type
the TransactionData
Type
the TransactionReceipt
Type
the Transport
any
the AxiosTransport
value= transport.AxiosTransport
the EthAPI
value= _ethapi.default
any
the cbor
value= _cbor

the chainAliases
value= aliases
the chainData
value= _chainData
number []
len:number,
limit:number,
seed:Buffer ,
result:number [])
helper function creating deterministic random indexes used for limited nodelists
the header
value= _header
the serialize
value= _serialize
any
the storage
value= _storage
any
the transport
value= _transport

the typeDefs
value= types.validationDef
any
the util
value= _util
any
the validate
value= validateOb.validate

Package client

Type Client

Source: client/Client.ts

Client for N3.

number
the defaultMaxListeners
number
emitter:EventEmitter ,
event:string
| symbol)
listener count
transport:Transport )
creates a new Client.
the defConfig
the eth
the ipfs
config
this
event:string
| symbol,
listener:)
add listener
Promise<any>
method:string,
params:any,
chain:string,
sends a simply RPC-Request
void
clears all stats and weights, like blocklisted nodes
any
create web3 provider
boolean
event:string
| symbol,
args:any [])
emit
event names
chainId:string)
Context for a specific chain including cache and chainSpecs.
number
get max listeners
number
type:string
| symbol)
listener count
event:string
| symbol)
listeners
this
off (
event:string
| symbol,
listener:)
off
this
on (
event:string
| symbol,
listener:)
on
this
event:string
| symbol,
listener:)
once
this
event:string
| symbol,
listener:)
prepend listener
this
event:string
| symbol,
listener:)
prepend once listener
event:string
| symbol)
raw listeners
this
event:string
| symbol)
remove all listeners
this
event:string
| symbol,
listener:)
remove listener
Promise<>
request:RPCRequest []
callback:,
sends one or a multiple requests.
if the request is a array the response will be a array as well.
If the callback is given it will be called with the response, if not a Promise will be returned.
This function supports callback so it can be used as a Provider for the web3.
method:string,
params:any [],
chain:string,
sends a simply RPC-Request
this
n:number)
set max listeners
Promise<void>
chainId:string,
retryCount:number)
fetches the nodeList from the servers.
Promise<void>
update white list nodes
Promise<boolean>
request:RPCRequest ,
response:RPCResponse ,
chain:string,
Verify the response of a request without any effect on the state of the client.
Note: The node-list will not be updated.
The method will either return true if its inputs could be verified.
Or else, it will throw an exception with a helpful message.

Type ChainContext

Source: client/ChainContext.ts

Context for a specific chain including cache and chainSpecs.

client:Client ,
chainId:string,
chainSpec:ChainSpec [])
Context for a specific chain including cache and chainSpecs.
string
the chainId
the chainSpec
the client

the genericCache
number
the lastValidatorChange
the module
string
the registryId (optional)
void
prefix:string)
clear cache
block:number)
returns the chainspec for th given block number
string
key:string)
get from cache
request:RPCRequest )
this function is calleds before the server is asked.
If it returns a promise than the request is handled internally otherwise the server will handle the response.
this function should be overriden by modules that want to handle calls internally
void
init cache
void
key:string,
value:string)
put in cache
void
whiteList:Set<string> ,
whiteListContract:string)
update cache

Type Module

Source: client/modules.ts

string
the name
client:Client ,
chainId:string,
spec:ChainSpec [])
Context for a specific chain including cache and chainSpecs.
Promise<boolean>
request:RPCRequest ,
response:RPCResponse ,
allowWithoutProof:boolean,
general verification-function which handles it according to its given type.

Package index.ts

Type AccountProof

Source: index.ts

the Proof-for a single Account the Proof-for a single Account

string []
the serialized merle-noodes beginning with the root-node
string
the address of this account
string
the balance of this account as hex
string
the code of this account as hex ( if required) (optional)
string
the codeHash of this account as hex
string
the nonce of this account as hex
string
the storageHash of this account as hex
[]
proof for requested storage-data

Type AuraValidatoryProof

Source: index.ts

a Object holding proofs for validator logs. The key is the blockNumber as hex a Object holding proofs for validator logs. The key is the blockNumber as hex

string
the serialized blockheader
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b
any []
the serialized blockheader as hex, required in case of finality asked
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)
number
the transaction log index
string []
the merkleProof
number
the transactionIndex within the block

Type ChainSpec

Source: index.ts

describes the chainspecific consensus params describes the chainspecific consensus params

number
the blocknumnber when this configuration should apply (optional)
number
Bypass finality check for transition to contract based Aura Engines
example: bypassFinality = 10960502 -> will skip the finality check and add the list at block 10960502 (optional)
string
The validator contract at the block (optional)
'ethHash'
| 'authorityRound'
| 'clique'
the engine type (like Ethhash, authorityRound, … ) (optional)
string []
The list of validators at the particular block (optional)
boolean
indicates whether the transition requires a finality check
example: true (optional)

Type IN3Client

Source: index.ts

Client for N3. Client for N3.

number
the defaultMaxListeners
number
emitter:EventEmitter ,
event:string
| symbol)
listener count
transport:Transport )
creates a new Client.
the defConfig
the eth
the ipfs
config
this
event:string
| symbol,
listener:)
add listener
Promise<any>
method:string,
params:any,
chain:string,
sends a simply RPC-Request
void
clears all stats and weights, like blocklisted nodes
any
create web3 provider
boolean
event:string
| symbol,
args:any [])
emit
event names
chainId:string)
Context for a specific chain including cache and chainSpecs.
number
get max listeners
number
type:string
| symbol)
listener count
event:string
| symbol)
listeners
this
off (
event:string
| symbol,
listener:)
off
this
on (
event:string
| symbol,
listener:)
on
this
event:string
| symbol,
listener:)
once
this
event:string
| symbol,
listener:)
prepend listener
this
event:string
| symbol,
listener:)
prepend once listener
event:string
| symbol)
raw listeners
this
event:string
| symbol)
remove all listeners
this
event:string
| symbol,
listener:)
remove listener
Promise<>
request:RPCRequest []
callback:,
sends one or a multiple requests.
if the request is a array the response will be a array as well.
If the callback is given it will be called with the response, if not a Promise will be returned.
This function supports callback so it can be used as a Provider for the web3.
method:string,
params:any [],
chain:string,
sends a simply RPC-Request
this
n:number)
set max listeners
Promise<void>
chainId:string,
retryCount:number)
fetches the nodeList from the servers.
Promise<void>
update white list nodes
Promise<boolean>
request:RPCRequest ,
response:RPCResponse ,
chain:string,
Verify the response of a request without any effect on the state of the client.
Note: The node-list will not be updated.
The method will either return true if its inputs could be verified.
Or else, it will throw an exception with a helpful message.

Type IN3Config

Source: index.ts

the iguration of the IN3-Client. This can be paritally overriden for every request. the iguration of the IN3-Client. This can be paritally overriden for every request.

boolean
if true the in3 client will filter out non archive supporting nodes
example: true (optional)
boolean
if true the config will be adjusted depending on the request (optional)
boolean
if true the nodelist will be automaticly updated if the lastBlock is newer
example: true (optional)
boolean
if true the in3 client will only include nodes that support binary encording
example: true (optional)
any
a cache handler offering 2 functions ( setItem(string,string), getItem(string) ) (optional)
number
number of seconds requests can be cached. (optional)
string
servers to filter for the given chain. The chain-id based on EIP-155.
example: 0x1
string
main chain-registry contract
example: 0xe36179e2286ef405e929C90ad3E70E649B22a945 (optional)
number
timeout after which the owner is allowed to receive its stored deposit. This information is also important for the client
example: 3000 (optional)
number
the number in percent needed in order reach finality (% of signature of the validators)
example: 50 (optional)
'json' | 'jsonRef' | 'cbor'
the format for sending the data to the client. Default is json, but using cbor means using only 30-40% of the payload since it is using binary encoding
example: json (optional)
boolean
if true the in3 client will include http nodes
example: true (optional)
boolean
if true, the request should include the codes of all accounts. otherwise only the the codeHash is returned. In this case the client may ask by calling eth_getCode() afterwards
example: true (optional)
boolean
if true, the in3-section of thr response will be kept. Otherwise it will be removed after validating the data. This is useful for debugging or if the proof should be used afterwards. (optional)
any
the client key to sign requests
example: 0x387a8233c96e1fc0ad5e284353276177af2186e7afa85296f106336e376669f7 (optional)
string
a url of RES-Endpoint, the client will log all errors to. The client will post to this endpoint JSON like { id?, level, message, meta? } (optional)
string
main chain-id, where the chain registry is running.
example: 0x1 (optional)
number
max number of attempts in case a response is rejected
example: 10 (optional)
number
number of number of blocks cached in memory
example: 100 (optional)
number
number of max bytes used to cache the code in memory
example: 100000 (optional)
number
min stake of the server. Only nodes owning at least this amount will be chosen.
boolean
if true the in3 client will filter out nodes other then which have capability of the same RPC endpoint may also accept requests for different chains
example: true (optional)
number
the limit of nodes to store in the client.
example: 150 (optional)
'none' | 'standard' | 'full'
if true the nodes should send a proof of the response
example: true (optional)
boolean
if true the in3 client will filter out nodes which are providing no proof
example: true (optional)
number
if specified, the blocknumber latest will be replaced by blockNumber- specified value
example: 6 (optional)
number
the number of request send when getting a first answer
example: 3
boolean
if true the the request may be handled without proof in case of an error. (use with care!) (optional)
string
url of one or more rpc-endpoints to use. (list can be comma seperated) (optional)

the nodelist per chain (optional)
number
number of signatures requested
example: 2 (optional)
number
specifies the number of milliseconds before the request times out. increasing may be helpful if the device uses a slow connection.
example: 3000 (optional)
boolean
if true the in3 client will filter out non tor nodes
example: true (optional)
string []
if the client sends a array of blockhashes the server will not deliver any signatures or blockheaders for these blocks, but only return a string with a number. This is automaticly updated by the cache, but can be overriden per request. (optional)
string []
a list of in3 server addresses which are whitelisted manually by client
example: 0xe36179e2286ef405e929C90ad3E70E649B22a945,0x6d17b34aeaf95fee98c0437b4ac839d8a2ece1b1 (optional)
string
White list contract address (optional)

Type IN3NodeConfig

Source: index.ts

a configuration of a in3-server. a configuration of a in3-server.

string
the address of the node, which is the public address it iis signing with.
example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679
number
the capacity of the node.
example: 100 (optional)
string []
the list of supported chains
example: 0x1
number
the deposit of the node in wei
example: 12350000
number
the index within the contract
example: 13 (optional)
number
the properties of the node.
example: 3 (optional)
number
the UNIX-timestamp when the node was registered
example: 1563279168 (optional)
number
the time (in seconds) until an owner is able to receive his deposit back after he unregisters himself
example: 3600 (optional)
number
the UNIX-timestamp when the node is allowed to be deregister
example: 1563279168 (optional)
string
the endpoint to post to

Type IN3NodeWeight

Source: index.ts

a local weight of a n3-node. (This is used internally to weight the requests) a local weight of a n3-node. (This is used internally to weight the requests)

number
average time of a response in ms
example: 240 (optional)
number
blacklisted because of failed requests until the timestamp
example: 1529074639623 (optional)
number
timestamp of the last request in ms
example: 1529074632623 (optional)
number
last price (optional)
number
number of uses.
example: 147 (optional)
number
factor the weight this noe (default 1.0)
example: 0.5 (optional)

Type IN3RPCConfig

Source: index.ts

the configuration for the rpc-handler the configuration for the rpc-handler


a definition of the Handler per chain (optional)

the db (optional)
string
the default chainId in case the request does not contain one. (optional)
string
a identifier used in logfiles as also for reading the config from the database (optional)

logger config (optional)
number
the listeneing port for the server (optional)

the profile (optional)

Type IN3RPCHandlerConfig

Source: index.ts

the configuration for the rpc-handler the configuration for the rpc-handler


the autoRegistry (optional)
string
a comma sepearted list of client keys to use for simulating clients for the watchdog (optional)
number
the score for requests without a valid signature (optional)
'eth' | 'ipfs' | 'btc'
the impl used to handle the calls (optional)
string
the url of the ipfs-client (optional)
number
the maximal number of threads ofr running parallel processes (optional)
number
the minimal blockheight in order to sign (optional)
string
the filename of the file keeping track of the last handled blocknumber (optional)
string
the private key used to sign blockhashes. this can be either a 0x-prefixed string with the raw private key or the path to a key-file.
string
the password used to decrpyt the private key (optional)
string
the address of the server registry used in order to update the nodeList
string
the url of the client in case the registry is not on the same chain. (optional)
string
the url of the client
number
blocknumber to start watching the registry (optional)
number
number of milliseconds to wait before a request gets a timeout (optional)
number
the number of seconds of the interval for checking for new events (optional)
number
average time between sending requests to the same node. 0 turns it off (default) (optional)

Type IN3RPCRequestConfig

Source: index.ts

additional config for a IN3 RPC-Request additional config for a IN3 RPC-Request

string
the requested chainId
example: 0x1
any
the signature of the client (optional)
number
if given the server will deliver the blockheaders of the following blocks until at least the number in percent of the validators is reached. (optional)
boolean
if true, the request should include the codes of all accounts. otherwise only the the codeHash is returned. In this case the client may ask by calling eth_getCode() afterwards
example: true (optional)
number
if specified, the blocknumber latest will be replaced by blockNumber- specified value
example: 6 (optional)
string []
a list of addresses requested to sign the blockhash
example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679 (optional)
boolean
if true binary-data will be used. (optional)
boolean
if true all data in the response will be proven, which leads to a higher payload. (optional)
boolean
if true binary-data (starting with a 0x) will be refered if occuring again. (optional)
'never'
| 'proof'
| 'proofWithSignature'
defines the kind of proof the client is asking for
example: proof (optional)
string []
if the client sends a array of blockhashes the server will not deliver any signatures or blockheaders for these blocks, but only return a string with a number. (optional)
string
IN3 protocol version that client can specify explicitly in request
example: 1.0.0 (optional)
string
address of whitelist contract if added in3 server will register it in watch
and will notify client the whitelist event block number in reponses it depends on cahce settings (optional)

Type IN3ResponseConfig

Source: index.ts

additional data returned from a IN3 Server additional data returned from a IN3 Server

number
the current blocknumber.
example: 320126478 (optional)
number
the blocknumber for the last block updating the nodelist. If the client has a smaller blocknumber he should update the nodeList.
example: 326478 (optional)
number
the blocknumber of the last change of the validatorList (optional)
number
The blocknumber of the last white list event (optional)
the Proof-data (optional)
string
IN3 protocol version
example: 1.0.0 (optional)

Type LogProof

Source: index.ts

a Object holding proofs for event logs. The key is the blockNumber as hex a Object holding proofs for event logs. The key is the blockNumber as hex

Type Proof

Source: index.ts

the Proof-data as part of the in3-section the Proof-data as part of the in3-section


a map of addresses and their AccountProof (optional)
string
the serialized blockheader as hex, required in most proofs
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)
any []
the serialized blockheader as hex, required in case of finality asked
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)
the Log Proof in case of a Log-Request (optional)
string []
the serialized merle-noodes beginning with the root-node (optional)
string []
the serialized merkle-noodes beginning with the root-node of the previous entry (only for full proof of receipts) (optional)
requested signatures (optional)
any []
the list of transactions of the block
example: (optional)
number
the transactionIndex within the block
example: 4 (optional)
string []
the serialized merkle-nodes beginning with the root-node in order to prrof the transactionIndex (optional)
'transactionProof'
| 'receiptProof'
| 'blockProof'
| 'accountProof'
| 'callProof'
| 'logProof'
the type of the proof
example: accountProof
any []
the list of uncle-headers of the block
example: (optional)

Type RPCRequest

Source: index.ts

a JSONRPC-Request with N3-Extension a JSONRPC-Request with N3-Extension

number | string
the identifier of the request
example: 2 (optional)
the IN3-Config (optional)
'2.0'
the version
string
the method to call
example: eth_getBalance
any []
the params
example: 0xe36179e2286ef405e929C90ad3E70E649B22a945,latest (optional)

Type RPCResponse

Source: index.ts

a JSONRPC-Responset with N3-Extension a JSONRPC-Responset with N3-Extension

string
in case of an error this needs to be set (optional)
string | number
the id matching the request
example: 2
the IN3-Result (optional)
the node handling this response (internal only) (optional)
'2.0'
the version
any
the params
example: 0xa35bc (optional)

Type ServerList

Source: index.ts

a List of nodes a List of nodes

string
IN3 Registry (optional)
number
last Block number (optional)
the list of nodes
the proof (optional)
string
registry id of the contract (optional)
number
number of servers (optional)

Type Signature

Source: index.ts

Verified ECDSA Signature. Signatures are a pair (r, s). Where r is computed as the X coordinate of a point R, modulo the curve order n. Verified ECDSA Signature. Signatures are a pair (r, s). Where r is computed as the X coordinate of a point R, modulo the curve order n.

string
the address of the signing node
example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679 (optional)
number
the blocknumber
example: 3123874
string
the hash of the block
example: 0x6C1a01C2aB554930A937B0a212346037E8105fB47946c679
string
hash of the message
example: 0x9C1a01C2aB554930A937B0a212346037E8105fB47946AB5D
string
Positive non-zero Integer signature.r
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1f
string
Positive non-zero Integer signature.s
example: 0x6d17b34aeaf95fee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda
number
Calculated curve point, or identity element O.
example: 28

Type Transport

Source: index.ts

= _transporttype

Package modules/eth

Type EthAPI

Source: modules/eth/api.ts

client:Client )
constructor
the client
the signer (optional)
Promise<number>
Returns the number of most recent block. (as number)
Promise<string>
block:BlockType )
Executes a new message call immediately without creating a transaction on the block chain.
Promise<any>
to:Address ,
method:string,
args:any [])
Executes a function of a contract, by passing a [method-signature](https://github.com/ethereumjs/ethereumjs-abi/blob/master/README.md#simple-encoding-and-decoding) and the arguments, which will then be ABI-encoded and send as eth_call.
Promise<string>
Returns the EIP155 chain ID used for transaction signing at the current best block. Null is returned if not available.

abi:ABI [],
address:Address )
contract at
any
log:Log ,
d:ABI )
decode event data
Promise<number>
Makes a call or transaction, which won’t be added to the blockchain and returns the used gas, which can be used for estimating the used gas.
Promise<number>
Returns the current price per gas in wei. (as number)
address:Address ,
block:BlockType )
Returns the balance of the account of given address in wei (as hex).
hash:Hash ,
includeTransactions:boolean)
Returns information about a block by hash.
block:BlockType ,
includeTransactions:boolean)
Returns information about a block by block number.
Promise<number>
Returns the number of transactions in a block from a block matching the given block hash.
Promise<number>
Returns the number of transactions in a block from a block matching the given block number.
Promise<string>
address:Address ,
block:BlockType )
Returns code at a given address.
Promise<>
Polling method for a filter, which returns an array of logs which occurred since last poll.
Promise<>
Returns an array of all logs matching filter with given id.
Promise<>
filter:LogFilter )
Returns an array of all logs matching a given filter object.
Promise<string>
address:Address ,
pos:Quantity ,
block:BlockType )
Returns the value from a storage position at a given address.
Returns information about a transaction by block hash and transaction index position.
Returns information about a transaction by block number and transaction index position.
Returns the information about a transaction requested by transaction hash.
Promise<number>
address:Address ,
block:BlockType )
Returns the number of transactions sent from an address. (as number)
Returns the receipt of a transaction by transaction hash.
Note That the receipt is available even for pending transactions.
Returns information about a uncle of a block by hash and uncle index position.
Note: An uncle doesn’t contain individual transactions.
Returns information about a uncle of a block number and uncle index position.
Note: An uncle doesn’t contain individual transactions.
Promise<number>
Returns the number of uncles in a block from a block matching the given block hash.
Promise<number>
Returns the number of uncles in a block from a block matching the given block hash.
data:Data
| Buffer )
hash message
Promise<string>
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.
Promise<string>
filter:LogFilter )
Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.
Promise<string>
Creates a filter in the node, to notify when new pending transactions arrive.
Promise<string>
Returns the current ethereum protocol version.
Promise<string>
Creates new message call transaction or a contract creation for signed transactions.
Promise<>
sends a Transaction
account:Address ,
data:Data )
signs any kind of message using the x19Ethereum Signed Message:n-prefix
Promise<>
Returns the current ethereum protocol version.
Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.

Type chainData

Source: modules/eth/chainData.ts

Promise<any>
client:Client ,
contract:string,
chainId:string,
signature:string,
args:any [],
config:IN3Config )
call contract
Promise<>
client:Client ,
chainId:string,
config:IN3Config )
get chain data

Type header

Source: modules/eth/header.ts

Interface
Authority specification for proof of authority chains
Interface
the HistoryEntry
Promise<void>
states:HistoryEntry [],
contract:string)
add aura validators
void
add clique validators
Promise<number>
blockHeaders:any [],
getChainSpec:)
verify a Blockheader and returns the percentage of finality
void
stateBlockNumber:number,
current:Buffer [],
_finality:number)
check for finality
Promise<void>
check for validators
get chain spec
get clique signer
data:Block )
get signer

Type Signer

Source: modules/eth/api.ts

optiional method which allows to change the transaction-data before sending it. This can be used for redirecting it through a multisig.
data:Buffer ,
account:Address )
signing of any data.
Promise<boolean>
account:Address )
returns true if the account is supported (or unlocked)

Type Transaction

Source: modules/eth/api.ts

any
optional chain id (optional)
string
4 byte hash of the method signature followed by encoded parameters. For details see Ethereum Contract ABI.
20 Bytes - The address the transaction is send from.
Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
Integer of the gas price used for each paid gas.
nonce
(optional when creating new contract) 20 Bytes - The address the transaction is directed to.
Integer of the value sent with this transaction.

Type BlockType

Source: modules/eth/api.ts

= number | 'latest' | 'earliest' | 'pending'

Type Address

Source: modules/eth/api.ts

= string

Type ABI

Source: modules/eth/api.ts

boolean
the anonymous (optional)
boolean
the constant (optional)
the inputs (optional)
string
the name (optional)
the outputs (optional)
boolean
the payable (optional)
'nonpayable'
| 'payable'
| 'view'
| 'pure'
the stateMutability (optional)
'event'
| 'function'
| 'constructor'
| 'fallback'
the type

Type Log

Source: modules/eth/api.ts

20 Bytes - address from which this log originated.
Hash, 32 Bytes - hash of the block where this log was in. null when its pending. null when its pending log.
the block number where this log was in. null when its pending. null when its pending log.
contains the non-indexed arguments of the log.
integer of the log index position in the block. null when its pending log.
boolean
true when the log was removed, due to a chain reorganization. false if its a valid log.
Data []
- 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.)
Hash, 32 Bytes - hash of the transactions this log was created from. null when its pending log.
integer of the transactions index position log was created from. null when its pending log.

Type Block

Source: modules/eth/api.ts

20 Bytes - the address of the author of the block (the beneficiary to whom the mining rewards were given)
integer of the difficulty for this block
the ‘extra data’ field of this block
the maximum gas allowed in this block
the total used gas by all transactions in this block
hash of the block. null when its pending block
256 Bytes - the bloom filter for the logs of the block. null when its pending block
20 Bytes - alias of ‘author’
8 bytes hash of the generated proof-of-work. null when its pending block. Missing in case of PoA.
The block number. null when its pending block
hash of the parent block
32 Bytes - the root of the receipts trie of the block
Data []
PoA-Fields
SHA3 of the uncles data in the block
integer the size of this block in bytes
32 Bytes - the root of the final state trie of the block
the unix timestamp for when the block was collated
integer of the total difficulty of the chain until this block
string | []
Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter
32 Bytes - the root of the transaction trie of the block
Hash []
Array of uncle hashes

Type Hash

Source: modules/eth/api.ts

= string

Type Quantity

Source: modules/eth/api.ts

= number | Hex

Type LogFilter

Source: modules/eth/api.ts

(optional) 20 Bytes - Contract address or a list of addresses from which logs should originate.
Quantity or Tag - (optional) (default: latest) Integer block number, or ‘latest’ for the last mined block or ‘pending’, ‘earliest’ for not yet mined transactions.
å(optional) The maximum number of entries to retrieve (latest first).
Quantity or Tag - (optional) (default: latest) Integer block number, or ‘latest’ for the last mined block or ‘pending’, ‘earliest’ for not yet mined transactions.
string | string [] []
(optional) 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.

Type TransactionDetail

Source: modules/eth/api.ts

32 Bytes - hash of the block where this transaction was in. null when its pending.
block number where this transaction was in. null when its pending.
the chain id of the transaction, if any.
any
(optional) conditional submission, Block number in block or timestamp in time or null. (parity-feature)
creates contract address
20 Bytes - address of the sender.
gas provided by the sender.
gas price provided by the sender in Wei.
32 Bytes - hash of the transaction.
the data send along with the transaction.
the number of transactions made by the sender prior to this one.
any
optional: the private key to use for signing (optional)
public key of the signer.
the R field of the signature.
raw transaction data
the standardised V field of the signature (0 or 1).
20 Bytes - address of the receiver. null when its a contract creation transaction.
integer of the transactions index position in the block. null when its pending.
the standardised V field of the signature.
value transferred in Wei.

Type TransactionReceipt

Source: modules/eth/api.ts

32 Bytes - hash of the block where this transaction was in.
block number where this transaction was in.
20 Bytes - The contract address created, if the transaction was a contract creation, otherwise null.
The total amount of gas used when this transaction was executed in the block.
20 Bytes - The address of the sender.
The amount of gas used by this specific transaction alone.
Log []
Array of log objects, which this transaction generated.
256 Bytes - A bloom filter of logs/events generated by contracts during transaction execution. Used to efficiently rule out transactions without expected logs.
32 Bytes - Merkle root of the state trie after the transaction has been executed (optional after Byzantium hard fork EIP609)
0x0 indicates transaction failure , 0x1 indicates transaction success. Set for blocks mined after Byzantium hard fork EIP609, null before.
20 Bytes - The address of the receiver. null when it’s a contract creation transaction.
32 Bytes - hash of the transaction.
Integer of the transactions index position in the block.

Type Data

Source: modules/eth/api.ts

= string

Type TxRequest

Source: modules/eth/api.ts

any []
the argument to pass to the method (optional)
number
number of block to wait before confirming (optional)
the data to send (optional)
address of the account to use (optional)
number
the gas needed (optional)
number
the gasPrice used (optional)
string
the ABI of the method to be used (optional)
number
the nonce (optional)
raw private key in order to sign (optional)
contract (optional)
the value in wei (optional)

Type AuthSpec

Source: modules/eth/header.ts

Authority specification for proof of authority chains

List of validator addresses storead as an buffer array
proposer of the block this authspec belongs
chain specification

Type HistoryEntry

Source: modules/eth/header.ts

number
the block
| string []
the proof
string []
the validators

Type ABIField

Source: modules/eth/api.ts

boolean
the indexed (optional)
string
the name
string
the type

Type Hex

Source: modules/eth/api.ts

= string

Package modules/ipfs

Type IpfsAPI

Source: modules/ipfs/api.ts

simple API for IPFS

_client:Client )
simple API for IPFS
the client
get (
hash:string,
resultEncoding:string)
retrieves the conent for a hash from IPFS.
Promise<string>
put (
data:Buffer ,
dataEncoding:string)
stores the data on ipfs and returns the IPFS-Hash.

Package util

a collection of util classes inside incubed. They can be get directly through require('in3/js/srrc/util/util')

Type DeltaHistory

Source: util/DeltaHistory.ts

init:T [],
deltaStrings:boolean)
constructor
the data
void
start:number,
data:T [])
add state
T []
index:number)
get data
number
get last index
void
deltas:string [])
load delta strings
string []
to delta strings

Type Delta

Source: util/DeltaHistory.ts

This file is part of the Incubed project. Sources: https://github.com/slockit/in3

number
the block
T []
the data
number
the len
number
the start

Common Module

The common module (in3-common) contains all the typedefs used in the node and server.

Interface
the BlockData
Interface
the LogData
Type
the Receipt
Interface
the ReceiptData
Type
the Transaction
Interface
the TransactionData
Interface
the Transport
the AxiosTransport
value= _transport.AxiosTransport
the Block
value= _serialize.Block
any
val:any)
converts it to a Buffer with 20 bytes length
hex:string)
converts a hexstring to a block-object
any
val:any)
converts it to a Buffer
any
val:any)
converts it to a Buffer with 32 bytes length
any
val:any)
converts it to a Buffer with 8 bytes length
the cbor
value= _cbor

the chainAliases
value= _util.aliases
number []
len:number,
limit:number,
seed:Buffer ,
result:number [])
create random indexes
any
transaction:any)
creates a Transaction-object from the rpc-transaction-data
data:Block )
get signer
returns the hash of the object
the rlp
value= _serialize.rlp
the serialize
value= _serialize
the storage
value= _storage
account:AccountData )
to account
create a Buffer[] from RPC-Response
Object
create a Buffer[] from RPC-Response
create a Buffer[] from RPC-Response
the transport
value= _transport
any
val:any)
converts it to a Buffer with a variable length. 0 = length 0
any
val:any)
uint128
any
val:any)
uint64
the util
value= _util
the validate
value= _validate

Package index.ts

Type BlockData

Source: index.ts

Block as returned by eth_getBlockByNumber Block as returned by eth_getBlockByNumber

string
the coinbase (optional)
string | number
the difficulty
string
the extraData
string | number
the gasLimit
string | number
the gasUsed
string
the hash
string
the logsBloom
string
the miner
string
the mixHash (optional)
string | number
the nonce (optional)
string | number
the number
string
the parentHash
string
the receiptRoot (optional)
string
the receiptsRoot
string []
the sealFields (optional)
string
the sha3Uncles
string
the stateRoot
string | number
the timestamp
any []
the transactions (optional)
string
the transactionsRoot
string []
the uncles (optional)

Type LogData

Source: index.ts

LogData as part of the TransactionReceipt LogData as part of the TransactionReceipt

string
the address
string
the blockHash
string
the blockNumber
string
the data
string
the logIndex
boolean
the removed
string []
the topics
string
the transactionHash
string
the transactionIndex
string
the transactionLogIndex

Type ReceiptData

Source: index.ts

TransactionReceipt as returned by eth_getTransactionReceipt TransactionReceipt as returned by eth_getTransactionReceipt

string
the blockHash (optional)
string | number
the blockNumber (optional)
string | number
the cumulativeGasUsed (optional)
string | number
the gasUsed (optional)
the logs
string
the logsBloom (optional)
string
the root (optional)
string | boolean
the status (optional)
string
the transactionHash (optional)
number
the transactionIndex (optional)

Type TransactionData

Source: index.ts

Transaction as returned by eth_getTransactionByHash Transaction as returned by eth_getTransactionByHash

string
the blockHash (optional)
number | string
the blockNumber (optional)
number | string
the chainId (optional)
string
the condition (optional)
string
the creates (optional)
string
the data (optional)
string
the from (optional)
number | string
the gas (optional)
number | string
the gasLimit (optional)
number | string
the gasPrice (optional)
string
the hash
string
the input
number | string
the nonce
string
the publicKey (optional)
string
the r (optional)
string
the raw (optional)
string
the s (optional)
string
the standardV (optional)
string
the to
number
the transactionIndex
string
the v (optional)
number | string
the value

Type Transport

Source: index.ts

A Transport-object responsible to transport the message to the handler. A Transport-object responsible to transport the message to the handler.

Promise<>
url:string,
timeout:number)
handles a request by passing the data to the handler
Promise<boolean>
check whether the handler is onlne.
number []
count:number)
generates random numbers (between 0-1)

Package modules/eth

Type Block

Source: modules/eth/serialize.ts

encodes and decodes the blockheader

data:Buffer
| string
creates a Block-Onject from either the block-data as returned from rpc, a buffer or a hex-string of the encoded blockheader
the raw Buffer fields of the BlockHeader
Tx []
the transaction-Object (if given)
bloom
coinbase
difficulty
extra
gas limit
gas used
number
parent hash
receipt trie
sealed fields
state root
timestamp
transactions trie
uncle hash
the blockhash as buffer without the seal fields
hash ()
the blockhash as buffer
the serialized header as buffer

Type Transaction

Source: modules/eth/serialize.ts

Buffer[] of the transaction = Buffer []

Type Receipt

Source: modules/eth/serialize.ts

Buffer[] of the Receipt = [ Buffer ,Buffer ,Buffer ,Buffer , Buffer [] , Buffer [] ]

Type Account

Source: modules/eth/serialize.ts

Buffer[] of the Account = Buffer []

Type serialize

Source: modules/eth/serialize.ts

Class
encodes and decodes the blockheader
Interface
Account-Object
Interface
Block as returned by eth_getBlockByNumber
Interface
LogData as part of the TransactionReceipt
Interface
TransactionReceipt as returned by eth_getTransactionReceipt
Interface
Transaction as returned by eth_getTransactionByHash
Type
Buffer[] of the Account
Type
Buffer[] of the header
Type
Buffer[] of the Receipt
Type
Buffer[] of the transaction
RLP-functions
value= ethUtil.rlp
any
val:any)
converts it to a Buffer with 20 bytes length
hex:string)
converts a hexstring to a block-object
string
block:any)
converts blockdata to a hexstring
any
val:any)
converts it to a Buffer
any
val:any)
converts it to a Buffer with 256 bytes length
any
val:any)
converts it to a Buffer with 32 bytes length
any
val:any)
converts it to a Buffer with 8 bytes length
any
transaction:any)
creates a Transaction-object from the rpc-transaction-data
returns the hash of the object
serialize the data
account:AccountData )
to account
create a Buffer[] from RPC-Response
Object
create a Buffer[] from RPC-Response
create a Buffer[] from RPC-Response
any
val:any)
converts it to a Buffer with a variable length. 0 = length 0
any
val:any)
uint128
any
val:any)
uint64

Type storage

Source: modules/eth/storage.ts

any
pos:number,
arrayIndex:number,
structSize:number,
structPos:number)
calc the storrage array key
any
pos:number,
key:string,
structPos:number)
calcs the storage Map key.
Promise<>
rpc:string,
contract:string,
pos:number,
type:'address'
| 'bytes32'
| 'bytes16'
| 'bytes4'
| 'int'
| 'string',
keyOrIndex:number
| string,
structSize:number,
structPos:number)
get a storage value from the server
string |
data:Buffer ,
storageKey:Buffer )
creates a string from storage.
string
values:Buffer [],
len:number)
concats the storage values to a string.
val:any)
converts any value to BN

Type AccountData

Source: modules/eth/serialize.ts

Account-Object

string
the balance
string
the code (optional)
string
the codeHash
string
the nonce
string
the storageHash

Type BlockHeader

Source: modules/eth/serialize.ts

Buffer[] of the header = Buffer []

Package types

Type RPCRequest

Source: types/types.ts

a JSONRPC-Request with N3-Extension

number | string
the identifier of the request
example: 2 (optional)
the IN3-Config (optional)
'2.0'
the version
string
the method to call
example: eth_getBalance
any []
the params
example: 0xe36179e2286ef405e929C90ad3E70E649B22a945,latest (optional)

Type RPCResponse

Source: types/types.ts

a JSONRPC-Responset with N3-Extension

string
in case of an error this needs to be set (optional)
string | number
the id matching the request
example: 2
the IN3-Result (optional)
the node handling this response (internal only) (optional)
'2.0'
the version
any
the params
example: 0xa35bc (optional)

Type IN3RPCRequestConfig

Source: types/types.ts

additional config for a IN3 RPC-Request

string
the requested chainId
example: 0x1
any
the signature of the client (optional)
number
if given the server will deliver the blockheaders of the following blocks until at least the number in percent of the validators is reached. (optional)
boolean
if true, the request should include the codes of all accounts. otherwise only the the codeHash is returned. In this case the client may ask by calling eth_getCode() afterwards
example: true (optional)
number
if specified, the blocknumber latest will be replaced by blockNumber- specified value
example: 6 (optional)
string []
a list of addresses requested to sign the blockhash
example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679 (optional)
boolean
if true binary-data will be used. (optional)
boolean
if true all data in the response will be proven, which leads to a higher payload. (optional)
boolean
if true binary-data (starting with a 0x) will be refered if occuring again. (optional)
'never'
| 'proof'
| 'proofWithSignature'
defines the kind of proof the client is asking for
example: proof (optional)
string []
if the client sends a array of blockhashes the server will not deliver any signatures or blockheaders for these blocks, but only return a string with a number. (optional)
string
IN3 protocol version that client can specify explicitly in request
example: 1.0.0 (optional)

Type IN3ResponseConfig

Source: types/types.ts

additional data returned from a IN3 Server

number
the current blocknumber.
example: 320126478 (optional)
number
the blocknumber for the last block updating the nodelist. If the client has a smaller blocknumber he should update the nodeList.
example: 326478 (optional)
number
the blocknumber of gthe last change of the validatorList (optional)
the Proof-data (optional)
string
the in3 protocol version.
example: 1.0.0 (optional)

Type IN3NodeConfig

Source: types/types.ts

a configuration of a in3-server.

string
the address of the node, which is the public address it iis signing with.
example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679
number
the capacity of the node.
example: 100 (optional)
string []
the list of supported chains
example: 0x1
number
the deposit of the node in wei
example: 12350000
number
the index within the contract
example: 13 (optional)
number
the properties of the node.
example: 3 (optional)
number
the UNIX-timestamp when the node was registered
example: 1563279168 (optional)
number
the time (in seconds) until an owner is able to receive his deposit back after he unregisters himself
example: 3600 (optional)
number
the UNIX-timestamp when the node is allowed to be deregister
example: 1563279168 (optional)
string
the endpoint to post to

Type Proof

Source: types/types.ts

the Proof-data as part of the in3-section


a map of addresses and their AccountProof (optional)
string
the serialized blockheader as hex, required in most proofs
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)
any []
the serialized blockheader as hex, required in case of finality asked
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)
the Log Proof in case of a Log-Request (optional)
string []
the serialized merle-noodes beginning with the root-node (optional)
string []
the serialized merkle-noodes beginning with the root-node of the previous entry (only for full proof of receipts) (optional)
requested signatures (optional)
any []
the list of transactions of the block
example: (optional)
number
the transactionIndex within the block
example: 4 (optional)
string []
the serialized merkle-nodes beginning with the root-node in order to prrof the transactionIndex (optional)
'transactionProof'
| 'receiptProof'
| 'blockProof'
| 'accountProof'
| 'callProof'
| 'logProof'
the type of the proof
example: accountProof
any []
the list of uncle-headers of the block
example: (optional)

Type LogProof

Source: types/types.ts

a Object holding proofs for event logs. The key is the blockNumber as hex

Type Signature

Source: types/types.ts

Verified ECDSA Signature. Signatures are a pair (r, s). Where r is computed as the X coordinate of a point R, modulo the curve order n.

string
the address of the signing node
example: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679 (optional)
number
the blocknumber
example: 3123874
string
the hash of the block
example: 0x6C1a01C2aB554930A937B0a212346037E8105fB47946c679
string
hash of the message
example: 0x9C1a01C2aB554930A937B0a212346037E8105fB47946AB5D
string
Positive non-zero Integer signature.r
example: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1f
string
Positive non-zero Integer signature.s
example: 0x6d17b34aeaf95fee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda
number
Calculated curve point, or identity element O.
example: 28

Package util

Type AxiosTransport

Source: util/transport.ts

Default Transport impl sending http-requests.

format:'json'
| 'cbor'
| 'jsonRef')
Default Transport impl sending http-requests.
'json' | 'cbor' | 'jsonRef'
the format
Promise<>
url:string,
timeout:number)
handle
Promise<boolean>
is online
number []
count:number)
random

Type cbor

Source: util/cbor.ts

any
val:any)
convert to buffer
any
val:any)
convert to hex
T
val:T ,
cache:string [])
create refs
request:Buffer )
decode requests
responses:Buffer )
decode responses
requests:RPCRequest [])
turn
responses:RPCResponse [])
encode responses
T
val:T ,
cache:string [])
resolve refs

Type transport

Source: util/transport.ts

Class
Default Transport impl sending http-requests.
Interface
A Transport-object responsible to transport the message to the handler.

Type util

Source: util/util.ts

the BN
value= ethUtil.BN
any
This file is part of the Incubed project.
value= require('buffer').Buffer
T
res:T )
check a RPC-Response for errors and rejects the promise if found
number []
len:number,
limit:number,
seed:Buffer ,
result:number [])
create random indexes
string
hex:string)
fix length
string
pk:string)
returns a address from a private key
data:Block )
get signer
string
val:string,
minLength:number,
fill:string)
padEnd for legacy
string
val:string,
minLength:number,
fill:string)
padStart for legacy
Promise<any>
self:any,
fn:any,
args:any [])
simple promisy-function
val:any)
convert to BigNumber
any
val:any,
len:number)
converts any value as Buffer
if len === 0 it will return an empty Buffer if the value is 0 or ‘0x00’, since this is the way rlpencode works wit 0-values.
string
val:any,
bytes:number)
converts any value as hex-string
string
key:string
| number)
removes all leading 0 in the hexstring
number
val:any)
converts to a js-number
string
val:string)
removes all leading 0 in a hex-string
string
val:any)
to utf8
JSON
``object``
the aliases

Type validate

Source: util/validate.ts

the ajv instance with custom formatters and keywords
value= new Ajv()
void
ob:any,
def:any)
validate
void
validates the data and throws an error in case they are not valid.