GP - Transferring out from a Gas Pump Address

This article covers what steps you need to follow to transfer assets from a "Slave GP Contract Address". The Fee Estimate is also included. Check the full Gas Pump guide at the following link.

Steps

Step_1: Gather the transfer parameter details

  1. Confirm the EVM network where the transaction will be executed.
  2. Confirm your "Master GP Address" and network match.
  3. Confirm the "Slave GP Contract Address" and network match.
  4. Confirm the "Slave GP Contract Address" has been "Activated" - Additional details in the guide.

Step_2: Estimate the transfer fees

Gas Pump is a Smart Contract. As such, a standard transfer fee estimate won't be sufficient. If you want to manually calculate the transfer fees, and set the fee amount, you need to use our dedicated GP Fee Estimate endpoint.

Request Example:

  • Request Body Schema: EstimateFeeTransferFromCustodial
  • Returns the estimatedGasPrice and GasLimit
curl --location 'https://api.tatum.io/v3/blockchain/estimate' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
    "chain": "ETH",
    "type": "TRANSFER_CUSTODIAL", //For Gas Pump transfers
    "tokenType": 0, // ERC-20 token transfer == 0
    "recipient": "0x5593549ead3b3bd6e4b049ed607ec0f422208298",
    "contractAddress": "0x03cee0939F57855EB95437f4a0EFA7B1AfBFA4c6", //The ERC-20 ContractAddress
    "sender": "0xc1eb70a67e8fd5ff1863c22d4f2856cc7953a7d2", // Your "Master GP Address"
    "custodialAddress": "0x73b10492E49B7Ce4cc8dD7F80F38147Ad8DA5Bdf",//Your "Slave GP Contract Address"
    "amount": "10"
}'
//Response:
{
  "gasLimit": 68474,
  "gasPrice": 49.863787952
}

Step_3: Transfer out from a "Slave GP Contract Address" with manual fees

  • v3 REST API endpoint - You can send only one asset per API call. If you want to send multiple assets, use the following v3 REST API endpoint
  • In your custodial application, implement a mechanism that allows your End-users to send (transfer) assets from their deposit addresses ("Slave GP Contract Address") to outside your Exchange or Application.

Request Example:

  • Returns the hash (ID) of the transfer transaction
curl --location 'https://api.tatum.io/v3/blockchain/sc/custodial/transfer' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
    "chain": "ETH",
    "custodialAddress": "0x73b10492E49B7Ce4cc8dD7F80F38147Ad8DA5Bdf", // Your "Slave GP Contract Address"
    "recipient": "0x5593549ead3b3bd6e4b049ed607ec0f422208298",
    "contractType": 0, // ERC-20 token transfer == 0
    "amount": "10",
    "tokenAddress":"0x03cee0939F57855EB95437f4a0EFA7B1AfBFA4c6", // The ContractAddress of the ERC-20 token
    "fromPrivateKey": "####" // Your "Master GP Address" PrivateKey
    "fee": {
        "gasLimit": "68474",
        "gasPrice": "50"
    }
}'
//Response:
{
    "txId": "0x0c6daf3044b562d01c26874e3b1163ed58cc1ba3ce8aa646a01789389e774beb"
}

Good to Know

  • Example transactions performed over Ethereum-Sepolia Testnet
  • Master GP Address covers the gas fees for sending assets.
  • Ensure that Master GP Address always has enough funds to cover gas fees.
  • Only activated "Slave GP Contract Address can transfer out assets.