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 withaddress
andvalue
propertiesfromUtxo
: 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
Parameter | Type | Required | Description |
---|---|---|---|
chain | string | Yes | Blockchain network (BITCOIN, ETHEREUM, BSC, POLYGON, etc.) |
walletId | string | Yes | Unique identifier for the wallet |
token | string | Yes | Token type (USDC, USDT, BTC, etc.) |
tos | array | Yes | Array of destination objects |
Optional Parameters
Parameter | Type | Description |
---|---|---|
accountId | string | Account UID for the transaction |
subAccountId | string | Sub-account UID |
assetId | string | Asset UID |
operation | string | Custom operation (transfer, approve, transferFrom, etc.) |
from | array | Array of sender addresses |
fromUtxo | array | UTXO objects for Bitcoin transactions |
feeAddress | string | Address to pay transaction fees |
spender | string | Address 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)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Token type (e.g., "TUSDC_ETH") |
cryptoAmount | string | Yes | Amount of tokens to send |
fromAddress | string | Yes | Sender's Ethereum address |
address | string | Yes | Recipient's Ethereum address |
gasLimit | string | No | Maximum gas units to use |
gasPrice | string | No | Gas price in wei |
fee | string | No | Transaction fee in ETH |
description | string | No | Transaction description |
Modern Parameters (Recommended)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Token type (e.g., "TUSDC_ETH") |
from | array | Yes | Array of sender addresses |
tos | array | Yes | Array of destination objects |
gasLimit | string | No | Maximum gas units to use |
gasPrice | string | No | Gas price in wei |
fee | string | No | Transaction fee in ETH |
description | string | No | Transaction 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)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Must be "BTC" |
cryptoAmount | string | Yes | Amount of BTC to send |
address | string | Yes | Recipient's Bitcoin address |
description | string | No | Transaction description |
fee | string | Yes | Transaction fee in BTC |
Modern Parameters (Recommended)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Must be "BTC" |
from | array | No | Array of sender addresses |
tos | array | Yes | Array of destination objects |
description | string | No | Transaction description |
fee | string | Yes | Transaction 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)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | TRC20 token type (e.g., "TUSDC_TRON") |
cryptoAmount | string | Yes | Amount of tokens to send |
fromAddress | string | Yes | Sender's TRON address |
address | string | Yes | Recipient's TRON address |
description | string | No | Transaction description |
Modern Parameters (Recommended)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | TRC20 token type (e.g., "TUSDC_TRON") |
from | array | Yes | Array of sender addresses |
tos | array | Yes | Array of destination objects |
description | string | No | Transaction 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)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Token type (e.g., "TUSDC_TRON") |
cryptoAmount | string | Yes | Total amount the spender can spend |
fromAddress | string | Yes | Token owner's address |
address | string | Yes | Contract address being approved |
spenderAddress | string | Yes | Address being granted spending permission |
description | string | No | Transaction description |
operation | string | Yes | Must be "approve" |
Modern Parameters (Recommended)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Token type (e.g., "TUSDC_TRON") |
from | array | Yes | Array with token owner's address |
tos | array | Yes | Array with contract address and amount |
spenderAddress | string | Yes | Address being granted spending permission |
description | string | No | Transaction description |
operation | string | Yes | Must 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
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Must be "BTC" |
fromUtxo | array | Yes | Array of UTXO objects to spend |
tos | array | Yes | Array of output destinations |
description | string | No | Transaction description |
fee | string | Yes | Transaction fee in BTC |
changeAddress | string | Yes | Address to receive change |
UTXO Object Structure
Parameter | Type | Required | Description |
---|---|---|---|
address | string | Yes | Address containing the UTXO |
txHash | string | Yes | Transaction hash of the UTXO |
index | number | Yes | Output index in the transaction |
Output Object Structure
Parameter | Type | Required | Description |
---|---|---|---|
address | string | Yes | Recipient address |
value | number | Yes | Amount 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)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Token type (e.g., "TUSDC_TRON") |
cryptoAmount | string | Yes | Amount to transfer |
fromAddress | string | Yes | Original token owner's address |
address | string | Yes | Recipient's address |
feeAddress | string | Yes | Address paying for the transaction |
description | string | No | Transaction description |
operation | string | Yes | Must be "transferFrom" |
Modern Parameters (Recommended)
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Token type (e.g., "TUSDC_TRON") |
from | array | Yes | Array with original token owner's address |
tos | array | Yes | Array with recipient and amount |
feeAddress | string | Yes | Address paying for the transaction |
description | string | No | Transaction description |
operation | string | Yes | Must 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
- ERC20/TRC20: Use the respective transaction type directly
- Bitcoin: Choose between standard transaction or UTXO-based transaction
For Delegated Transfers
- Step 1: Execute an
approve
transaction to grant spending permission - 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.
Updated 3 days ago