FarmlandToken deployed per parcel, a small backend that turns an NGN or KES deposit into minted shares via RampManager, and a React page investors use to check their position.
What you’ll build
- An admin script that deploys one
FarmlandTokenper parcel with real metadata (location, valuation, soil type, title document hash) - An Express API with three routes: get an on-ramp quote, start an investment (fiat → shares), and a webhook that mints shares once the deposit settles
- A React investor dashboard using
useAssetanduseTokenBalance
Prerequisites
- Node.js 18+
- A Stellar testnet account and secret key (
S...) — fund it with the Stellar Friendbot npm install @ankarachain/sdk express(addetherstoo if you also want the EVM path shown below)
1
Scaffold the project
src/config.ts builds the two SDK clients every route needs — a TokenFactory for the platform’s admin signer, and a RampManager wired to a fiat provider:src/config.ts
ManualRampProvider is the right default while you build — it needs no API keys and lets you drive sessions to "settled" yourself in tests. Swap in RampManager.connectAnchor() for a real Stellar anchor (Cowrie, MoneyGram) when you go live — see the Fiat Ramp guide.2
Deploy a FarmlandToken per parcel
Run this once per parcel you onboard. It’s the same Save the resulting
TokenFactory.deployFarmland() call whether you’re on Stellar or EVM — only the config passed to TokenFactory changes.- Stellar
- EVM
src/deploy.ts
tokenAddress — your platform’s database should map each parcel to its deployed token address and template ("farmland").3
Quote and initiate an investment
An investor picks a parcel and an amount in their local currency. Get a quote, then start an on-ramp session:
src/routes.ts
4
Mint shares once the deposit settles
In production, your fiat provider calls a webhook when the payment clears. Verify the payload, then mint shares to the investor and record the transition to
ACTIVE:src/routes.ts (continued)
5
Show investors their position
Read-only, no signer required — safe to run for any visitor:
src/components/ParcelPosition.tsx
Going further
- Off-ramp: let investors sell shares back to fiat with
ramp.initiateOffRamp()— see the Commodity Warehouse Financing tutorial for the off-ramp side of this same flow. - KYC gating: attach a
WhitelistVerifierso only verified investors can hold shares — see Mint Tokens: Transfer management. - Valuation updates: as the parcel is revalued, call
registry.updateValuation(newValuationUSD)— see AssetRegistry.
Next steps
TokenFactory
Full reference for
deployFarmland and every other deploy method.RampManager
Quotes, sessions, providers, and on-chain settlement in depth.
AssetRegistry
Reading and writing metadata on a deployed token.
React Hooks
useAsset, useTokenBalance, and useAnkaraChain in full.