Transaction Relay (TX)
Create Meta Transactions
Create a new gas-less transaction that is EIP-2771 compatible.
Meta-transactions (gas-less transactions)
Tx Relay is a general-purpose relayer, in the sense that you can use it to send any transaction you want to your contracts. In particular, it can also be used for relaying meta-transactions on behalf of your users. You just need to decide whether or not to relay a given meta-transaction, and then invoke TX Relay for sending it.
This way, you can offer a full gasless experience in your dapp. The same applies to other sidechains supported by Utiliti.
Send EIP-2771 compatible meta-transactions
Tx Relay has a modified API call which additionally takes in a "forwarder_address". This must be a valid Identity Wallet which has been enabled for handling meta-transactions. The transaction will be sent through the forwarder wallet and the "from_address" will be appended to the end of the data.
const response = await fetch('https://api.utiliti.ai/transactions/meta', { method: "POST", headers: { "Content-Type": "application/json", "X-API-key": "<YOUR_API_KEY_HERE>" }, body: JSON.stringify({ "chain_id": 5, // Ethereum Goerli "from_address": "0xC96524bbeB102d9246ED6a4A07909c7f1Dd2AF8e", // overrides _msgSender() in EIP2771 compatible contracts "to_address": "0x23C96144969A9d7c802a96CbF0d539210d176B38", // Contract Address "params": { // Contract Parameters "from": "0x57a3cdee5886f8f0508f6c0e77c8ec4e74b0238a", "to": "0xb1437af7c9735529adb3d33288f6fea4f494e910", "tokenId": 2 }, "contract_function_name": "safeTransferFrom", "abi": "<YOUR_CONTRACT_ABI>", "gas_limit": 200000, "gas_strategy": "FAST" "forwarder_address": "0x0EE553435DE5F9761fdB7b92daa13A28Eb7b7419" // Relay Address }) })
SDK coming soon...
CURL *hnd = curl_easy_init(); curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(hnd, CURLOPT_URL, "https://api.utiliti.ai/transactions/meta"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "accept: application/json"); headers = curl_slist_append(headers, "content-type: application/json"); headers = curl_slist_append(headers, "X-API-key: <YOUR_API_KEY_HERE>"); curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"chain_id\":5,\"from_address\":\"0xC96524bbeB102d9246ED6a4A07909c7f1Dd2AF8e\",\"to_address\":\"0x23C96144969A9d7c802a96CbF0d539210d176B38\",\"params\":{\"from\":\"0x57a3cdee5886f8f0508f6c0e77c8ec4e74b0238a\",\"to\":\"0xb1437af7c9735529adb3d33288f6fea4f494e910\",\"tokenId\":2},\"contract_function_name\":\"safeTransferFrom\",\"abi\":\"<YOUR_CONTRACT_ABI>\",\"gas_limit\":200000,\"gas_strategy\":\"FAST\",\"forwarder_address\":\"0x0EE553435DE5F9761fdB7b92daa13A28Eb7b7419\"}"); CURLcode ret = curl_easy_perform(hnd);
curl --request POST \ --url https://api.utiliti.ai/transactions/meta \ --header 'X-API-key: <YOUR_API_KEY_HERE>' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data ' { "chain_id": 5, "from_address": "0xC96524bbeB102d9246ED6a4A07909c7f1Dd2AF8e", "to_address": "0x23C96144969A9d7c802a96CbF0d539210d176B38", "params": { "from": "0x57a3cdee5886f8f0508f6c0e77c8ec4e74b0238a", "to": "0xb1437af7c9735529adb3d33288f6fea4f494e910", "tokenId": 2 }, "contract_function_name": "safeTransferFrom", "abi": "<YOUR_CONTRACT_ABI>", "gas_limit": 200000, "gas_strategy": "FAST", "forwarder_address": "0x0EE553435DE5F9761fdB7b92daa13A28Eb7b7419" } '
import requests url = "https://api.utiliti.ai/transactions/meta" payload = { "chain_id": 5, "from_address": "0xC96524bbeB102d9246ED6a4A07909c7f1Dd2AF8e", "to_address": "0x23C96144969A9d7c802a96CbF0d539210d176B38", "params": { "from": "0x57a3cdee5886f8f0508f6c0e77c8ec4e74b0238a", "to": "0xb1437af7c9735529adb3d33288f6fea4f494e910", "tokenId": 2 }, "contract_function_name": "safeTransferFrom", "abi": "<YOUR_CONTRACT_ABI>", "gas_limit": 200000, "gas_strategy": "FAST", "forwarder_address": "0x0EE553435DE5F9761fdB7b92daa13A28Eb7b7419" } headers = { "accept": "application/json", "content-type": "application/json", "X-API-key": "<YOUR_API_KEY_HERE>" } response = requests.post(url, json=payload, headers=headers) print(response.text)