spacemeshos / api

Protobuf implementation of the Spacemesh API
MIT License
15 stars 9 forks source link

Finalize API v2 specification along with the new requirements #295

Closed kacpersaw closed 1 week ago

kacpersaw commented 11 months ago

Description

The ask is to prepare new schema for new improved API v2.

List of endpoints required for now (spec is still in progress):

  1. current head layer number and nodeID hash
    • known chain head block/layer
    • current highest layer
    • sync status (in sync, syncing, offline)
  2. detail of given layer by layer number
    • empty layer, or return single canonical block with:
      • block header/block ID
      • list of transactions (effective and ineffective, possibly with option to filter effective only)
  3. account details by address
    • current balance and counter
    • projected balance and counter
  4. broadcast raw, signed tx
    • return txid
  5. tx by txid
    • state (unknown, pending, contextually invalid/malformed, duplicate, ineffective/contextually invalid, in mempool, included in block, passed hare, passed tortoise/verified, reorg'ed out/replaced)
    • gas consumed
    • execution success/failure (receipt)
    • tx type
      • single sig spend
      • multi sig spend
      • single sig spawn
      • multi sig spawn
    • principal
    • parsed contents
      • amount
      • recipient
  6. gas estimation
    • recommended maxGas per tx type
brusherru commented 11 months ago

Here are the list of APIs required by Wallet application:

Network-specific data

Node status:

User data:

Publishing txs:

All of them already exist and should work via JSON RPC (I haven't tested all of them yet). So I'm using them now, and propose to focus on endpoints that consume too much resources or are unsafe.

kacpersaw commented 8 months ago

Done

kacpersaw commented 1 week ago

API is implemented and exposed on https://mainnet-api-docs.spacemesh.network/index.html