Transaction How To's

The Transactions API enables you to create and send various types of cryptocurrency transactions across multiple blockchain networks. This guide covers all supported transaction types with detailed examples and parameter descriptions.

Base URL: https://developers.bitpowr.com/api/v1

Authentication: Bearer token required in Authorization header

API Endpoints

1. Estimate Transaction Fee

POST /transactions/estimate - Get estimated transaction fees before sending

2. Create Transaction

POST /transactions - Create and send blockchain transactions


Parameter Format Updates

Important: The API supports both legacy and modern parameter formats:

  • Legacy Format (deprecated): fromAddress, cryptoAmount, address
  • Modern Format (recommended): from, tos, fromUtxo

Modern Format Structure

  • from: Array of sender addresses (strings)
  • tos: Array of objects with address and value properties
  • fromUtxo: Array of UTXO objects for Bitcoin-like chains

Transaction Fee Estimation

Before creating transactions, you can estimate the required fees using the estimation endpoint.

Endpoint

POST /transactions/estimate

Request Headers

Content-Type: application/json
Authorization: Bearer <encodedToken>

Required Parameters

ParameterTypeRequiredDescription
chainstringYesBlockchain network (BITCOIN, ETHEREUM, BSC, POLYGON, etc.)
walletIdstringYesUnique identifier for the wallet
tokenstringYesToken type (USDC, USDT, BTC, etc.)
tosarrayYesArray of destination objects

Optional Parameters

ParameterTypeDescription
accountIdstringAccount UID for the transaction
subAccountIdstringSub-account UID
assetIdstringAsset UID
operationstringCustom operation (transfer, approve, transferFrom, etc.)
fromarrayArray of sender addresses
fromUtxoarrayUTXO objects for Bitcoin transactions
feeAddressstringAddress to pay transaction fees
spenderstringAddress for approve operations

Example Request

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions/estimate \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "chain": "ETHEREUM",
          "walletId": "e3455-15b5-46ad-84de-34555",
          "token": "USDC",
          "tos": [{
              "address": "0x1180a4c0c71b5eb0256edcffcc3389f1f085c502",
              "value": "9"
          }],
          "from": ["0x40fa00fe4a0a655240fede3149e9ea55118241e2"]
      }'

Response Format

{
  "fee": {
    "fast": {
      "gasFee": "0.000119673736860231",
      "gasLimit": 46467,
      "gasPrice": "2575456493"
    },
    "slow": {
      "gasFee": "0.0000697005",
      "gasLimit": 46467,
      "gasPrice": "1500000000"
    },
    "medium": {
      "gasFee": "0.000049973236860231",
      "gasLimit": 46467,
      "gasPrice": "1075456493"
    }
  }
}

1. Send ERC20 Token Transaction

Send ERC20 tokens on the Ethereum network. Gas fees can be specified manually or calculated automatically.

Endpoint

POST /transactions

Request Headers

Content-Type: application/json
Authorization: Bearer <encodedToken>

Legacy Parameters (Deprecated)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesToken type (e.g., "TUSDC_ETH")
cryptoAmountstringYesAmount of tokens to send
fromAddressstringYesSender's Ethereum address
addressstringYesRecipient's Ethereum address
gasLimitstringNoMaximum gas units to use
gasPricestringNoGas price in wei
feestringNoTransaction fee in ETH
descriptionstringNoTransaction description

Modern Parameters (Recommended)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesToken type (e.g., "TUSDC_ETH")
fromarrayYesArray of sender addresses
tosarrayYesArray of destination objects
gasLimitstringNoMaximum gas units to use
gasPricestringNoGas price in wei
feestringNoTransaction fee in ETH
descriptionstringNoTransaction description

Example Request (Legacy Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "e3455-15b5-46ad-84de-34555",
          "assetType": "TUSDC_ETH",
          "cryptoAmount": "9",
          "fromAddress": "0x40fa00fe4a0a655240fede3149e9ea55118241e2",
          "address": "0x1180a4c0c71b5eb0256edcffcc3389f1f085c502",
          "gasLimit": "40000",
          "gasPrice": "2000000009",
          "fee": "0.00018",
          "description": "Testing Here"
      }'

Example Request (Modern Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "e3455-15b5-46ad-84de-34555",
          "assetType": "TUSDC_ETH",
          "from": ["0x40fa00fe4a0a655240fede3149e9ea55118241e2"],
          "tos": [{
              "address": "0x1180a4c0c71b5eb0256edcffcc3389f1f085c502",
              "value": "9"
          }],
          "gasLimit": "40000",
          "gasPrice": "2000000009",
          "fee": "0.00018",
          "description": "Testing Here"
      }'

Note: Gas fee parameters (gasLimit, gasPrice, fee) are optional. If not provided, they will be calculated automatically.


2. Send Bitcoin Transaction

Send Bitcoin using standard transaction format.

Legacy Parameters (Deprecated)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesMust be "BTC"
cryptoAmountstringYesAmount of BTC to send
addressstringYesRecipient's Bitcoin address
descriptionstringNoTransaction description
feestringYesTransaction fee in BTC

Modern Parameters (Recommended)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesMust be "BTC"
fromarrayNoArray of sender addresses
tosarrayYesArray of destination objects
descriptionstringNoTransaction description
feestringYesTransaction fee in BTC

Example Request (Legacy Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "8648a91-2413-43dc-a139-667432b8ff",
          "assetType": "BTC",
          "cryptoAmount": "0.00001",
          "address": "2MtQsUJqJz4wiY5WnBXPwrsMbJxm9QsT14i",
          "description": "Testing Here",
          "fee": "0.00000547"
      }'

Example Request (Modern Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "8648a91-2413-43dc-a139-667432b8ff",
          "assetType": "BTC",
          "tos": [{
              "address": "2MtQsUJqJz4wiY5WnBXPwrsMbJxm9QsT14i",
              "value": "0.00001"
          }],
          "description": "Testing Here",
          "fee": "0.00000547"
      }'

3. Send TRC20 Transaction

Send TRC20 tokens on the TRON network.

Legacy Parameters (Deprecated)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesTRC20 token type (e.g., "TUSDC_TRON")
cryptoAmountstringYesAmount of tokens to send
fromAddressstringYesSender's TRON address
addressstringYesRecipient's TRON address
descriptionstringNoTransaction description

Modern Parameters (Recommended)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesTRC20 token type (e.g., "TUSDC_TRON")
fromarrayYesArray of sender addresses
tosarrayYesArray of destination objects
descriptionstringNoTransaction description

Example Request (Legacy Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "22efe5-1d0a-41ae-9d7f-b22374062",
          "assetType": "TUSDC_TRON",
          "cryptoAmount": "1",
          "fromAddress": "TBnmBzyZs3v5ubdKXNN617Tu4PeLhzLrH7",
          "address": "TD6szM7KukDqCv1FSAm451HDttregBadiU",
          "description": "Testing Here"
      }'

Example Request (Modern Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "22efe5-1d0a-41ae-9d7f-b22374062",
          "assetType": "TUSDC_TRON",
          "from": ["TBnmBzyZs3v5ubdKXNN617Tu4PeLhzLrH7"],
          "tos": [{
              "address": "TD6szM7KukDqCv1FSAm451HDttregBadiU",
              "value": "1"
          }],
          "description": "Testing Here"
      }'

4. Send Approve Transaction

Create an approval transaction that allows a spender address to transfer tokens on behalf of the owner. This is required before executing transferFrom transactions.

Use Case

This operation is useful when you want to delegate spending authority to another address, allowing them to pay fees and transfer tokens from your address.

Legacy Parameters (Deprecated)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesToken type (e.g., "TUSDC_TRON")
cryptoAmountstringYesTotal amount the spender can spend
fromAddressstringYesToken owner's address
addressstringYesContract address being approved
spenderAddressstringYesAddress being granted spending permission
descriptionstringNoTransaction description
operationstringYesMust be "approve"

Modern Parameters (Recommended)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesToken type (e.g., "TUSDC_TRON")
fromarrayYesArray with token owner's address
tosarrayYesArray with contract address and amount
spenderAddressstringYesAddress being granted spending permission
descriptionstringNoTransaction description
operationstringYesMust be "approve"

Example Request (Legacy Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "0722efe5-1d0a-41ae-9d7f-b22374062f81",
          "assetType": "TUSDC_TRON",
          "cryptoAmount": "4000000",
          "fromAddress": "TBnmBzyZs3v5ubdKXNN617Tu4PeLhzLrH7",
          "address": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "spenderAddress": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "description": "Approve TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "operation": "approve"
      }'

Example Request (Modern Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "0722efe5-1d0a-41ae-9d7f-b22374062f81",
          "assetType": "TUSDC_TRON",
          "from": ["TBnmBzyZs3v5ubdKXNN617Tu4PeLhzLrH7"],
          "tos": [{
              "address": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
              "value": "4000000"
          }],
          "spenderAddress": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "description": "Approve TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "operation": "approve"
      }'

Important: The value in tos array represents the total allowance the spender address will have, not just the current transaction amount.


5. Send Bitcoin Using UTXO

Send Bitcoin by specifying exact UTXOs (Unspent Transaction Outputs) to use as inputs. This provides more control over transaction construction.

Parameters

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesMust be "BTC"
fromUtxoarrayYesArray of UTXO objects to spend
tosarrayYesArray of output destinations
descriptionstringNoTransaction description
feestringYesTransaction fee in BTC
changeAddressstringYesAddress to receive change

UTXO Object Structure

ParameterTypeRequiredDescription
addressstringYesAddress containing the UTXO
txHashstringYesTransaction hash of the UTXO
indexnumberYesOutput index in the transaction

Output Object Structure

ParameterTypeRequiredDescription
addressstringYesRecipient address
valuenumberYesAmount to send in BTC

Example Request

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "4522efe5-1d0a-41ae-9d7f-b22374063332",
          "assetType": "BTC",
          "fromUtxo": [{
              "address": "mufcbAEjrTpC2cyJXSvQFK6wVFgjTxXBbh",
              "txHash": "d2e4d67d78ddc17639f16bb54045fb52519a523fb5e27a2fa97b0e1438c62146",
              "index": 0
          }, {
              "address": "tb1q93vcd7m4vsr8mvxpxdptr4735fzha9gvxhs7hz",
              "txHash": "cbeb2d1872b867e6b35784a8827886fd99b9813d6f3a22ac4c2e05c80cc5596c",
              "index": 1
          }],
          "tos": [{
              "address": "tb1q4qs2y4ex67sxgqfyydqysa78506awdw6nafdfj",
              "value": 0.0001
          }],
          "description": "Testing Here",
          "fee": "0.000001547",
          "changeAddress": "tb1q93vcd7m4vsr8mvxpxdptr4735fzha9gvxhs7hz"
      }'

6. Initiate TransferFrom Transaction

Execute a transferFrom operation using previously approved allowances. This allows a delegated address to transfer tokens on behalf of the owner.

Prerequisites

  • An approve transaction must be executed first
  • The feeAddress must have sufficient allowance from the token owner

Legacy Parameters (Deprecated)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesToken type (e.g., "TUSDC_TRON")
cryptoAmountstringYesAmount to transfer
fromAddressstringYesOriginal token owner's address
addressstringYesRecipient's address
feeAddressstringYesAddress paying for the transaction
descriptionstringNoTransaction description
operationstringYesMust be "transferFrom"

Modern Parameters (Recommended)

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesToken type (e.g., "TUSDC_TRON")
fromarrayYesArray with original token owner's address
tosarrayYesArray with recipient and amount
feeAddressstringYesAddress paying for the transaction
descriptionstringNoTransaction description
operationstringYesMust be "transferFrom"

Example Request (Legacy Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "0722efe5-1d0a-41ae-9d7f-b22374062f81",
          "assetType": "TUSDC_TRON",
          "cryptoAmount": "4000",
          "fromAddress": "TBnmBzyZs3v5ubdKXNN617Tu4PeLhzLrH7",
          "address": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "feeAddress": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "description": "Transfer From TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "operation": "transferFrom"
      }'

Example Request (Modern Format)

curl --request POST \
     --url https://developers.bitpowr.com/api/v1/transactions \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer <encodedToken>' \
     -d '{
          "walletId": "0722efe5-1d0a-41ae-9d7f-b22374062f81",
          "assetType": "TUSDC_TRON",
          "from": ["TBnmBzyZs3v5ubdKXNN617Tu4PeLhzLrH7"],
          "tos": [{
              "address": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
              "value": "4000"
          }],
          "feeAddress": "TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "description": "Transfer From TKXXPkbtfn9uvwtxf2hdSUQJ2772prGenm",
          "operation": "transferFrom"
      }'

Transaction Workflow

For Standard Transfers

  1. ERC20/TRC20: Use the respective transaction type directly
  2. Bitcoin: Choose between standard transaction or UTXO-based transaction

For Delegated Transfers

  1. Step 1: Execute an approve transaction to grant spending permission
  2. Step 2: Execute a transferFrom transaction to perform the actual transfer

Error Handling

The API will return appropriate HTTP status codes and error messages for various scenarios:

  • 400 Bad Request: Invalid parameters or malformed request
  • 401 Unauthorized: Invalid or missing authorization token
  • 403 Forbidden: Insufficient permissions
  • 500 Internal Server Error: Server-side processing error

Always check the response status and handle errors appropriately in your application.