AIBTC Working Group
  • AIBTC
  • Prompt2DAO
  • AIBTC Contracts
    • DAO Base Layer
    • DAO Extensions
      • Action Proposal Voting
      • Core Proposal Voting
      • DAO Charter
      • Onchain Messaging
      • Payment Processor
      • Timed Vault
      • Token Owner
      • Treasury
    • DAO Proposals
      • Action Proposals
      • Core Proposals
    • Agent Account
  • Agent Tools
    • Overview
    • Available Tools
      • Smart Wallet Tools
      • Agent Wallet Tools
      • DAO Tools
      • Database Tools
      • Faktory Tools
  • AIBTC Cache
    • Overview
    • Contract Calls
      • API Design
      • Endpoints
        • Decode Clarity Value
        • Read-Only Function Calls
        • Contract ABI
        • Known ABI Contracts
      • Clarity Value Types
      • Integration Examples
    • Cache Services
    • Error Handling
    • Utilities
  • Prompting
    • Action Proposal Prompts
    • Smart Wallet Prompts
  • Links
    • Common Terms
    • Our App
    • Discord
    • GitHub
    • Prompt2DAO on X
    • AIBTC on X
  • Documentation Templates
    • Smart Contract Documentation
    • Cache Service Documentation
    • Cache Endpoint Documentation
    • Agent Tool Documentation
    • Prompting Documentation
  • Example Implementations
    • Smart Contract Example
    • Cache Service Example
    • Cache Endpoint Example
    • Agent Tool Example
Powered by GitBook
On this page
  • Rate Limiting
  • Response Times
  • Request Queuing
  • How Queuing Works
  • Queue Metrics
  • Queue Behavior During High Load
  • Client Recommendations
  1. AIBTC Cache
  2. Contract Calls

Endpoints

Endpoint
Description

Decode Clarity values into JavaScript/JSON

Make read-only calls to smart contract functions

Retrieve the ABI for a smart contract

List all contracts accessed through the cache

Rate Limiting

All endpoints that make calls to the Stacks API are rate-limited to protect both our service and the upstream Stacks API. The current limits are:

  • Maximum of 20 requests per minute to the Stacks API

  • Minimum spacing of 250ms between consecutive requests

  • Automatic queuing of requests that exceed these limits

When rate limits are exceeded, requests are automatically queued and processed as capacity becomes available. For high-volume applications, we recommend implementing client-side caching to reduce the number of requests.

Response Times

Expected response times vary by endpoint:

  • Decode Clarity Value: < 100ms (processed locally)

  • Contract ABI:

    • First request: 500-1500ms (fetched from Stacks API)

    • Subsequent requests: < 100ms (served from cache)

  • Read-Only Function Calls:

    • Cached responses: < 100ms

    • Uncached simple calls: 500-1500ms

    • Complex contract calls: 1-5 seconds

  • Known Contracts: < 100ms (processed locally)

All endpoints have a maximum timeout of 5 seconds for upstream API calls.

Request Queuing

The AIBTC Cache implements automatic request queuing to handle high traffic volumes while maintaining fair access to the Stacks API.

How Queuing Works

  1. When a request arrives, it's assigned a unique request ID

  2. If capacity is available, the request is processed immediately

  3. If capacity is not available, the request enters a queue

  4. Requests are processed in FIFO (First In, First Out) order

  5. Queue status is tracked and logged for monitoring

Queue Metrics

The following metrics are tracked for each request:

  • Queue position when the request was enqueued

  • Time spent in queue before processing

  • Total request time (queue time + processing time)

Queue Behavior During High Load

During periods of high load:

  • Requests are automatically queued

  • Each request is processed when capacity becomes available

  • Responses include the total processing time

  • No requests are dropped unless they time out

Client Recommendations

For optimal performance during high load:

  • Implement client-side timeouts appropriate for your use case

  • Consider exponential backoff for retries

  • Use the cache control options to reduce unnecessary requests

  • Batch related requests when possible

PreviousAPI DesignNextDecode Clarity Value

Last updated 1 month ago

Decode Clarity Value
Read-Only Function Calls
Contract ABI
Known Contracts