Table of Contents

开始使用 BlockPI 进行构建

每月向所有注册用户免费提供 50,000,000 RU!

从 $0 开始

Unlock Efficiency with BlockPI’s Core APIs for Seamless Web3 Development

BlockPI

Aug 18, 20252min read

Unlock Efficiency with BlockPI’s Core APIs for Seamless Web3 Development

undefined

As a distributed infrastructure layer for Web3, BlockPI empowers developers with high-performance, scalable RPC services across multi-chain networks. To optimize your workflow and resource management, we’ve designed four essential APIs: RU Balance, Wallet Balance, RU Consumed, and Package Expiration.

These tools provide real-time insights into your usage, costs, and service status — ensuring you maintain uninterrupted, cost-effective dApp operations. Let’s explore how each API can streamline your development process.

1.RU Balance: Track Your Resource Credit Reserves

​What it does: The blockpi_ruBalance API returns your remaining Request Units (RU)​ — BlockPI’s metered credits for RPC requests. Each query or transaction consumes RU, making real-time balance monitoring critical.

​Why use it?​​

  • Avoid service interruptions by proactively tracking RU depletion.
  • Programmatically trigger alerts or auto-purchases when balances dip below thresholds.

​Application Scenario:

Imagine a high-traffic NFT minting dApp on Scroll. By integrating RU Balancechecks into your dashboard, you receive Slack alerts when RU falls below 10%. This prevents RPC failures during peak minting events, ensuring smooth user experiences.

              // Request
curl  https://api.blockpi.io/openapi/v1/rpc -X POST -H "Content-Type: application/json" 
--data '{
    "jsonrpc": "2.0",
    "method": "blockpi_ruBalance",
    "params": [
        {
            "apiKey": "60794194a000ijb35af7e1180i311a26297a3b0w" 
        }
    ],
    "id": 1
}'


// Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "balance": 0
    }
}
            

2. Wallet Balance: Monitor Your Payment Account

​What it does: The blockpi_walletBalance API checks your ​USD wallet balance​ in the BlockPI Account. This balance funds RU purchases or pay-as-you-go usage.

​Why use it?​​

  • Ensure sufficient funds for ongoing operations.
  • Automate budget controls for team projects.

​Application Scenario:

A DeFi protocol uses BlockPI’s RPCs for real-time oracle updates. By scheduling daily Wallet Balance checks, the system auto-deposit USDC via a smart contract if funds drop below $500. This eliminates manual oversight and guarantees service continuity.

              // Sample Request
curl  https://api.blockpi.io/openapi/v1/rpc -X POST -H "Content-Type: application/json" 
--data '{
    "jsonrpc": "2.0",
    "method": "blockpi_walletBalance",
    "params": [
        {
            "apiKey": "60794194a000ijb35af7e1180i311a26297a3b0w" 
        }
    ],
    "id": 1
}'


// Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "balance": 0
    }
}
            

3. RU Consumed: Analyze Resource Utilization

​What it does: The blockpi_ruConsumed API provides ​historical RU consumption data, broken down by time (e.g., 24H/3D).

​Why use it?​​

  • Identify usage patterns and optimize costs.
  • Audit team/project-specific resource allocation.

​Application Scenario:

A gaming studio runs multiple dApps on Merlin Chain. Using RU Consumed, they detect a 40% RU spike during weekends. They then scale RPC nodes dynamically during these periods and shift non-essential tasks to off-peak hours.

              // Sample Request: Get 3-day usage
curl  https://api.blockpi.io/openapi/v1/rpc -X POST -H "Content-Type: application/json" 
--data '{
    "jsonrpc": "2.0",
    "method": "blockpi_ruConsumed",
    "params": [
        {
            "apiKey": "0fea34a6584b71e1df7794c4b2b405a3dddeea8a",
            "days": "3" 
        }
    ],
    "id": 1
}'

// Result
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "cost": 0
    }
}
            

4. Package Expiration: Manage Renewals

​What it does: The blockpi_packageExpiration API returns the ​expiry timestamp​ of your active RU package (e.g., Free, Pro, Enterprise).

​Why use it?​​

  • Prevent unexpected downgrades to limited free tiers.
  • Sync renewal reminders with calendar tools.

​Application Scenario:

An enterprise uses BlockPI’s premium RPCs for cross-chain settlements. By embedding Package Expiration into their CI/CD pipeline, they auto-initiate invoice payments 3 days before expiry. This maintains SLA guarantees and avoids throttling.

              // Sample Request:
curl  https://api.blockpi.io/openapi/v1/rpc -X POST -H "Content-Type: application/json" 
--data '{
    "jsonrpc": "2.0",
    "method": "blockpi_packageExpiration",
    "params": [
        {
            "apiKey": "0fea34a6584b71e1df7794c4b2b405a3dddeea8a"
        }
    ],
    "id": 1
}'

// Result
{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "details": [
            {
                "ruTotalAmount": 4000000000,
                "ruLeftAmount": 3687787426,
                "skuName": "Startup Premium",
                "expireTime": 1761451280832
            }
        ],
        "totalCount": 1
    }
}
            

Integrate Today, Optimize Tomorrow

BlockPI’s APIs are more than monitoring tools — they’re ​proactive safeguards​ for scalable dApp operations. By embedding these endpoints into your workflows, you gain:

  • 📉 ​Cost control​ with predictive budgeting via RU Balance + Wallet Balance
  • 📊 ​Efficiency insights​ through RU Consumed trend analysis
  • 🔄 ​Automated governance​ using Package Expiration syncs

Start with our ​free tier​ (50M RU/month), and scale seamlessly as your dApp grows. Ready to code? Explore the full API documentation today!

Follow us on X to keep an eye out for more exciting updates as we continue expanding our offerings and support for emerging blockchain ecosystems. Let’s join forces and shape the decentralized future together!

开始使用 BlockPI 进行构建

简单、快速、高效、可靠

每月向所有注册用户免费提供 50,000,000 RU!

从 $0 开始