Using API
Use our APIs to easily implement meta transactions!
Note:
Before using this API, make sure you have Trusted Forwarder support in your smart contracts i.e., you have removed the dependency on msg.sender
property from your smart contracts and trusted forwarder is added.
/api/v2/meta-tx/native
POST
https://api.biconomy.io/api/v2/meta-tx/native
Our API lets you relay transactions directly to your smart contract without your end users having to pay any transaction/gas fee. Just register your dApp on the developer dashboard, upload your smart contracts as meta transaction type as Trusted Forwarder and select your methods in which you want to enable native meta transaction support.
Headers
x-api-key
string
API key present on your dashboard for your DApp after DApp registration. This is specific to DApp registered.
Request Body
signatureType
string
Signature type chosen by the developer to sign the transaction message. Accepted values are EIP712_SIGN and PERSONAL_SIGN. If omitted personal signature will be assumed by the server and will expect only two parameters (signature and request) in params.
gasLimit
string
Gas limit to be set in the transaction. It can be a decimal number or hexadecimal string. If omitted web3 estimateGas method will be used to calculate the gasLimit for the transaction.
from
string
User client wallet public address who is supposed to be sending the transaction eg. metamask wallet address or portis wallet address.
params
array
Array of all the parameters required to call the execute methods of the trusted forwarder depending on the signature type. Read more about this in below section
apiId
string
API id corresponding to the method you want to call in your smart contract. It can be found on the dashboard under 'Manage APIs' section.
to
string
Target Contract Address.
Example Curl Request
If signature type is personal sign, (assumed default if signatureType parameter is omitted in API request body) params are [request, signature].
params = [request, sig];
For EIP2771, below is an example code on how to use Biconomy helpers JS to build request, domain separator and data to sign for each signature type and then send API request to the Biconomy servers where our relayer infrastructure will process your transaction.
Sample code
Great! Once your parameters are built you are ready to make the API call to send gasless transactions!
Congratulations 👏
You're now ready to use the trusted forwarder approach and enable gasless transactions in your dApp using SDK and/or APIs. Check out other implementations and in-depth technical details in the following sections.
Last updated
Was this helpful?