BeamPay is a self-hosted payment gateway for seamless Beam blockchain transactions. It provides:
- Automated balance tracking by scanning the blockchain.
- Secure API for merchant integrations.
- Webhook notifications for deposits & withdrawals.
- Telegram monitoring (if enabled).
- Admin Dashboard for transaction tracking.
- Auto-recovery of services using systems.
Project Structure
BeamPay/
βββ api.py # FastAPI service for managing addresses, deposits, withdrawals
βββ process_payments.py # Background job for tracking blockchain transactions
βββ lib/beam.py # BEAM API Wrapper
βββ config.py # Configuration settings (loads .env variables)
βββ db.py # MongoDB connection
βββ .env.example # Example environment file
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
π Project Progress & TODO List
β Completed Tasks
- β Core Payment Processing - Track transactions, update balances
- β API Development - Secure FastAPI for deposits, withdrawals
- β Database Sync - Sync addresses, transactions, and assets in MongoDB
- β Webhook Integration - Notify services of deposits & withdrawals
- β Telegram Alerts - Notify users & admins about transfers
- β Admin Dashboard - Statistics & balance verification
π In Progress
- π§ Transaction History - User-friendly logs & filters
- π§ Security Enhancements - API Key Authentication & IP Whitelisting
π οΈ Upcoming Features
- π TBA
sudo apt update
sudo apt install -y mongodb
sudo systemctl enable mongod --now
Check if MongoDB is running:
sudo systemctl status mongod
sudo apt install -y python3 python3-pip python3-venv
Create a virtual environment & activate it
python3 -m venv venv
source venv/bin/activate
Install required Python packages
pip install -r requirements.txt
Copy the .env.example
file and update the values:
cp .env.example .env
nano .env
MONGO_URI=mongodb://localhost:27017/beampay
BEAM_API_RPC=http://127.0.0.1:10000
TELEGRAM_BOT_TOKEN=your_bot_token_here
WEBHOOK_URL=https://yourserver.com/webhook
Create a systemd service for API
sudo nano /etc/systemd/system/beampay-api.service
Add the following:
[Unit]
Description=BeamPay API Service
After=network.target
[Service]
User=root
WorkingDirectory=/path/to/BeamPay
ExecStart=/path/to/BeamPay/venv/bin/uvicorn api:app --host 0.0.0.0 --port 8000
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Create a systemd service for Payment Scanner
sudo nano /etc/systemd/system/beampay-payments.service
Add the following:
[Unit]
Description=BeamPay Payment Processor
After=network.target
[Service]
User=root
WorkingDirectory=/path/to/BeamPay
ExecStart=/path/to/BeamPay/venv/bin/python process_payments.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Enable & Start Services
sudo systemctl daemon-reload
sudo systemctl enable beampay-api
sudo systemctl enable beampay-payments
sudo systemctl start beampay-api
sudo systemctl start beampay-payments
Get deposit address
curl -X POST http://127.0.0.1:8000/create_wallet
Withdraw funds
curl -X POST http://127.0.0.1:8000/withdraw -H "Content-Type: application/json" -d '{"from_address": "your_wallet", "to_address": "recipient_wallet", "asset_id": "0", "amount": 1000000}'
Get balances
curl -X GET http://127.0.0.1:8000/balances?address=your_wallet
- Open
http://127.0.0.1:8000/dashboard
- Monitor transactions, balances, and users.
- Track mismatched balances between the blockchain & database.
Enable Telegram monitoring in
.env
TELEGRAM_BOT_TOKEN=your_bot_token_here
Monitored Events β Deposit received
β Withdrawal request
β Internal transfers
βοΈ Secure API authentication (API keys, IP whitelisting)
βοΈ Webhook notifications for deposits/withdrawals
βοΈ Automatic address & transaction syncing
βοΈ Admin Panel to monitor balances
βοΈ Auto-restarting services using systemd
For security reasons, it's recommended to disable SSH login using passwords and allow only key-based authentication.
Run the following command on your local PC (the one that should have access to the server):
cat ~/.ssh/id_rsa.pub
Copy the output, which is your public SSH key.
Log in to your server and open the authorized_keys
file:
nano ~/.ssh/authorized_keys
Paste the copied public key into the file. Save and exit by pressing CTRL + X, then Y, and ENTER.
Open a new terminal on your PC and try connecting to the server:
ssh root@YOUR_SERVER_IP
If you can connect without entering a password, the setup is correct.
Now, disable password authentication for SSH to enhance security.
Open the SSH configuration file:
sudo nano /etc/ssh/sshd_config
Find the following line:
PasswordAuthentication Yes
Change it to:
PasswordAuthentication No
Make sure there is only one occurrence of this setting in the file. Sometimes, another entry might be commented (#
) and a duplicate could exist later in the file.
Apply the changes by restarting the SSH service:
sudo systemctl restart sshd
mkdir beam-wallet
cd beam-wallet
Get the latest version of Beam Node here
wget -c https://github.com/BeamMW/beam/releases/download/latest/linux-beam-node.tar.gz -O - | tar -xz
- Add
horizon_hi=1440
at the end ofbeam-node.cfg
. - Add
fast_sync=1
at the end ofbeam-node.cfg
. - Add
peer=eu-nodes.mainnet.beam.mw:8100,us-nodes.mainnet.beam.mw:8100
at the end ofbeam-node.cfg
.
Run the node:
./beam-node
Get the latest version of Beam Wallet CLI here
wget -c https://github.com/BeamMW/beam/releases/download/latest/linux-beam-wallet-cli.tar.gz -O - | tar -xz
To create a wallet use:
./beam-wallet init
π‘ Keep your seed phrase in a safe place!
To restore a wallet use:
./beam-wallet restore --seed_phrase="<semicolon-separated list of 12 seed phrase words>"
For more information, read this guide.
Get the latest version of Beam Wallet API here
wget -c https://github.com/BeamMW/beam/releases/download/latest/linux-wallet-api.tar.gz -O - | tar -xz
Edit wallet-api.cfg
and add the following:
use_http=1
./wallet-api
For more information, read the API documentation.
- Fork the repository.
- Make your changes.
- Submit a Pull Request (PR).
π’ Join BEAM Telegram Group: https://t.me/BeamPrivacy
BeamPay is created by @vsnation
- Beam:
203ae2ac20c67c67e035e580284c472156356e783c33af4c74a87ab84169d433b01
- BTC:
3QVqpztjTXrfDCDaQiaVanHyjW6yGsWTRd