Marscoin API Documentation

Explore and integrate with the Marscoin blockchain API

Overview

This API provides access to the Marscoin blockchain data, including blocks, transactions, and addresses. All endpoints return data in JSON format.

GET Requests
POST Requests
WebSocket

Base URL

All API requests should be made to:

[ORIGIN]/api

Rate Limiting

To ensure service stability, API calls are limited to 10 requests per minute per IP address.

Error Handling

All errors are returned with appropriate HTTP status codes and error messages in JSON format.

Block Endpoints

GET/api/blocks

Get a list of recent blocks with pagination support.

Parameters

NameTypeRequiredDescription
limitnumberNoNumber of blocks to return (default: 10, max: 50)
offsetnumberNoNumber of blocks to skip (default: 0)

Example

https://example.com/api/blocks?limit=5&offset=0

Response

{
  "blocks": [
    {
      "hash": "00000000000000b345...",
      "height": 150232,
      "confirmations": 2,
      "size": 82345,
      "time": 1613207418,
      "txs": [
        "2d6c0de71d4d9345..."
      ]
    },
    // More blocks...
  ]
}
GET/api/block/:hash

Get detailed information about a specific block by hash.

Parameters

NameTypeRequiredDescription
hashstringYesThe hash of the block

Example

https://example.com/api/block/00000000000000b34589247492...

Response

{
  "hash": "00000000000000b345...",
  "height": 150232,
  "confirmations": 2,
  "size": 82345,
  "time": 1613207418,
  "merkleroot": "97f1a53305b....",
  "tx": [
    "2d6c0de71d4d9345..."
  ],
  "bits": "1d00fff...",
  "difficulty": 23.45,
  "previousblockhash": "0000000000000..."
}
GET/api/block-index/:height

Get block hash by height.

Parameters

NameTypeRequiredDescription
heightnumberYesThe height of the block in the blockchain

Example

https://example.com/api/block-index/150232

Response

{
  "blockHash": "00000000000000b345..."
}

Rate Limiting

To ensure service stability and availability for all users, the API implements the following rate limits:

Rate limit information is included in the response headers:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 9
X-RateLimit-Reset: 1613207478

If you exceed the rate limit, you will receive a 429 Too Many Requests response.

Error Handling

All API errors are returned with appropriate HTTP status codes and a JSON error object.

// Example error response (404 Not Found)
{
  "error": "Transaction not found"
}

// Example error response (400 Bad Request)
{
  "error": "Invalid transaction hex"
}

// Example error response (429 Too Many Requests)
{
  "error": "Rate limit exceeded, retry after 60 seconds"
}

Common Error Codes

Status CodeDescription
400 Bad RequestInvalid request parameters
404 Not FoundResource not found
429 Too Many RequestsRate limit exceeded
500 Internal Server ErrorServer error
503 Service UnavailableServer temporarily unavailable