Blockchain API

The Blockchain API provides access to blocks, transactions, and network statistics on the SentiChain network. Base URL: https://api.sentichain.com/blockchain

GET /get_chain_length

Returns the current block height of the specified network.

Parameters

NameTypeRequiredDescription
network string Yes mainnet or testnet

Response

{
    "chain_length": 1542,
    "network": "mainnet"
}

Example

curl "https://api.sentichain.com/blockchain/get_chain_length?network=mainnet"
GET /get_last_block_time

Returns the UTC timestamp of the most recent block.

Parameters

NameTypeRequiredDescription
network string Yes mainnet or testnet

Response

{
    "last_block_time": 1703424000.0,
    "network": "mainnet"
}
GET /get_block_by_number 1 point

Retrieves a specific block by its number. Full transaction data requires an API key.

Parameters

NameTypeRequiredDescription
network string Yes mainnet or testnet
block_number integer Yes Block number to retrieve
api_key string No API key for full transaction data

Response

{
    "block": {
        "block_number": 100,
        "hash": "a3f8c2d1...",
        "previous_hash": "9b2e4f7a...",
        "consensus_root": "c7d4e9f2...",
        "timestamp": 1703424000.0,
        "validator": "validator_01",
        "transactions": [...]
    },
    "network": "mainnet"
}
GET /get_last_block 1 point

Retrieves the most recent block. Full transaction data requires an API key.

Parameters

NameTypeRequiredDescription
network string Yes mainnet or testnet
api_key string No API key for full transaction data

Event Mapper API

The Mapper API provides access to sentiment event mappings and cluster analysis. Base URL: https://api.sentichain.com/mapper

GET /get_max_block_number

Returns the maximum block number processed in the event map.

Response

{
    "max_block_number": 1540
}
GET /get_points_by_block_no_embedding 1 point

Returns event map data for a specific block, including cluster information.

Parameters

NameTypeRequiredDescription
block_number integer Yes Block number to retrieve
api_key string No API key for full content

Response

{
    "points": [
        {
            "block_number": 100,
            "point_x": 0.523,
            "point_y": -0.234,
            "cluster_number": 3,
            "cluster_summary_short": "BTC price action",
            "post_content": "hidden"
        }
    ]
}

Agent API

The Agent API provides AI-generated sentiment analysis and observations. Base URL: https://api.sentichain.com/agent

GET /get_reasoning_match_chunk_end 1 point

Returns AI-generated reasoning and observations for a ticker up to a specified block.

Parameters

NameTypeRequiredDescription
ticker string Yes Asset ticker (BTC, ETH, SOL, etc.)
summary_type string Yes Type of analysis (observation_public, etc.)
user_chunk_end integer Yes Block number cutoff
api_key string No Required for non-public types

API Management

Endpoints for user registration and account management. Base URL: https://api.sentichain.com/api

POST /register

Register a new user and receive an API key.

Request Body

{
    "user_id": "your-username",
    "email": "[email protected]",
    "name": "Your Name"
}

Response

{
    "message": "User registered successfully",
    "user_id": "your-username",
    "api_key": "your-api-key-here"
}
GET /get_user_info

Retrieve user information and current point balance.

Parameters

NameTypeRequiredDescription
user_id string Yes Your user ID
api_key string Yes Your API key

Python SDK

The official Python SDK provides a convenient wrapper for all SentiChain API endpoints.

Installation

pip install sentichain

Basic Usage

from sentichain import Client

# Initialize with your API key
client = Client(api_key="your-api-key")

# Get chain length (no API key required)
length = client.get_chain_length(network="mainnet")
print(f"Current block height: {length}")

# Get block with full transaction data
block = client.get_block_by_number(
    network="mainnet",
    block_number=100
)

for tx in block.transactions:
    print(f"TX: {tx.hash}")
    print(f"Vector: {len(tx.vector)} dimensions")

Available Methods

  • get_chain_length(network)
  • get_last_block_time(network)
  • get_total_transactions(network)
  • get_block_by_number(network, block_number)
  • get_last_block(network)
  • get_event_map(block_number)
  • get_reasoning(ticker, summary_type, chunk_end)
  • get_user_info(user_id)