Peake_Dad avatar

Minecraft - Hive Engine - Backend

strangedad

Published: 16 Mar 2026 β€Ί Updated: 16 Mar 2026Minecraft - Hive Engine - Backend

Minecraft - Hive Engine - Backend

This currently isn't up and running... I'm trying. I'm just one man. If you build anything within the game, please share what you've made.

I'm here with this at the moment. I'm sure I'll have to update this once I start testing it. I'm also trying to find a way to implement Hive earnings for completing tasks as well.

Everything helps. I currently have to pay $2 a month for the server it's running on. If users start to help me with building, we may need to upgrade where it's at.


import json
import os
from http.server import BaseHTTPRequestHandler, HTTPServer

# Optional dependency: beem (pip install beem)
try:
    from beem import Hive
    from beem.transactionbuilder import TransactionBuilder
except Exception:  # pragma: no cover
    Hive = None
    TransactionBuilder = None

HOST = "127.0.0.1"
PORT = int(os.getenv("HIVE_BRIDGE_PORT", "8787"))
AUTH_TOKEN = os.getenv("HIVE_BRIDGE_TOKEN", "")
HIVE_NODE = os.getenv("HIVE_NODE", "https://api.hive.blog")
ACTIVE_WIF = os.getenv("HIVE_ACTIVE_WIF", "")


def build_custom_json(action: str, account: str, symbol: str, price: str, quantity: str):
    payload = {
        "contractName": "market",
        "contractAction": action,
        "contractPayload": {
            "symbol": symbol,
            "price": price,
            "quantity": quantity,
        },
    }
    return {
        "id": "ssc-mainnet-hive",
        "json": json.dumps(payload, separators=(",", ":")),
        "required_auths": [account],
        "required_posting_auths": [],
    }


def submit_trade(action: str, account: str, symbol: str, price: str, quantity: str):
    if not Hive or not TransactionBuilder:
        return False, "beem not installed"
    if not ACTIVE_WIF:
        return False, "HIVE_ACTIVE_WIF not set"

    hive = Hive(node=HIVE_NODE, keys=[ACTIVE_WIF])
    tx = TransactionBuilder(blockchain_instance=hive)
    op = ["custom_json", build_custom_json(action, account, symbol, price, quantity)]
    tx.appendOps(op)
    tx.appendSigner(account, "active")
    tx.sign()
    tx.broadcast()
    return True, tx.get("id")


class Handler(BaseHTTPRequestHandler):
    def _send(self, code, body):
        data = json.dumps(body).encode("utf-8")
        self.send_response(code)
        self.send_header("Content-Type", "application/json")
        self.send_header("Content-Length", str(len(data)))
        self.end_headers()
        self.wfile.write(data)

    def do_POST(self):
        if self.path != "/trade":
            self._send(404, {"ok": False, "error": "not found"})
            return

        if AUTH_TOKEN:
            auth = self.headers.get("Authorization", "")
            if auth != f"Bearer {AUTH_TOKEN}":
                self._send(401, {"ok": False, "error": "unauthorized"})
                return

        length = int(self.headers.get("Content-Length", "0"))
        body = self.rfile.read(length).decode("utf-8")
        try:
            payload = json.loads(body)
        except json.JSONDecodeError:
            self._send(400, {"ok": False, "error": "invalid json"})
            return

        action = payload.get("action")
        account = payload.get("account")
        symbol = payload.get("symbol")
        price = payload.get("price")
        quantity = payload.get("quantity")

        if action not in ("buy", "sell"):
            self._send(400, {"ok": False, "error": "invalid action"})
            return
        if not all([account, symbol, price, quantity]):
            self._send(400, {"ok": False, "error": "missing fields"})
            return

        ok, result = submit_trade(action, account, symbol, price, quantity)
        if ok:
            self._send(200, {"ok": True, "txid": result})
        else:
            self._send(500, {"ok": False, "error": result})


if __name__ == "__main__":
    server = HTTPServer((HOST, PORT), Handler)
    print(f"Hive bridge listening on http://{HOST}:{PORT}")
    server.serve_forever()

πŸͺ™ PeakeCoin Ecosystem

πŸ’± PeakeCoin USDT Bridge (Hive ↔ Polygon/MATIC)
Bridge SWAP.USDT from Hive Engine to USDT on Polygon (MATIC).
Whitelist access, documentation, and bridge status updates:
πŸ‘‰ https://geocities.ws/peakecoin


βš™οΈ HiveP.I.M.P. β€” PeakeCoin Intelligent Market Protector
Operated by hivepimp@hivepimp, P.I.M.P. focuses on stabilizing PEK markets and strengthening liquidity on Hive Engine.
Community participation supports long-term ecosystem health.


πŸ€– PeakeBot β€” Autonomous Trading System
Independent multi-token trading bot with RC-awareness, adaptive delay logic, and smart cycle control.
πŸ“Š Trading bot documentation:
πŸ‘‰ https://geocities.ws/p/e/peakecoin/trading-bot/peakebot_v0_01.html
πŸ’» Open-source repositories:
πŸ‘‰ https://github.com/paulmoon410


🎰 PeakeSino β€” The PeakeCoin Casino (Beta)
Blockchain-powered games using PEK as the native in-game currency.
Built on Hive with a focus on provable fairness and community-driven growth.
πŸƒ Play the beta games here:
πŸ‘‰ https://geocities.ws/peakecoin/pek_casino/beta_games/index.html


πŸ™ Acknowledgements

Thanks to and please follow:
enginewitty@enginewitty ecoinstant@ecoinstant neoxian@neoxian txracer@txracer thecrazygm@thecrazygm holdonia@holdonia aggroed@aggroed

For their continued support, guidance, and help expanding the PeakeCoin ecosystem.


Leave Minecraft - Hive Engine - Backend to:

Written by

Surviving the American Dream, and a father of 2.

Read more #hive-125125 posts


Best Posts From Peake_Dad

We have not curated any of strangedad's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Peake_Dad