relay_sendTransaction
RPC call. ITX will first check if you have sufficient balance, then lock a portion of your funds and relay the transaction on your behalf to the Ethereum network.relay_getBalance
RPC call.itx.eth
.ethers.js
library, but you're by no means limited to these programming choices.You can find a full collection of scripts that showcase an end-to-end interaction with ITX in this Github repository.
ethers.js
built-in InfuraProvider
class, using your dedicated Infura URL.relay_getBalance
method:Note: Your deposit will be registered after 10 block confirmations.
keccak256
hash of the ABI argument encoded list of variables [to, data, gas, chainId, schedule]
with types address, bytes, uint, uint, string
(in that order)NoteThe signature generation logic is already implemented in most web3-compatible libraries, so for example if you're using ethers.js, you only need to pass in the relay transaction hash to thesignMessage
function, as shown in the example below.
relay_sendTransaction
method and instruct ITX to relay your requests to the Ethereum network.NoteITX supports any type of transaction that doesn't directly carry Ether (i.e. whosevalue
field is set to0
). You can use it for deploying your own contracts or calling arbitrary contract methods, and you can also use it for enabling your users to interact with your Dapp, even if they don't hold any Ether. However, you cannot use ITX to send Ether without the intermediation of a wallet contract.
echo
method of a simple demo contract. This contract is deployed at the same address on all supported Ethereum networks.relay_sendTransaction
requires two parameters:eth_sendRawTransaction
, the relay request returns a relayTransactionHash
instead of an Ethereum transaction hash. The ITX service is responsible for taking your relay request, packing it into an Ethereum transaction, and then gradually increasing the fee until the transaction is mined. The Ethereum Transaction hash is changed every time the fee is bumped and the previous hash is no longer reliable for tracking its status.relay_getTransactionStatus
that returns the list of Ethereum Transaction hashes which have been broadcast for the supplied relayTransactionHash
. You can then check client-side whether any of the transaction hashes were mined.fast
targets getting your transaction mined in ~6 blocks (1:30 min)slow
targets getting your transaction mined in ~200 blocks (1 hour)gas used * gas price
gas used * a flat gwei amount
5% of the gas price, capped at 10 gwei
gas used * 1 gwei
gas used * 1 gwei
gas used * 1 gwei
gas used * 1 gwei
gas used * 20 gwei
ImportantThefrom
address of the final transaction will always be set to an internal ITX wallet address (chosen by the ITX system), whereas the finalto
anddata
fields are chosen by you and defined in the original relay request (as parameters in yourrelay_sendTransaction
call).
msg.sender
in the contracts you're interacting with. For every managed transaction, the contracts will see the method call as originating from one of the ITX wallets. The best practice for working around this challenge is to encode a meta transaction in the data
field of your initial request.msg.sender
which is the immediate caller of the smart contract. More often than not, an Ethereum Transaction is the direct caller of the smart contract and the msg.sender
is computed as the from
address of the transaction.from
address of the final transaction is not under your direct control. To solve this problem, the community have worked on the concept of a meta-transaction which requires the user to send a signed message to a smart contract before an action is executed.Meta transaction compatibility with ITX You can use ITX as a building block to implement any meta transaction flow. Your choice of on-chain authentication architecture will determine theto
anddata
fields in your ITX transaction, but it will not impact how you interact with ITX.
to
and data
parameters it receives from you, so it will relay your transactions regardless of the meta transaction flow you decide to use.msg.sender
with an ecrecover
that verifies the user's signed message. If the user only needs to interact with your smart contract, then it is a simple solution. However, if the user needs to interact with ERC20 tokens that are not meta-transaction compatible, then you may run into limitations still.msg.sender
of the target contract is the wallet contract address. There are also other benefits to wallet contracts such as batching two or more transactions together. However it does require a setup phase as the user must transfer assets to their wallet contract. You can pick any wallet contract implementation to work with ITX.POST /{apiKey}#relay_sendTransaction
eth_sendRawTransaction
, the relay request returns a relayTransactionHash instead of a single Ethereum transaction hash.Body parameter
POST /{apiKey}#relay_getTransactionStatus
receivedTime
returns the timestamp when ITX has received your relay request.broadcasts
returns an array of Ethereum transaction objects. Multiple Ethereum transactions can be returned because ITX uses a gas price escalation schedule to gradually increases the fee until your transaction is mined. Every time the gas price is changed, a new Ethereum transaction (with a different Ethereum transaction hash) is broadcast to the network and added to the broadcast list.Body parameter
POST /{apiKey}#relay_getBalance
Body parameter