This guide covers deploying the updated x1-json-server.js with transaction activity support to your remote server.
The server now includes a /transactions endpoint that provides mock transaction activity data for the Backpack wallet Activity page.
- ✅ POST
/transactionsendpoint for activity data - ✅ Mock transaction generation with multiple types (SEND, RECEIVE, SWAP, STAKE, etc.)
- ✅ Pagination support (limit/offset)
- ✅ Compatible with existing wallet balance endpoint
- ✅ Build the wallet extension successfully
- ✅ Test server locally (optional)
- ✅ Have SSH access to
162.250.126.66 - ✅ Node.js installed on remote server
# From your local machine
scp x1-json-server.js root@162.250.126.66:/root/ssh root@162.250.126.66# Find the process
ps aux | grep x1-json-server
# Kill it (replace <PID> with actual process ID)
kill <PID>
# Or use pkill
pkill -f x1-json-servercd /root
node x1-json-server.jsYou should see:
================================================================================
🚀 X1 JSON Server Started
================================================================================
📡 Listening on: http://0.0.0.0:4000 (accessible from 162.250.126.66:4000)
📋 Endpoints:
GET /wallet/:address?providerId=X1 - Wallet balance & tokens
POST /transactions - Transaction activity
POST /v2/graphql - GraphQL queries
GET /test - Test page
# Install PM2 if not already installed
npm install -g pm2
# Start server with PM2
pm2 start x1-json-server.js --name "x1-server"
# Save PM2 configuration
pm2 save
# Enable startup on boot
pm2 startup
# Check status
pm2 statusnohup node x1-json-server.js > server.log 2>&1 &
# Check if running
ps aux | grep x1-json-server
# View logs
tail -f server.logFrom your local machine or the server:
# Test wallet endpoint (existing functionality)
curl "http://162.250.126.66:4000/wallet/5paZC1vV94AF513DJn5yXj2TTnTEqm4RuPkWgKYujAi5?providerId=X1"
# Test new transactions endpoint
curl -X POST http://162.250.126.66:4000/transactions \
-H "Content-Type: application/json" \
-d '{
"address": "5paZC1vV94AF513DJn5yXj2TTnTEqm4RuPkWgKYujAi5",
"providerId": "X1-testnet",
"limit": 10,
"offset": 0
}'You should receive a JSON response with mock transactions.
The extension is already configured to use http://162.250.126.66:4000 as defined in:
packages/common/src/constants.ts(line 440)
- Open Chrome:
chrome://extensions/ - Enable "Developer mode"
- Remove old Backpack extension if present
- Click "Load unpacked"
- Select:
/home/jack/backpack/packages/app-extension/build - Verify version:
0.10.61
- Open Backpack wallet extension
- Navigate to the Activity/Transactions tab
- You should see mock transactions appear
- Click "Load More" to test pagination
- Check browser console (F12) for logs:
🌐 [CustomTransactionHook] Fetching from...✅ [CustomTransactionHook] Response: { count: X, hasMore: true/false }
# View logs
pm2 logs x1-server
# Monitor in real-time
pm2 monit
# Restart server
pm2 restart x1-server
# Stop server
pm2 stop x1-server# View all logs
cat server.log
# Follow logs in real-time
tail -f server.log
# View last 50 lines
tail -n 50 server.logWhen a transaction request comes in, you'll see:
📥 Transaction Activity Request:
Address: 5paZC1vV94AF513DJn5yXj2TTnTEqm4RuPkWgKYujAi5
Provider: X1-testnet
Limit: 50, Offset: 0
✅ Returning 25 transactions (hasMore: false)
# Find process using port 4000
lsof -i :4000
# Kill the process
kill -9 <PID># Check if server is running
ps aux | grep x1-json-server
# Check server logs
tail -n 100 server.log # if using nohup
pm2 logs x1-server # if using PM2
# Restart server
pm2 restart x1-server # if using PM2- Check browser console for errors (F12)
- Verify server is accessible:
curl http://162.250.126.66:4000/transactions - Check CORS headers are present in response
- Verify
BACKEND_API_URLin extension matches server address
# Ensure port 4000 is open
sudo ufw allow 4000
# Or if using iptables
sudo iptables -A INPUT -p tcp --dport 4000 -j ACCEPTRequest:
{
"address": "wallet_address",
"providerId": "X1-testnet", // or "X1-mainnet", "SOLANA", etc.
"limit": 50, // max: 50
"offset": 0, // pagination offset
"tokenMint": "optional_token_mint"
}Response:
{
"transactions": [
{
"hash": "transaction_signature",
"type": "SEND|RECEIVE|SWAP|STAKE|UNSTAKE|NFT_MINT|NFT_SALE",
"timestamp": "2025-11-07T14:23:45.000Z",
"amount": "2.5",
"tokenName": "X1 Token",
"tokenSymbol": "XNT",
"fee": "0.00005",
"feePayer": "fee_payer_address",
"description": "Transfer to wallet",
"error": null,
"source": "wallet|dex|staking|marketplace",
"nfts": []
}
],
"hasMore": true,
"totalCount": 25,
"requestParams": {
"address": "...",
"providerId": "X1-testnet",
"limit": 50,
"offset": 0
},
"meta": {
"timestamp": "2025-11-07T15:30:00.000Z",
"version": "1.0.0"
}
}Currently, the /transactions endpoint returns mock data. To implement real transaction data:
-
Integrate with X1 Blockchain RPC
- Use similar approach to
getX1Balance()function - Query transaction history from X1 RPC
- Parse and format transactions
- Use similar approach to
-
Add Database/Cache Layer
- Store transaction history
- Enable faster queries
- Reduce RPC load
-
Implement Transaction Parsing
- Decode transaction instructions
- Identify transaction types
- Extract relevant data
Example RPC call for transactions:
// Get recent transactions for address
{
"jsonrpc": "2.0",
"id": 1,
"method": "getSignaturesForAddress",
"params": [
"address_here",
{"limit": 50}
]
}If you need to revert to the old server:
- Keep a backup of the old
x1-json-server.js - If issues occur, copy the old file back
- Restart the server
# Backup current version first
cp x1-json-server.js x1-json-server.js.backup
# If needed to rollback
cp x1-json-server.js.old x1-json-server.js
pm2 restart x1-serverIf you encounter issues:
- Check server logs first
- Verify network connectivity
- Test endpoints with curl
- Check browser console for errors
- Review this guide's troubleshooting section