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 Transportany
the AxiosTransportvalue=transport.AxiosTransport
the EthAPIvalue=_ethapi.default
any
the cborvalue=_cbor
the chainAliasesvalue=aliases
the chainDatavalue=_chainData
number
[] helper function creating deterministic random indexes used for limited nodelists the headervalue=_header
the serializevalue=_serialize
any
the storagevalue=_storage
any
the transportvalue=_transport
the typeDefsvalue=types.validationDef
any
the utilvalue=_util
any
the validatevalue=validateOb.validate
Package client¶
Type Client¶
Source: client/Client.ts
Client for N3.
number
the defaultMaxListenersnumber
listener count config:Partial<IN3Config> ,transport:Transport ) creates a new Client. the defConfig the eth the ipfs configthis
add listenerPromise<any>
call ( sends a simply RPC-Requestvoid
clearStats () clears all stats and weights, like blocklisted nodesany
create web3 providerboolean
emit eventNames () event names chainId:string
) Context for a specific chain including cache and chainSpecs.number
get max listenersnumber
listener count Function [] listenersthis
offthis
onthis
oncethis
prepend listenerthis
prepend once listener Function [] raw listenersthis
remove all listenersthis
remove listenerPromise<>
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. sendRPC ( sends a simply RPC-Requestthis
n:number
) set max listenersPromise<void>
fetches the nodeList from the servers.Promise<void>
config:IN3Config ) update white list nodesPromise<boolean>
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.
Context for a specific chain including cache and chainSpecs.string
the chainId ChainSpec [] the chainSpec the client the genericCachenumber
the lastValidatorChange the modulestring
the registryId (optional)void
prefix:string
) clear cache block:number
) returns the chainspec for th given block numberstring
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 internallyvoid
initCache () init cachevoid
key:string
,value:string
) put in cachevoid
whiteList:Set<string> ,whiteListContract:string
) update cache
Type Module¶
Source: client/modules.ts
string
the name Context for a specific chain including cache and chainSpecs.Promise<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-nodestring
the address of this accountstring
the balance of this account as hexstring
the code of this account as hex ( if required) (optional)string
the codeHash of this account as hexstring
the nonce of this account as hexstring
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 blockheaderexample: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704bany
[] the serialized blockheader as hex, required in case of finality askedexample: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)number
the transaction log indexstring
[] the merkleProofnumber
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 Enginesexample: 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 checkexample: true (optional)
Type IN3Client¶
Source: index.ts
Client for N3. Client for N3.
number
the defaultMaxListenersnumber
listener count config:Partial<IN3Config> ,transport:Transport ) creates a new Client. the defConfig the eth the ipfs configthis
add listenerPromise<any>
call ( sends a simply RPC-Requestvoid
clearStats () clears all stats and weights, like blocklisted nodesany
create web3 providerboolean
emit eventNames () event names chainId:string
) Context for a specific chain including cache and chainSpecs.number
get max listenersnumber
listener count Function [] listenersthis
offthis
onthis
oncethis
prepend listenerthis
prepend once listener Function [] raw listenersthis
remove all listenersthis
remove listenerPromise<>
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. sendRPC ( sends a simply RPC-Requestthis
n:number
) set max listenersPromise<void>
fetches the nodeList from the servers.Promise<void>
config:IN3Config ) update white list nodesPromise<boolean>
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 nodesexample: 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 newerexample: true (optional)boolean
if true the in3 client will only include nodes that support binary encordingexample: 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: 0x1string
main chain-registry contractexample: 0xe36179e2286ef405e929C90ad3E70E649B22a945 (optional)number
timeout after which the owner is allowed to receive its stored deposit. This information is also important for the clientexample: 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 encodingexample: json (optional)boolean
if true the in3 client will include http nodesexample: 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() afterwardsexample: 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 requestsexample: 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 rejectedexample: 10 (optional)number
number of number of blocks cached in memoryexample: 100 (optional)number
number of max bytes used to cache the code in memoryexample: 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 chainsexample: 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 responseexample: true (optional)boolean
if true the in3 client will filter out nodes which are providing no proofexample: true (optional)number
if specified, the blocknumber latest will be replaced by blockNumber- specified valueexample: 6 (optional)number
the number of request send when getting a first answerexample: 3boolean
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 requestedexample: 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 nodesexample: 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 clientexample: 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: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679number
the capacity of the node.example: 100 (optional)string
[] the list of supported chainsexample: 0x1number
the deposit of the node in weiexample: 12350000number
the index within the contractexample: 13 (optional)number
the properties of the node.example: 3 (optional)number
the UNIX-timestamp when the node was registeredexample: 1563279168 (optional)number
the time (in seconds) until an owner is able to receive his deposit back after he unregisters himselfexample: 3600 (optional)number
the UNIX-timestamp when the node is allowed to be deregisterexample: 1563279168 (optional)string
the endpoint to post toexample: https://in3.slock.it
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 msexample: 240 (optional)number
blacklisted because of failed requests until the timestampexample: 1529074639623 (optional)number
timestamp of the last request in msexample: 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 nodeListstring
the url of the client in case the registry is not on the same chain. (optional)string
the url of the clientnumber
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 chainIdexample: 0x1any
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() afterwardsexample: true (optional)number
if specified, the blocknumber latest will be replaced by blockNumber- specified valueexample: 6 (optional)string
[] a list of addresses requested to sign the blockhashexample: 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 forexample: 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 requestexample: 1.0.0 (optional)string
address of whitelist contract if added in3 server will register it in watchand 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 versionexample: 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 proofsexample: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)any
[] the serialized blockheader as hex, required in case of finality askedexample: 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) Signature [] requested signatures (optional)any
[] the list of transactions of the blockexample: (optional)number
the transactionIndex within the blockexample: 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 proofexample: accountProofany
[] the list of uncle-headers of the blockexample: (optional)
Type RPCRequest¶
Source: index.ts
a JSONRPC-Request with N3-Extension a JSONRPC-Request with N3-Extension
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 requestexample: 2 the IN3-Result (optional) the node handling this response (internal only) (optional)'2.0'
the versionany
the paramsexample: 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 nodeexample: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679 (optional)number
the blocknumberexample: 3123874string
the hash of the blockexample: 0x6C1a01C2aB554930A937B0a212346037E8105fB47946c679string
hash of the messageexample: 0x9C1a01C2aB554930A937B0a212346037E8105fB47946AB5Dstring
Positive non-zero Integer signature.rexample: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1fstring
Positive non-zero Integer signature.sexample: 0x6d17b34aeaf95fee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbdanumber
Calculated curve point, or identity element O.example: 28
Package modules/eth¶
Type EthAPI¶
Source: modules/eth/api.ts
client:Client ) constructor the client the signer (optional)Promise<number>
blockNumber () Returns the number of most recent block. (as number)Promise<string>
call (tx:Transaction ,block:BlockType ) Executes a new message call immediately without creating a transaction on the block chain.Promise<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>
chainId () Returns the EIP155 chain ID used for transaction signing at the current best block. Null is returned if not available. contract atany
decode event dataPromise<number>
tx:Transaction ) 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>
gasPrice () Returns the current price per gas in wei. (as number) 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>
block:Hash ) Returns the number of transactions in a block from a block matching the given block hash.Promise<number>
block:Hash ) Returns the number of transactions in a block from a block matching the given block number.Promise<string>
Returns code at a given address.Promise<>
id:Quantity ) Polling method for a filter, which returns an array of logs which occurred since last poll.Promise<>
id:Quantity ) Returns an array of all logs matching filter with given id.Promise<>
Returns an array of all logs matching a given filter object.Promise<string>
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. hash:Hash ) Returns the information about a transaction requested by transaction hash.Promise<number>
Returns the number of transactions sent from an address. (as number) hash:Hash ) 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>
hash:Hash ) Returns the number of uncles in a block from a block matching the given block hash.Promise<number>
block:BlockType ) Returns the number of uncles in a block from a block matching the given block hash. hash messagePromise<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>
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>
data:Data ) Creates new message call transaction or a contract creation for signed transactions.Promise<>
args:TxRequest ) sends a Transaction signs any kind of message using the x19Ethereum Signed Message:n-prefixPromise<>
syncing () Returns the current ethereum protocol version. id:Quantity ) 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>
call contractPromise<>
get chain data
Type header¶
Source: modules/eth/header.ts
Interface Authority specification for proof of authority chains Interface the HistoryEntryPromise<void>
add aura validatorsvoid
add clique validatorsPromise<number>
blockHeaders:any
[],getChainSpec:) verify a Blockheader and returns the percentage of finalityvoid
check for finalityPromise<void>
ctx:ChainContext ,validators:DeltaHistory<string> ) check for validators b:Block ,ctx:ChainContext ) get chain spec data:Block ) get clique signer get signer
Type Signer¶
Source: modules/eth/api.ts
client:Client ,tx:Transaction ) optiional method which allows to change the transaction-data before sending it. This can be used for redirecting it through a multisig. 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 ABI¶
Source: modules/eth/api.ts
boolean
the anonymous (optional)boolean
the constant (optional) ABIField [] the inputs (optional)string
the name (optional) ABIField [] 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 blockstring
| [] 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 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 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 HistoryEntry¶
Source: modules/eth/header.ts
number
the block |string
[] the proofstring
[] the validators
Package modules/ipfs¶
Type IpfsAPI¶
Source: modules/ipfs/api.ts
simple API for IPFS
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 Delta<T> [] the datavoid
add state T [] getData (index:number
) get datanumber
getLastIndex () get last indexvoid
deltas:string
[]) load delta stringsstring
[] to delta strings
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 AxiosTransportvalue=_transport.AxiosTransport
the Blockvalue=_serialize.Block
any
address (val:any
) converts it to a Buffer with 20 bytes length hex:string
) converts a hexstring to a block-objectany
bytes (val:any
) converts it to a Bufferany
bytes32 (val:any
) converts it to a Buffer with 32 bytes lengthany
bytes8 (val:any
) converts it to a Buffer with 8 bytes length the cborvalue=_cbor
the chainAliasesvalue=_util.aliases
number
[] create random indexesany
createTx (transaction:any
) creates a Transaction-object from the rpc-transaction-data get signer returns the hash of the object the rlpvalue=_serialize.rlp
the serializevalue=_serialize
the storagevalue=_storage
Buffer [] account:AccountData ) to account Buffer [] block:BlockData ) create a Buffer[] from RPC-ResponseObject
r:ReceiptData ) create a Buffer[] from RPC-Response Buffer [] tx:TransactionData ) create a Buffer[] from RPC-Response the transportvalue=_transport
any
uint (val:any
) converts it to a Buffer with a variable length. 0 = length 0any
uint128 (val:any
) uint128any
uint64 (val:any
) uint64 the utilvalue=_util
the validatevalue=_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 difficultystring
the extraDatastring
|number
the gasLimitstring
|number
the gasUsedstring
the hashstring
the logsBloomstring
the minerstring
the mixHash (optional)string
|number
the nonce (optional)string
|number
the numberstring
the parentHashstring
the receiptRoot (optional)string
the receiptsRootstring
[] the sealFields (optional)string
the sha3Unclesstring
the stateRootstring
|number
the timestampany
[] the transactions (optional)string
the transactionsRootstring
[] the uncles (optional)
Type LogData¶
Source: index.ts
LogData as part of the TransactionReceipt LogData as part of the TransactionReceipt
string
the addressstring
the blockHashstring
the blockNumberstring
the datastring
the logIndexboolean
the removedstring
[] the topicsstring
the transactionHashstring
the transactionIndexstring
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) LogData [] the logsstring
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 hashstring
the inputnumber
|string
the noncestring
the publicKey (optional)string
the r (optional)string
the raw (optional)string
the s (optional)string
the standardV (optional)string
the tonumber
the transactionIndexstring
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.
Package modules/eth¶
Type Block¶
Source: modules/eth/serialize.ts
encodes and decodes the blockheader
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 Buffer [] sealed fields state root timestamp transactions trie uncle hash bareHash () the blockhash as buffer without the seal fields hash () the blockhash as buffer the serialized header as buffer
Type Receipt¶
Source: modules/eth/serialize.ts
Buffer[] of the Receipt = [ Buffer ,Buffer ,Buffer ,Buffer , Buffer [] , 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-functionsvalue=ethUtil.rlp
any
address (val:any
) converts it to a Buffer with 20 bytes length hex:string
) converts a hexstring to a block-objectstring
block:any
) converts blockdata to a hexstringany
bytes (val:any
) converts it to a Bufferany
bytes256 (val:any
) converts it to a Buffer with 256 bytes lengthany
bytes32 (val:any
) converts it to a Buffer with 32 bytes lengthany
bytes8 (val:any
) converts it to a Buffer with 8 bytes lengthany
createTx (transaction:any
) creates a Transaction-object from the rpc-transaction-data returns the hash of the object serialize the data Buffer [] account:AccountData ) to account Buffer [] block:BlockData ) create a Buffer[] from RPC-ResponseObject
r:ReceiptData ) create a Buffer[] from RPC-Response Buffer [] tx:TransactionData ) create a Buffer[] from RPC-Responseany
uint (val:any
) converts it to a Buffer with a variable length. 0 = length 0any
uint128 (val:any
) uint128any
uint64 (val:any
) uint64
Type storage¶
Source: modules/eth/storage.ts
any
pos:number
,arrayIndex:number
,structSize:number
,structPos:number
) calc the storrage array keyany
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 serverstring
| creates a string from storage.string
values:Buffer [],len:number
) concats the storage values to a string. toBN (val:any
) converts any value to BN
Type AccountData¶
Source: modules/eth/serialize.ts
Account-Object
string
the balancestring
the code (optional)string
the codeHashstring
the noncestring
the storageHash
Package types¶
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 requestexample: 2 the IN3-Result (optional) the node handling this response (internal only) (optional)'2.0'
the versionany
the paramsexample: 0xa35bc (optional)
Type IN3RPCRequestConfig¶
Source: types/types.ts
additional config for a IN3 RPC-Request
string
the requested chainIdexample: 0x1any
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() afterwardsexample: true (optional)number
if specified, the blocknumber latest will be replaced by blockNumber- specified valueexample: 6 (optional)string
[] a list of addresses requested to sign the blockhashexample: 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 forexample: 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 requestexample: 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: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679number
the capacity of the node.example: 100 (optional)string
[] the list of supported chainsexample: 0x1number
the deposit of the node in weiexample: 12350000number
the index within the contractexample: 13 (optional)number
the properties of the node.example: 3 (optional)number
the UNIX-timestamp when the node was registeredexample: 1563279168 (optional)number
the time (in seconds) until an owner is able to receive his deposit back after he unregisters himselfexample: 3600 (optional)number
the UNIX-timestamp when the node is allowed to be deregisterexample: 1563279168 (optional)string
the endpoint to post toexample: https://in3.slock.it
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 proofsexample: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbda6463a8f1ebb14f3aff6b19cb91acf2b8ec1ffee98c0437b4ac839d8a2ece1b18166da704b (optional)any
[] the serialized blockheader as hex, required in case of finality askedexample: 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) Signature [] requested signatures (optional)any
[] the list of transactions of the blockexample: (optional)number
the transactionIndex within the blockexample: 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 proofexample: accountProofany
[] the list of uncle-headers of the blockexample: (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 nodeexample: 0x6C1a01C2aB554930A937B0a2E8105fB47946c679 (optional)number
the blocknumberexample: 3123874string
the hash of the blockexample: 0x6C1a01C2aB554930A937B0a212346037E8105fB47946c679string
hash of the messageexample: 0x9C1a01C2aB554930A937B0a212346037E8105fB47946AB5Dstring
Positive non-zero Integer signature.rexample: 0x72804cfa0179d648ccbe6a65b01a6463a8f1ebb14f3aff6b19cb91acf2b8ec1fstring
Positive non-zero Integer signature.sexample: 0x6d17b34aeaf95fee98c0437b4ac839d8a2ece1b18166da704b86d8f42c92bbdanumber
Calculated curve point, or identity element O.example: 28
Package util¶
Type AxiosTransport¶
Source: util/transport.ts
Default Transport impl sending http-requests.
Type cbor¶
Source: util/cbor.ts
any
val:any
) convert to bufferany
val:any
) convert to hex val:T ,cache:string
[]) create refs RPCRequest [] request:Buffer ) decode requests RPCResponse [] responses:Buffer ) decode responses requests:RPCRequest []) turn responses:RPCResponse []) encode responses 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 BNvalue=ethUtil.BN
any
This file is part of the Incubed project.value=require('buffer').Buffer
res:T ) check a RPC-Response for errors and rejects the promise if foundnumber
[] create random indexesstring
hex:string
) fix lengthstring
pk:string
) returns a address from a private key get signerstring
padEnd (val:string
,minLength:number
,fill:string
) padEnd for legacystring
padStart (val:string
,minLength:number
,fill:string
) padStart for legacyPromise<any>
self:any
,fn:any
,args:any
[]) simple promisy-function toBN (val:any
) convert to BigNumberany
toBuffer (val:any
,len:number
) converts any value as Bufferif 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
toHex (val:any
,bytes:number
) converts any value as hex-stringstring
removes all leading 0 in the hexstringnumber
toNumber (val:any
) converts to a js-numberstring
val:string
) removes all leading 0 in a hex-stringstring
toUtf8 (val:any
) to utf8 JSON ``object`` the aliases
Type validate¶
Source: util/validate.ts
the ajv instance with custom formatters and keywordsvalue=new Ajv()
void
validate (ob:any
,def:any
) validatevoid
fn:Ajv.ValidateFunction ,ob:any
) validates the data and throws an error in case they are not valid.