What is a smart contract?
A smart contract is a small program stored on a blockchain that runs exactly as written — no one can pause it, change its rules after the fact, or make an exception for a friend. Once deployed, its code is the agreement.
A simple analogy
Think of a vending machine. You put in 500 FCFA, press B3, and a drink drops — automatically, every time, for everyone. No cashier can give their cousin a discount or “forget” to give change. A smart contract works the same way, but instead of drinks and coins, it moves tokens, records data, or manages a Njangi pot.
Anatomy of a Solidity contract
Here’s a tiny contract that tracks Njangi contributions. Don’t worry about understanding every line yet — you’ll write your first one in Build Your First Smart Contract.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
contract NjangiPot {
mapping(address => uint256) public contributions;
// Anyone can contribute. The amount is recorded forever.
function contribute() external payable {
contributions[msg.sender] += msg.value;
}
// Anyone can verify any member's total — no trust required.
function totalContributed(address member) external view returns (uint256) {
return contributions[member];
}
}- contract — the container for the rules, like the vending machine itself
- mapping — a lookup table (address → amount), like a ledger page per member
- function — an action anyone can trigger, following the written rules exactly
Where do smart contracts run?
| Platform | Language | Runtime |
|---|---|---|
| Ethereum & EVM chains | Solidity | Ethereum Virtual Machine (EVM) |
| Solana | Rust (with Anchor) | Sealevel runtime — parallel execution, very low fees |
Fundi3’s Developer track covers both — Solidity in the embedded Remix IDE, and Rust/Anchor in the embedded Solana Playground.
Why this matters for Africa
A Njangi works on trust — everyone trusts the treasurer to record contributions and pay out fairly. A smart contract removes the need for that trust: the rules are public, automatic, and impossible to bend. No treasurer can disappear with the pot, and every member can verify every contribution themselves, anytime.
Was this helpful?