Overview
Endpoints for managing blockchain transactions, including transfers, gas estimation, and transaction history.
Send Transaction
Send a raw transaction to the blockchain.
Copy POST api.bloclabs.com/v1/wallets/{wallet_id}/send-transaction
Request
Copy {
"to": "0x789...def",
"value": "1.5",
"asset": "ETH",
"gas_priority": "MEDIUM", // LOW, MEDIUM, HIGH, URGENT
"data": "0x...", // Optional: Contract interaction data
"nonce": 5, // Optional: Custom nonce
"max_fee_per_gas": "50", // Optional: In GWEI
"max_priority_fee": "2" // Optional: In GWEI
}
Response
Copy {
"status": "success",
"data": {
"transaction_id": "tx_xyz789",
"hash": "0xabc...123",
"from": "0x123...abc",
"to": "0x789...def",
"value": "1.5",
"asset": "ETH",
"status": "PENDING",
"created_at": "2024-03-15T10:00:00Z",
"estimated_completion_time": "2024-03-15T10:01:00Z"
}
}
Transfer Assets
High-level endpoint for token transfers.
Copy POST api.bloclabs.com/v1/wallets/{wallet_id}/transfer
Request
Copy {
"to": "0x789...def",
"amount": "1000.00",
"asset": "USDC", // Token symbol or address
"gas_priority": "MEDIUM",
"memo": "Payment for services", // Optional: Transaction note
"notification": { // Optional: Notification preferences
"email": true,
"push": true
}
}
Response
Copy {
"status": "success",
"data": {
"transfer_id": "transfer_abc123",
"transaction_hash": "0xabc...123",
"from": "0x123...abc",
"to": "0x789...def",
"amount": "1000.00",
"asset": "USDC",
"usd_value": "1000.00",
"status": "PENDING",
"estimated_completion_time": "2024-03-15T10:01:00Z"
}
}
Estimate Gas
Estimate gas fees for a transaction.
Copy POST api.bloclabs.com/v1/wallets/{wallet_id}/estimate-gas
Request
Copy {
"to": "0x789...def",
"value": "1.5",
"asset": "ETH",
"data": "0x...", // Optional: Contract interaction data
"gas_priority": "MEDIUM"
}
Response
Copy {
"status": "success",
"data": {
"estimated_gas": "21000",
"gas_prices": {
"low": {
"max_fee": "30",
"max_priority_fee": "1",
"estimated_seconds": 60
},
"medium": {
"max_fee": "50",
"max_priority_fee": "2",
"estimated_seconds": 30
},
"high": {
"max_fee": "70",
"max_priority_fee": "3",
"estimated_seconds": 15
}
},
"estimated_cost": {
"eth": "0.00105",
"usd": "2.10"
}
}
}
Get Transaction Status
Check the status of a specific transaction.
Copy GET api.bloclabs.com/v1/wallets/transaction/{tx_hash}
Response
Copy {
"status": "success",
"data": {
"hash": "0xabc...123",
"status": "CONFIRMED",
"block_number": 15481234,
"confirmations": 12,
"from": "0x123...abc",
"to": "0x789...def",
"value": "1.5",
"asset": "ETH",
"gas_used": "21000",
"gas_price": "50",
"timestamp": "2024-03-15T10:01:00Z"
}
}
Get Transaction History
Retrieve transaction history for a wallet.
Copy GET api.bloclabs.com/v1/wallets/{wallet_id}/history
Query Parameters
Copy {
"type": "all", // all, sent, received
"asset": "ETH", // Optional: Filter by asset
"from_date": "2024-03-01", // Optional: Start date
"to_date": "2024-03-15", // Optional: End date
"limit": 10, // Optional: Number of results
"offset": 0 // Optional: Pagination offset
}
Response
Copy {
"status": "success",
"data": {
"transactions": [
{
"hash": "0xabc...123",
"type": "SENT",
"status": "CONFIRMED",
"from": "0x123...abc",
"to": "0x789...def",
"value": "1.5",
"asset": "ETH",
"usd_value": "3000.00",
"timestamp": "2024-03-15T10:01:00Z",
"gas_used": "21000",
"gas_price": "50"
}
],
"pagination": {
"total": 50,
"limit": 10,
"offset": 0
}
}
}
Error Responses
Insufficient Funds
Copy {
"status": "error",
"message": "Insufficient funds for transaction",
"code": "INSUFFICIENT_FUNDS",
"data": {
"required": "1.5 ETH",
"available": "1.0 ETH"
}
}
Transaction Failed
Copy {
"status": "error",
"message": "Transaction failed",
"code": "TRANSACTION_FAILED",
"data": {
"reason": "Contract execution reverted",
"gas_used": "21000"
}
}
Invalid Gas Price
Copy {
"status": "error",
"message": "Gas price too low",
"code": "INVALID_GAS_PRICE",
"data": {
"minimum_gas_price": "30 GWEI"
}
}
Notes
Always estimate gas before sending transactions
Transactions are irreversible once confirmed
Gas prices can fluctuate rapidly
Keep track of nonce for multiple transactions
Last updated 2 months ago