Web API: Block
The Block API provides endpoints for retrieving blockchain block information, including block details, validation data, and validator-specific queries.
Base URL
/api/block/
Endpoints
List Blocks
GET /api/block/
Returns a paginated list of blocks, ordered by height (newest first).
Query Parameters:
search
: Search by hash, height, validator address, or master node nameordering
: Order results (e.g.,-height
,height
)master_node
: Filter by master node ID
Response:
{
"count": 1000,
"next": "http://localhost:8000/api/block/?page=2",
"previous": null,
"results": [
{
"height": 12345,
"hash": "block_hash_123...",
"validator_address": "Rx1234567890abcdef...",
"timestamp": "2024-01-01T12:00:00Z",
"transaction_count": 15,
"master_node": {
"id": 1,
"name": "MasterNode1",
"address": "Rx1234567890abcdef..."
}
}
]
}
Get Block by Height
GET /api/block/{height}/
Returns detailed information for a specific block by height.
Parameters:
height
(integer): The block height
Response:
{
"height": 12345,
"hash": "block_hash_123...",
"validator_address": "Rx1234567890abcdef...",
"timestamp": "2024-01-01T12:00:00Z",
"transaction_count": 15,
"size": 1024,
"master_node": {
"id": 1,
"name": "MasterNode1",
"address": "Rx1234567890abcdef..."
},
"transactions": [
{
"hash": "tx_hash_123...",
"type": "TRANSFER",
"amount": "100.0"
}
]
}
Get Block by Hash
GET /api/block/hash/{hash}/
Returns detailed information for a specific block by hash.
Parameters:
hash
(string): The block hash
Response:
{
"height": 12345,
"hash": "block_hash_123...",
"validator_address": "Rx1234567890abcdef...",
"timestamp": "2024-01-01T12:00:00Z",
"transaction_count": 15,
"master_node": {
"id": 1,
"name": "MasterNode1"
}
}
Get Blocks by Validator Address
GET /api/block/address/{address}/
Returns a paginated list of blocks validated by a specific address.
Parameters:
address
(string): The validator address
Response:
{
"count": 50,
"next": "http://localhost:8000/api/block/address/Rx123.../?page=2",
"previous": null,
"results": [
{
"height": 12345,
"hash": "block_hash_123...",
"validator_address": "Rx1234567890abcdef...",
"timestamp": "2024-01-01T12:00:00Z",
"transaction_count": 15
}
]
}
Field Descriptions
height
: The sequential block numberhash
: Unique block hash identifiervalidator_address
: Address of the validator who created this blocktimestamp
: When the block was created (ISO 8601 format)transaction_count
: Number of transactions in the blocksize
: Block size in bytesmaster_node
: Information about the associated master node
Notes
- Blocks are ordered by height in descending order (newest first) by default
- All endpoints support caching for improved performance
- Block validation is performed by validator addresses associated with master nodes
- Transaction details may be included in block responses depending on the endpoint