Page Navigation

epress node Developer Docs

Open

Collapsed while browsing epress world protocol docs.

EWP Quick Start

Implement a minimal EWP-compatible node in under an hour. This guide walks through the essential endpoints and signing requirements.

Prerequisites

  • Familiarity with HTTP APIs and JSON
  • Understanding of elliptic curve signatures (secp256k1)
  • Access to an Ethereum wallet for signing

Step 1: Implement Profile Endpoint

The profile endpoint returns your node public metadata.

GET /ewp/profile

{
  "address": "0xYourWalletAddress",
  "title": "My EWP Node",
  "url": "https://my-node.example.com",
  "description": "A minimal EWP implementation",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-03-01T00:00:00.000Z"
}

Step 2: Implement Publications Index

Return pageable publication metadata for your node content.

GET /ewp/publications?since=2026-01-01&limit=50&page=1

{
  "data": [
    {
      "content_hash": "0xHashOfContent",
      "title": "My First Post",
      "created_at": "2026-01-15T10:30:00.000Z",
      "updated_at": "2026-01-15T10:30:00.000Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 50,
    "total": 1,
    "totalPages": 1,
    "hasNextPage": false,
    "hasPrevPage": false
  }
}

Step 3: Implement Content Fetch

Return actual content by hash. Support range requests for large files.

GET /ewp/contents/:content_hash

# Response headers
Content-Type: text/markdown; charset=utf-8
X-Content-Hash: 0xHashOfContent
X-Created-At: 2026-01-15T10:30:00.000Z

# Response body: markdown content or binary

Step 4: Implement EIP-712 Signing

Sign publications with EIP-712 typed data. This proves authorship.

Typed Data Structure

{
  "domain": {
    "name": "Epress",
    "version": "1",
    "chainId": 1
  },
  "types": {
    "Publication": [
      { "name": "contentHash", "type": "bytes32" },
      { "name": "authorAddress", "type": "address" },
      { "name": "timestamp", "type": "uint256" }
    ]
  },
  "primaryType": "Publication",
  "message": {
    "contentHash": "0xHashOfContent",
    "authorAddress": "0xYourAddress",
    "timestamp": 1705312800
  }
}

See the EIP-712 Signing Spec for complete type definitions.

Step 5: Handle Connection Requests

Accept follow requests from other nodes with signed handshakes.

POST /ewp/connections

# Request body
{
  "typedData": { /* EIP-712 Connection typed data */ },
  "signature": "0x..."
}

# Success response
{ "status": "created" }

Step 6: Verify Incoming Signatures

Always verify signatures on incoming requests:

  1. Recover signer address from signature and typed data
  2. Verify signer matches the claimed address in the message
  3. Check timestamp is recent (prevent replay attacks)
  4. Verify the domain matches Epress domain spec

Testing Your Implementation

Test against the reference epress node implementation:

# Get profile
curl https://reference-node.example.com/ewp/profile

# Get publications
curl 'https://reference-node.example.com/ewp/publications?limit=10'

# Get content
curl 'https://reference-node.example.com/ewp/contents/0xHash'