CENT Blockchain Node API

Technical documentation for the CENT Node Server (app.py). This API allows clients (such as Wallets, Discord Bots, and Block Explorers) to interact with the blockchain network.

1. System Architecture

2. P2P Communication Protocol

The network operates on a decentralized mesh where nodes communicate directly via HTTP.

3. API Endpoints

Sending Transactions

Method Endpoint Description
POST /transactions/new Receives a signed transaction bundle, validates the signature and balance, and adds it to the "Pending" pool.

Payload Example (JSON)

{
  "sender": "CENT26e314df...",    // Sender's Wallet Address
  "recipient": "CENTf382a1...",   // Recipient's Wallet Address
  "amount": 10.5,                 // Amount to send (Float)
  "signature": "30450221...",     // Hex Signature of (sender+recipient+amount+timestamp)
  "timestamp": 1734185400.0,      // Unix timestamp
  "public_key": "04a1b2c3..."     // Sender's raw Public Key Hex
}

Blockchain Data

Method Endpoint Description
GET /chain Returns the full blockchain data (all blocks and confirmed transactions).
GET /chain/length Returns the current height (number of blocks) of the chain.
GET /transactions/pending Returns the list of unconfirmed transactions currently in the mempool.

Network & Consensus

Method Endpoint Description
POST /nodes/register Registers new peer nodes. Required JSON: {"nodes": ["http://IP:PORT"]}.
GET /nodes/resolve Triggers manual consensus. The node checks all peers and downloads the longest valid chain.
POST /block/receive Used by peers to broadcast a newly mined block to this node.

Wallet & Mining

Method Endpoint Description
GET /mine (Manual) Forces the node to mine a new block immediately.
GET /wallet/new Generates a new SECP256k1 keypair and returns the Address, Private Key, and Public Key.