BΞ›YΞ›NIHΞ›N

Viem Simulation Portal

πŸ‡΅πŸ‡­ Step-by-Step Guide

Bayanihan in Action β€”
No Coding Required

This portal walks you through the Bayanihan Quantum Commerce Chain simulation one step at a time. Every button explains exactly what it does in plain Filipino community language β€” so whether you're a farmer from Bukidnon or a developer from Makati, you'll know exactly what's happening.

πŸ”— Connects to Local Blockchain 🌾 Farmer & Fisherfolk Flows πŸ’Ό Freelancer Escrow πŸ›οΈ Barangay Governance 🌏 OFW Diaspora Network

πŸ› οΈ Before You Start β€” 3 Quick Checks

1
Node.js must be installed

This runs the blockchain simulation engine. Download it free at nodejs.org if you haven't already.

2
Start the local blockchain node

Open your terminal, go to the Bayanihan folder, and run:

npx hardhat node

Leave that window running. It's your "local bank" for this demo.

3
Compile the smart contracts

In a second terminal window, inside the Bayanihan folder, run:

npm run compile

This prepares all the digital rulebooks for the simulation.


Choose Your Citizen Role

In the Bayanihan ecosystem, every Filipino has a verified digital identity that matches their real-world work. Click a role below to see what that citizen can do in the system β€” it's like choosing your character in a game, except this one actually helps your community.

πŸ‘¨β€πŸŒΎ
Farmer
Registers crop harvests, sells forward contracts directly to buyers (no middleman!)
🎣
Fisherfolk
Logs sustainable catches, earns conservation bonuses from the community treasury
πŸͺ
MSME Merchant
Builds credit score by logging sales volume. Higher score = lower platform fees
πŸ‘¨β€πŸ’»
Freelancer
Gets paid through tamper-proof milestone escrow. Reputation score discounts your fees
✈️
OFW Diaspora
Funds relative micro-loans from abroad, earns Diaspora Impact Score and rewards
πŸ‘©
General Citizen
Votes in Barangay DAO proposals, joins cooperative health pools and housing

Simulation Steps
1
πŸš€ Deploy the Digital Rulebooks
Set up all smart contracts on the local blockchain
Ready β–Ό
πŸ“–

What does "deploy" mean in plain language?

Imagine the Bayanihan rules are a barangay charter β€” a set of official agreements everyone follows. Deploying means uploading these digital rulebooks onto the blockchain so they become permanent, tamper-proof, and automatic. Nobody can secretly change the rules afterwards.

⚑

What this does: Deploys all 7 core contracts (BayaniToken, QuantumIdentity, National Treasury, FarmerProsperity, FreelancerEscrow, and more). Then it automatically gives the right permissions to each contract β€” like handing out official barangay stamps.

🏦
50,000 BAYANI tokens seeded into the Rewards Treasury The national treasury that pays farmers, freelancers, and OFWs for their verified work
βš™οΈ This triggers: node examples/7_bayanihan_sim.js Deploying BayaniToken... βœ… Deploying QuantumIdentity... βœ… Deploying NationalRewardsTreasury... βœ… Deploying FarmerProsperity... βœ… Deploying FreelancerEscrow... βœ… Funding Treasury with 50,000 BAYANI... βœ…
2
πŸͺͺ Register & Verify Citizen Identities
Create soulbound digital IDs for a Farmer and a Freelancer
Waiting… β–Ό
πŸ†”

What is a "Soulbound Token" (SBT)?

Think of your PhilSys National ID β€” it belongs exclusively to you and can't be sold or given to someone else. An SBT is a digital version of that on the blockchain. It proves you're a verified Filipino citizen in a specific role (like Farmer or Freelancer) without exposing your personal data publicly. Your identity earns you access β€” it can never be traded or speculated on.

πŸ”

What this does: Two citizens get registered β€” a Farmer (type 1) and a Freelancer (type 4). A Government Validator then stamps them as verified. The freelancer also gets an AI Reputation Score of 85/100 based on past work history. This score will lower their contract fees automatically.

πŸ‘¨β€πŸŒΎ
Juan Dela Cruz
Farmer β€” National ID hash: NID_FARMER_11
πŸ‘¨β€πŸ’»
Kiko Rustia
Freelancer β€” Reputation Score: 85/100
3
🌾 Farmer Registers Organic Harvest
Mint a Crop NFT and earn 2Γ— organic farming rewards
Waiting… β–Ό
🌾

Why does the farmer earn more for organic produce?

Organic farming is better for the land, healthier for Filipinos, and harder to produce. The Bayanihan smart contract automatically doubles the reward (from 10 to 20 BAYANI) when a farmer certifies their produce as organic β€” no middleman decides this, the code enforces it automatically. Climate-friendly practices earn an additional bonus.

🌿
+20 BAYANI Organic Reward (2Γ— multiplier) Abaca Hemp β€” 100 kg β€” Organic βœ… Climate-Friendly βœ… Water-Conserving βœ…
πŸ–ΌοΈ

Also creates: A digital Crop Certificate NFT β€” a unique certificate that proves this exact harvest exists, who grew it, when, and where. This certificate can then be listed on the Direct-to-Consumer Marketplace so buyers can purchase it directly from the farmer.

πŸͺ

Next β€” selling on the marketplace: The farmer lists the Crop NFT at 500 BAYANI. A buyer pays directly. When delivery is confirmed, the farmer earns 30 more BAYANI (3Γ— Direct-to-Consumer bonus). The NFT locks in the contract so it can't be double-sold.

4
πŸ’Ό Freelancer Milestone Escrow
Lock client funds safely; reputation auto-discounts the fee
Waiting… β–Ό
πŸ”’

How does the Escrow protect both the client and the freelancer?

Imagine hiring a web developer but being afraid they won't deliver, or a developer afraid the client won't pay. The Bayanihan smart contract acts like a trusted third party that everyone agrees to in advance. The client's budget is locked inside the digital contract. The freelancer only gets paid after submitting work AND the client approves each milestone. No one can cheat.

πŸ’°
Dynamic Fee Discount based on Reputation Score Kiko's 85/100 score reduces the base 2.0% fee β†’ net fee of ~1.15%. On a 1,000 BAYANI project, he saves 8.5 BAYANI
πŸ“ Fee Calculation Base fee: 2.00% (200 BPS) Reputation: 85/100 Discount BPS: min(85, 100) = 85 BPS Net fee BPS: 200 βˆ’ 85 = 115 BPS = 1.15% Fee on 1,000: 11.5 BAYANI Kiko receives: 988.5 BAYANI βœ…
βš–οΈ

If there's a dispute: Either party can raise a flag. A designated Arbitrator (like a barangay mediator) reviews the case and splits the funds fairly. The losing party's reputation score is automatically reduced to discourage bad behavior.

βœ“
πŸŽ‰ View Final Balances & Summary
See the complete economic result of the simulation
Waiting… β–Ό
πŸ“Š

What does this show?

After running all simulation steps, this shows every BAYANI token movement β€” who earned what, how fees were applied, and how the Treasury distributed rewards. It's a complete audit trail that proves the system works transparently.

πŸš€

What's next after this simulation? Deploy to an EVM testnet (Polygon Amoy or Sepolia) using the command npx hardhat run scripts/deploy.js --network sepolia and interact with it using a real MetaMask wallet. The main portal at frontend/index.html connects directly.

Live Activity Log

πŸ“‘

Your blockchain activity
will appear here in real-time.

Start with Step 1 above ↑

Progress 0 of 4 steps complete

Plain-Language Web3 Glossary

πŸ” What Do These Words Mean?

πŸ†”
Soulbound Token (SBT)
Your permanent, non-tradeable digital ID card on the blockchain. Like a PhilSys card, it belongs only to you and proves your verified role β€” Farmer, Freelancer, OFW, etc. It can never be sold or faked.
πŸ“œ
Smart Contract
A digital barangay ordinance that runs automatically without anyone controlling it. When conditions are met (e.g., "buyer confirmed delivery"), it releases funds to the farmer β€” no delays, no middlemen, no corruption possible.
πŸ–ΌοΈ
Crop NFT
A unique digital certificate tied to a specific real-world harvest. Think of it as a digital "kalusugan ng pananim" certificate β€” it proves this exact batch of rice or tuna came from a verified source.
πŸ”’
Escrow
A secure digital lockbox. A client's budget is stored inside a smart contract when a project starts. The freelancer only receives payment after the client approves the work. Nobody can steal or disappear with the funds.
πŸͺ™
BAYANI Token
The community currency of the Bayanihan ecosystem β€” used to pay for services, vote in community decisions, and earn rewards for productive activities. It is a utility token, not an investment β€” earning it requires real work.
πŸ›οΈ
Barangay DAO
A digital democracy tool for community decisions. Citizens stake BAYANI tokens to gain voting power on local infrastructure proposals (e.g., solar streetlights). A voting weight cap prevents wealthy individuals from dominating decisions.
🏒
Real-World Asset (RWA)
A physical community facility (like a drying warehouse or solar microgrid) that is digitally divided into fractional shares. Owning shares gives you utility discounts on that facility β€” not cash dividends β€” to stay within SEC rules.
πŸ›‘οΈ
Post-Quantum Keys
Ultra-secure encryption that protects your digital identity even from future quantum computers (which could break today's encryption). Bayanihan lets you rotate your keys to stay protected as technology advances.
⭐
AI Reputation Score
A score out of 100 that measures your track record on the platform β€” on-time delivery, ratings from clients, dispute resolution results. A higher score automatically reduces your platform fees β€” it rewards trusted contributors.