PeakeCoin Merchant PaymentssteemCreated with Sketch.

in #finance10 days ago

PeakeCoin Payments in Action

Real-Life Blockchain Payments on Hive Engine: Behind the Code

Blockchain payments aren't just a far-off dream — they're happening in real life, right here in Maryland. In this blog, we dive deep into the technical side of PeakeCoin’s real-world Hive Engine integration. This system powers real transactions, like those made at Neo Pizza, where customers can pay with crypto at the counter.

The Technical Stack

Core Components

  • Hive Engine: A blockchain platform for token-based payments.
  • Payment Gateway: A Node.js/Express server acting as the merchant's cashier system.
  • Merchant SDK: Library to manage wallet connections and payment verification.
  • Mobile Wallet: A sample Android app using Hive Keychain for secure signing.

Repository Highlights

File / FolderPurpose
README.mdProject overview and setup
HIVE_ENGINE_INTEGRATION.mdBlockchain transaction integration
NEO_PIZZA_INTEGRATION.mdReal-world use case setup
IMPLEMENTATION_GUIDE.mdStep-by-step setup
TESTING_GUIDE.mdHow to test everything end-to-end
merchant-sdk/Merchant's crypto payment library
mobile-wallet/Sample mobile app
payment-gateway/Core payment processor

Breaking Down the Code

Server Setup (server.js)

const express = require('express');
const cors = require('cors');
const helmet = require('helmet');
const dotenv = require('dotenv');
const mongoose = require('mongoose');
const WebSocket = require('ws');
const http = require('http');

dotenv.config();

const app = express();
const server = http.createServer(app);
const wss = new WebSocket.Server({ server });

What it does:

  • Creates a secure Express server with CORS and Helmet for safety.
  • Establishes a WebSocket server for live transaction updates.
  • Loads environment variables and connects to MongoDB for data storage.

Routing

app.use('/api/payment', require('./routes/payment'));
app.use('/api/merchant', require('./routes/merchant'));
app.use('/api/auth', require('./routes/auth'));

Each route handles different parts of the system: payment processing, merchant management, and authentication.

WebSocket Real-Time Transactions

wss.on('connection', (ws) => {
    console.log('New WebSocket connection');

    ws.on('message', (message) => {
        const data = JSON.parse(message);
        console.log('Received:', data);
    });

    ws.on('close', () => {
        console.log('WebSocket connection closed');
    });
});

This allows merchant POS devices to get real-time payment confirmations directly from the blockchain.

MongoDB Integration

mongoose.connect(process.env.MONGODB_URI || 'mongodb://localhost:27017/peakecoin-gateway')
    .then(() => console.log('Connected to MongoDB'))
    .catch(err => console.error('MongoDB connection error:', err));

The MongoDB database stores transactions, merchant data, and session information.

Example: Neo Pizza

Neo Pizza became one of the first locations to accept PeakeCoin directly from a mobile wallet. The steps included deploying the payment gateway in-store, configuring the blockchain link, and using a WebSocket POS terminal to confirm each transaction instantly.

The Implementation Flow

Customer Wallet → Hive Engine Blockchain → Payment Gateway → Merchant POS

image.png

The Future

This open-source framework allows other Maryland businesses and beyond to start accepting crypto with minimal effort. Future improvements could add better token support, enhance user experience for the merchant, and build a fully polished mobile wallet.


Built in Maryland, for the world.

Sort:  

Upvoted! Thank you for supporting witness @jswit.