Transaction Management

Transaction Management

Overview

BlocWise API provides comprehensive transaction management across multiple blockchain networks. This guide covers the core concepts of transaction handling, gas management, and signing processes.

Transaction Types

{
    "supported_transactions": {
        "TRANSFER": {
            "description": "Send tokens or native currency",
            "features": [
                "Multi-token support",
                "Gas estimation",
                "Transaction preview"
            ],
            "example_endpoint": "POST /v1/wallets/{wallet_id}/transfer"
        },
        "SWAP": {
            "description": "Exchange between tokens",
            "features": [
                "Best rate routing",
                "Slippage protection",
                "Price impact preview"
            ],
            "example_endpoint": "POST /v1/wallets/{wallet_id}/swap"
        },
        "CONTRACT": {
            "description": "Smart contract interaction",
            "features": [
                "Custom data encoding",
                "ABI support",
                "Method simulation"
            ],
            "example_endpoint": "POST /v1/wallets/{wallet_id}/contract-call"
        }
    }
}

Gas Priority Levels

{
    "gas_priorities": {
        "LOW": {
            "description": "Slower, cheaper transactions",
            "estimated_time": "5-20 minutes",
            "cost_multiplier": "1x"
        },
        "MEDIUM": {
            "description": "Balanced speed and cost",
            "estimated_time": "2-5 minutes",
            "cost_multiplier": "1.1x"
        },
        "HIGH": {
            "description": "Faster execution",
            "estimated_time": "30 seconds - 2 minutes",
            "cost_multiplier": "1.2x"
        },
        "URGENT": {
            "description": "Immediate execution priority",
            "estimated_time": "< 30 seconds",
            "cost_multiplier": "1.5x"
        }
    }
}

Signing Status

{
    "signing_statuses": {
        "PENDING": {
            "description": "Awaiting user signature",
            "next_steps": ["Sign", "Reject"],
            "timeout": "15 minutes"
        },
        "SIGNED": {
            "description": "Transaction signed",
            "next_steps": ["Broadcast"],
            "timeout": "None"
        },
        "BROADCASTING": {
            "description": "Submitting to network",
            "next_steps": ["Confirm"],
            "timeout": "2 minutes"
        },
        "CONFIRMED": {
            "description": "Transaction confirmed",
            "next_steps": ["View"],
            "confirmations_required": {
                "ethereum": 12,
                "polygon": 64,
                "binance": 15
            }
        },
        "FAILED": {
            "description": "Transaction failed",
            "next_steps": ["Retry", "View"],
            "error_types": [
                "Insufficient funds",
                "Gas estimation failed",
                "User rejected",
                "Network error"
            ]
        }
    }
}

Network Environments

{
    "environments": {
        "MAINNET": {
            "description": "Production blockchain networks",
            "networks": {
                "ethereum": {
                    "chain_id": 1,
                    "currency": "ETH"
                },
                "polygon": {
                    "chain_id": 137,
                    "currency": "MATIC"
                },
                "binance": {
                    "chain_id": 56,
                    "currency": "BNB"
                }
            }
        },
        "TESTNET": {
            "description": "Test blockchain networks",
            "networks": {
                "ethereum": {
                    "chain_id": 5,
                    "currency": "ETH"
                },
                "polygon": {
                    "chain_id": 80001,
                    "currency": "MATIC"
                },
                "binance": {
                    "chain_id": 97,
                    "currency": "BNB"
                }
            }
        }
    }
}

Quick Implementation Example

Creating a Transfer Transaction

POST /v1/wallets/{wallet_id}/transfer

Request:

{
    "to": "0x123...abc",
    "amount": "1.5",
    "asset": "ETH",
    "gas_priority": "MEDIUM",
    "network": "ethereum",
    "environment": "mainnet"
}

Response:

{
    "status": "success",
    "data": {
        "transaction_id": "tx_123abc",
        "signing_status": "PENDING",
        "estimated_gas": "21000",
        "gas_price": "50 gwei",
        "total_cost_usd": "5.25",
        "expiry": "2024-03-15T11:00:00Z"
    }
}

Key Considerations

Gas Management

  • Always estimate gas before transactions

  • Consider network congestion

  • Monitor gas prices for optimal timing

  • Implement gas price alerts

Transaction Security

  • Verify recipient addresses

  • Implement transaction limits

  • Use appropriate gas priority

  • Monitor transaction status

Network Selection

  • Choose appropriate network environment

  • Verify network support for token/contract

  • Consider network fees and speed

  • Monitor network status

Next Steps

  • Detailed Transaction Guide

  • Gas Optimization Guide

  • Network Specific Features

  • Error Handling

Last updated

Was this helpful?