Evolution of the web, smart contracts & the vending machine analogy.
Quantum Identity, AI Reputation Oracle, and Rewards Treasuries.
Agriculture, Crop NFTs, sustainable fishing log, solar credits.
Sari-Sari credit scores, Milestone Escrow, and Soulbound scholarships.
Whale-proof voting DAO, Mutual Healthcare Assistance, Co-op housing.
OFW support networks, RWA tokenization, and proof-of-life succession.
Welcome to the Bayanihan Web3 E-Book. This guide is designed specifically for non-technical readers, community organizers, students, and entrepreneurs to show how smart contracts function in the real world.
Instead of using complex theoretical math or dense code, we will explore these concepts through the lens of Bayanihanβthe traditional Filipino spirit of communal unity, cooperation, and mutual support. We will dissect the 15 custom smart contracts powering the Bayanihan digital nation, converting Solidity code into everyday analogies.
| Era | Core Capability | Control | Visual Analogy |
|---|---|---|---|
| Web1 (1990s) | Read-Only | Centralized (Publishers) | A library where you can only read books off the shelves. |
| Web2 (2000s) | Read & Write | Centralized (Big Tech) | A social media board where you upload content, but the board owner owns your profile. |
| Web3 (Future) | Read, Write & Own | Decentralized (Community) | A cooperative marketplace owned, run, and secured by the participants themselves. |
At the heart of Web3 is the Smart Contract. It is simply a digital agreement written in software code instead of legal documents.
Once a smart contract is uploaded to a blockchain, it becomes:
The Vending Machine AnalogyThink of a traditional contract like hiring a lawyer: you pay them, wait, and hope they enforce the rules.
A smart contract is like a vending machine: you drop in a coin (input data/tokens), and the machine automatically drops your soda (output code action). There is no intermediary standing in the way.
Let's dive into how the Bayanihan suite uses this technology to support community livelihoods across five core pillars.
Post-Quantum Digital ID & Social Recovery
Imagine losing the keys to your house, and the locksmith tells you that you can never enter again, and everything inside is lost forever. In early blockchain systems, losing your private keys meant losing your life savings. How do we build a system that is secure enough to withstand future supercomputers but gentle enough to help you recover your account?
In Web3, your wallet address is your account. QuantumIdentity.sol is a smart registry that does two things:
PQKey) that can absorb next-generation cryptographic keys (like Crystals-Dilithium) to ensure quantum computers can't hack your account.Off-Chain Character Reference
When a local bank decides to lend you money, they look up your credit history. But what if you are a freelancer or a farmer who has never had a bank account? How do you prove you are reliable to someone on the other side of the country?
An Oracle is a bridge that brings real-world data onto the blockchain. AIReputationOracle.sol takes external data (like customer ratings, on-time deliveries, and community work) and logs a verified Reputation Score (from 0 to 100) on-chain.
Figure 1.1: Core Trust Infrastructure Interconnectivity
The Community Safety Vault
If a community cooperative has a communal vault, what is to stop one greedy member from showing up with a truck and loading all the sacks of rice at once, leaving nothing for the rest?
NationalRewardsTreasury.sol is the smart vault that manages the distribution of incentives. It uses:
Chapter 1 Common MistakesGuardian Neglect: Forgetting to update your guardians when a friend changes their phone/wallet, or when a relationship changes.
Self-Recovery Failure: Trying to initiate recovery using your own old wallet. The old wallet is lost; only your guardians can call
initiateRecovery().
Our digital cooperative's foundational infrastructure runs on three key principles:
Crop Certificates & Weather Insurance
A farmer works hard for three months, only for a typhoon to destroy the crop. The local middleman offers a predatory loan to help them survive. How can Web3 break this cycle?
FarmerProsperity.sol introduces three powerful Web3 concepts:
| Step | Action | Actor | On-Chain State |
|---|---|---|---|
| 1 | Register Harvest | Farmer | NFT Minted + Eco-Rewards Disbursed |
| 2 | List Future Harvest | Farmer | NFT Locked in Escrow |
| 3 | Purchase | Buyer | Funds Locked in Escrow |
| 4 | Confirm Delivery | Buyer/Farmer | NFT to Buyer, Funds to Farmer |
Figure 2.1: Farmer-to-Buyer Escrow Settlement Flow
Oceans of Data & Catch Verification
If a fisher logs that they caught 100 kg of tuna, how do we know they didn't catch endangered reef fish instead, or catch them in a marine sanctuary?
FisherfolkRewards.sol rewards sustainable fishing through decentralized verification:
Eco-Multiplier ExampleStandard Catch Bonus: 10 BAYANI.
With Eco-Multiplier (Beach Cleanup + GPS outside marine sanctuary): 1.5x Multiplier = 15 BAYANI.
Peer-to-Peer Solar Trading
If you install solar panels on your roof, you often have to sell excess energy back to a single monopoly utility grid at a price they dictate. What if you could barter your clean energy credits directly with your neighbors?
RenewableEnergy.sol handles decentralized smart meter logs:
Bayanihan applies smart contracts to physical work: harvesting crops, fishing sustainably, and generating solar energy, connecting physical effort directly to digital rewards.
Building Small Business Credit Histories
A sari-sari store (micro-convenience shop) runs entirely on cash. Because there are no formal records, they can't get a bank loan to expand, forcing them to turn to loan sharks.
MSMEGrowth.sol creates a formal, trustless business ledger:
| Tier | On-Chain Sales Required | Escrow Fee Discount | Loan Rate Cap |
|---|---|---|---|
| Basic | 0 - 10,000 PHP | 0% | 12% APR |
| Silver | 10,000+ PHP | 25% | 8% APR |
| Gold | 50,000+ PHP + Good Rep | 50% | 5% APR |
Safe Payments for Remote Workers
A freelance graphic designer finishes a logo for an international client, only for the client to block them and refuse to pay. Conversely, a client pays a developer upfront, only for the developer to disappear.
FreelancerEscrow.sol secures payments through a Neutral Escrow Lock:
Figure 3.1: Milestone Escrow Dispute Escalation Flow
Escrow PitfallsSkipping Milestones: Locking the entire budget in a single milestone defeats the purpose. Break work into small, digestible weekly deliverables.
Soulbound Credentials & Scholarships
In a world of digital forgery, anyone can copy-paste a certificate or resume. How can we prove a student actually took a class and passed it, without needing to verify with a university registrar every time?
EducationRewards.sol introduces Soulbound Tokens (SBTs):
MSME revenue logging builds formal credit histories, Milestone Escrow protects digital workers, and Soulbound Tokens guarantee credential integrity, enabling digital growth.
Democratic Decisions without Whales
In typical blockchain voting (DAOs), voting power is determined by the number of tokens you own. This means a single multi-millionaire (a "whale") can outvote 1,000 ordinary community members combined. How do we keep democracy fair?
BarangayDAO.sol solves this by implementing Voting Power Caps:
Figure 4.1: Democratic Barangay DAO Funding Path
Power Cap ExampleWithout Cap: Landlord (10,000 tokens) outvotes 50 Tenants (100 tokens each = 5,000 tokens).
With Cap: Max voting weight per address = 200 tokens. Landlord's vote is capped at 200. Tenants count for 5,000. Tenants win.
Mutual Aid Paluwagan
Traditional health insurance is expensive, full of fine print, and slow to pay. HealthcareAssistance.sol digitizes the traditional Filipino paluwagan (mutual savings club):
Crowdfunded Homes
Buying a home requires high-interest bank mortgages. HousingCooperative.sol enables fractional brick-by-brick equity:
The Digital Barangay allows decentralized, democratic organizations to manage community rules, run mutual health funds, and coordinate cooperative housing without massive administrative overhead.
Common PitfallsUnder-collateralized Paluwagan: Not maintaining enough reserves for peak flu seasons. Establish a minimum baseline liquidity pool inside the healthcare contract.
Supporting Families Across Borders
Overseas Filipino Workers (OFWs) send billions of dollars home every year, but traditional remittance networks charge high transfer fees. Additionally, OFWs have little control over how their remittances are used.
DiasporaNetwork.sol establishes direct support pools:
Figure 5.1: Diaspora Remittance & Impact Loop
Fractional RWAs with Utility Yields
If a community wants to fund a solar park or a public warehouse, they might want to sell shares to the public. However, paying out cash dividends often triggers strict regulatory compliance audits under securities law.
NationalAssetTokenization.sol tokenizes Real-World Assets (RWAs) using Utility Yields:
Inheritance Trusts without Lawyers
If a blockchain user unexpectedly passes away, their digital assets are locked forever inside their wallet, lost to their grieving family.
BayaniLegacy.sol is an automated inheritance vault:
registerProofOfLife() heartbeat.Diaspora pools provide low-cost remittance and credit options, RWA tokenization builds community utility assets, and succession vaults protect wealth across generations.
Bayanihan represents the best of us: working together to lift a home, support a neighbor, and feed a community. Web3 provides the digital toolbox to scale this spirit to global, transparent cooperative structures.
By designing smart contracts that focus on local identity, reputation, sustainability, and mutual assistance, we can shape a decentralized economy built for people, not just profits.
Acknowledgements
This e-book is a collective project of the Bayanihan digital nation initiative. Special thanks to the Solidity developers, community organizers, and cooperative farmers who provided feedback on these designs.
"Sama-sama sa pagsulong ng komunidad sa tulong ng teknolohiya."
Bayanihan Quantum Commerce Chain
Can a blockchain strengthen community bonds? Can smart contracts help a farmer sell their crops, or a neighborhood fund its own clinics? This guidebook outlines the 15 Solidity contracts of the Bayanihan suite, detailing a decentralized commerce chain designed for real-world impact.
Β© 2026 Bayanihan Foundation. All rights reserved.