1️⃣ Indexer / Relay (Node.js)
This service:
• Connects to a SIGNUM node
• Scans blocks for public messages
• Exposes a simple API for posts
Requirements
• Node.js 18+
• A running SIGNUM node (local or remote)
Install
mkdir signum-social-relay
cd signum-social-relay
npm init -y
npm install express axios better-sqlite3
relay.js
const express = require("express");
const axios = require("axios");
const Database = require("better-sqlite3");
const SIGNUM_NODE = "https://europe.signum.network"; // change if needed
const PORT = 3000;
const app = express();
const db = new Database("posts.db");
db.prepare(`
CREATE TABLE IF NOT EXISTS posts (
txId TEXT PRIMARY KEY,
account TEXT,
timestamp INTEGER,
message TEXT
)
`).run();
Block Scanner
async function scanBlock(height) {
const block = await axios.get(`${SIGNUM_NODE}/burst?requestType=getBlock&height=${height}`);
const txs = block.data.transactions || [];
for (const txId of txs) {
const tx = await axios.get(`${SIGNUM_NODE}/burst?requestType=getTransaction&transaction=${txId}`);
if (tx.data.attachment?.message && !tx.data.attachment?.messageIsText === false) {
const stmt = db.prepare(`
INSERT OR IGNORE INTO posts (txId, account, timestamp, message)
VALUES (?, ?, ?, ?)
`);
stmt.run(
tx.data.transaction,
tx.data.senderRS,
tx.data.timestamp,
tx.data.attachment.message
);
}
}
}
Continuous Sync
let lastHeight = 0;
async function sync() {
const status = await axios.get(`${SIGNUM_NODE}/burst?requestType=getBlockchainStatus`);
const height = status.data.numberOfBlocks;
for (let h = lastHeight + 1; h <= height; h++) {
await scanBlock(h);
lastHeight = h;
}
}
setInterval(sync, 15000);
API Endpoints
app.get("/posts", (req, res) => {
const rows = db.prepare(
"SELECT * FROM posts ORDER BY timestamp DESC LIMIT 50"
).all();
res.json(rows);
});
app.get("/posts/:account", (req, res) => {
const rows = db.prepare(
"SELECT * FROM posts WHERE account = ? ORDER BY timestamp DESC"
).all(req.params.account);
res.json(rows);
});
app.listen(PORT, () =>
console.log(`SIGNUM Social Relay running on port ${PORT}`)
);
2️⃣ Minimal Client (HTML + JS)
This is intentionally simple — no frameworks.
index.html
SIGNUM Social
Timeline
client.js
⚠️ Posting is intentionally stubbed
You should use:
• SIGNUM Wallet
• XT Wallet
• Or any signer that can send a public message transaction
That keeps custody with the user — exactly as intended.
3️⃣ How Users Post (No Custom Code Needed)
Users post by sending a public message transaction:
• Recipient: any account (self is fine)
• Message: text content
• Message is public & text
• Fee: minimal
Your relay automatically picks it up.
⸻
✅ MVP SUCCESS CHECKLIST
✔ Uses existing SIGNUM network
✔ No protocol changes
✔ No central authority
✔ Posts persist forever
✔ Relay is replaceable
✔ Client is disposable
This is a real decentralized social MVP, not a demo.