The Blockchain Peer UI is a decentralized application for managing item reservations on a blockchain network. Each peer can request items, release them back to the pool, mine blocks to earn credits, and participate in a peer-to-peer network.
# normal python script
python peer_ui.py [port]
# or if you choose to run the binaries
peer_ui [port]- Default port: 6000
- Example:
python peer_ui.py 6001(starts on port 6001) - Each peer needs a unique port number
When you first start the application:
- A new blockchain is created (or loaded if one exists)
- Your initial balance is 0 credits
- You need to mine blocks to earn credits before requesting items
- Chain Length: Number of blocks in the blockchain
- Peers: Number of connected peers
- Integrity: Blockchain validation status (OK/CORRUPT)
- Reserved: Items you currently hold
- Mempool: Pending transactions waiting to be mined
- Balance: Your available credits
- Overview - View and select items
- Peers - See connected peers
- Blockchain - Browse blocks and transactions
- Activity Log - Recent events and messages
The Overview tab shows two lists:
Items you currently hold, showing:
- Item name
- Current value (what you'll get back if you release it)
- Demand count (how many others want it)
- Escrow amount (accumulated from buyout attempts)
Example: item_42 [Value: 15.0, Demand: 3, Escrow: 2.50]
Items not currently reserved by anyone
Method 1: Double-click
- Go to the Overview tab
- Double-click an item in the Available Items list
- It's added to your batch queue
Method 2: Manual entry
- Type the item name in the text box (left panel)
- Select REQUEST from the dropdown
- Click Add to Batch (or press Enter)
Cost: Standard request = 10 credits
Method 1: Double-click
- Go to the Overview tab
- Double-click an item in the Reserved Items list
- It's added to your batch queue
Method 2: Manual entry
- Type the item name in the text box
- Select RELEASE from the dropdown
- Click Add to Batch
Refund: You receive the item's current value + your share of escrow (66.67% of accumulated escrow)
The Batch Queue (left panel) shows all pending operations before execution.
Add items:
- Double-click from Overview tab
- Enter manually with action selector
Remove items:
- Select an item in the queue
- Press Delete or Backspace
- Or click the Remove button
Clear all:
- Click Clear All to empty the entire queue
- Add one or more items to the batch
- Click Execute Batch button
- Transactions are broadcast to all connected peers
- Wait for a miner to include them in a block
Important: You must have sufficient credits for all REQUEST operations in the batch.
- Wait for transactions to appear in the mempool
- Click Mine Block from Mempool
- A new block is created and broadcast to peers
Mining Reward: 50 credits + any escrow distribution fees
Enable automatic mining to continuously mine blocks when transactions are pending:
- Check the β‘ Auto-mine (background) checkbox
- Mining runs automatically every few seconds
- Uncheck to disable
Recommended for: Active participants who want to earn consistent rewards
When you request an item that someone else holds:
If you have enough credits (β₯ current value):
- You make a BUYOUT OFFER π€
- Current holder receives the offer amount
- You get the item
- Display:
REQUEST: item_42 π€ BUYOUT (-15.0 credits)
If you don't have enough credits:
- A PENALTY is applied
β οΈ - Penalty amount depends on demand
- Item value increases for current holder
- Your credits go into escrow
- Display:
REQUEST: item_42 β οΈ PENALTY (-3.5 credits, 35%)
- Base value: 10 credits
- Value increases with demand
- High-demand items show π₯ indicator (5+ requests)
- Released items return to base value
Menu: Network β Connect to Peer... (Ctrl+N)
- Enter peer's Host (e.g.,
localhostor IP address) - Enter peer's Port (e.g.,
6001) - Click Connect
Example Setup:
- Peer 1:
python peer_ui.py 6000 - Peer 2:
python peer_ui.py 6001 - From Peer 2, connect to
localhost:6000
Menu: Network β Sync Chain (Ctrl+S)
Manually request the latest blockchain from connected peers. The app also auto-syncs every 30 seconds.
View all connected peers with:
- Address (host:port)
- Connection status
- Blocks/transactions received
- Message statistics
- Uptime
Browse the entire blockchain:
- Blocks listed newest first
- Click βΆ to expand and view transactions
- Transaction types:
- βοΈ COINBASE - Mining reward
- REQUEST - Item reservation
- RELEASE - Item returned
- π° BUYOUT OFFER - Buyout attempt
- TRANSFER - Credit transfer
Real-time feed of all events:
- π€ Broadcast transactions
- π¨ Received transactions
- π¦ New blocks
- βοΈ Mining activity
- π Network connections
β οΈ Errors and warnings
- Mine regularly - Auto-mining ensures steady income
- Release high-demand items - Earn more from escrow accumulation
- Accept buyout offers - Instant profit when someone offers more than base value
- Check demand before releasing - High-demand items earn more
- Monitor escrow - Items with escrow accumulation are valuable
- Don't hoard unnecessarily - Release unused items to earn credits
- Connect to multiple peers - Ensures chain consistency
- Sync regularly - Keep your chain up to date
- Monitor integrity - Watch for corruption warnings
- Check balance before batching - Ensure you can afford all operations
- Don't request reserved items without credits - Penalties add up quickly
- Mine before requesting - Build up credit reserves first
| Shortcut | Action |
|---|---|
| Ctrl+N | Connect to new peer |
| Ctrl+S | Sync blockchain |
| Ctrl+Q | Exit application |
| Enter | Add item to batch (when in text field) |
| Delete/Backspace | Remove selected item from batch |
- Solution: Mine blocks to earn credits before requesting items
- Auto-repair: The system attempts automatic repair
- Manual fix: Check Activity Log for repair status
- Check: Ensure peer addresses and ports are correct
- Firewall: Verify network allows connections on your port
- Restart: Try restarting both peers
- Mine a block: Transactions need to be mined into blocks
- Enable auto-mining: Automatic block creation
- Wait for peers: Other peers may mine the transactions
Your blockchain data is automatically saved to:
~/.databox/material/blx.pkl
The chain is saved:
- After each mined block
- On application exit
- Periodically during operation
| Term | Definition |
|---|---|
| Mempool | Pool of pending transactions waiting to be mined |
| Mining | Creating new blocks and earning rewards |
| Coinbase | Special transaction that pays mining rewards |
| Escrow | Credits held when buyout offers fail |
| Demand | Number of pending requests for a reserved item |
| Integrity | Validation that blockchain hasn't been corrupted |
| Peer | Another node in the blockchain network |
| Nonce | Number used in mining to find valid blocks |
-
Launch two peers:
python peer_ui.py 6000 # Terminal 1 python peer_ui.py 6001 # Terminal 2
-
Connect peers:
- In peer 6001: Network β Connect to Peer
- Host:
localhost, Port:6000
-
Mine initial credits:
- Enable auto-mining on both peers
- Wait for a few blocks to be mined
-
Request an item:
- Double-click an available item
- Click "Execute Batch"
- Mine a block to confirm
-
Release the item:
- Double-click your reserved item
- Click "Execute Batch"
- Mine to confirm and receive refund
Need Help? Check the Activity Log tab for detailed error messages and status updates.