Add ecash and Lightning to the app you already have
Join a federation, hold ecash, send and receive it, and restore from seed words, with one typed SDK.
npm install --save-exact @fedimint/react-native@0.1.0 @fedimint/react-native-bindings@0.1.0
cd ios && pod installconst session = await openSdk({ dataDir })
const fed = await session.sdk.join(InviteCode.parse(code))
const msat = useBalance(fed)
return <Text>{`${msat / 1000n} sats`}</Text>What is Fedimint
Fedimint is an open source protocol that lets a group of guardians, a federation, hold bitcoin together for a community. The federation issues ecash: digital notes, backed by that bitcoin, that your wallet keeps on the device. Ecash payments are fast, cheap and private, and a Lightning gateway connects them to the Lightning Network.
In short: your app holds ecash and talks to one federation. The federation reaches Lightning through a gateway. Your app can also give notes straight to another wallet.
What this SDK does
This guide follows one path, from an empty project to a wallet that joins a federation, holds ecash, moves it two ways, lists its history and restores itself from seed words. It uses two npm packages. You import everything from @fedimint/react-native. It adds openSdk and two React hooks, useBalance and useOperation. @fedimint/react-native-bindings holds the native part, generated from the Rust crate rust/fedimint-sdk. Your app lists both.
The packages ship prebuilt native libraries for iOS 15.0 or newer and Android API 24 or newer. Nothing compiles when you install them. They need the New Architecture, and they do not run in Expo Go. Expo apps use a config plugin and a development build.
Amounts are millisatoshis (msat), as a bigint. A failed payment is a state that you observe, not an error that is thrown. Every code block in this guide is compiled against the packages before it is published here.
This guide does not cover on chain send and receive. A federation that supports them gives you fed.onchain().
Where to start
- Quickstart: From an empty app to a balance on screen in one page.
- Guides: One task each: join, balance, receive, send, history, share the session, restore.
- Reference: Errors, amounts, and seed words.
For AI agents
An agent can follow this guide from start to end. Every page is also plain Markdown. Give the agent one of these files:
- llms-full.txt: Every page in one file. Use this one first.
- llms.txt: The list of pages, with a link to each page as Markdown.
- md/quickstart.md: One page as plain Markdown. Every page has one, at
md/<page>.md. - SKILL.md: An agent skill for a first install in an existing app: checks, safety rules, failures and a definition of done.
Then give the agent this prompt:
Read llms-full.txt from the Fedimint SDK for React Native guide.
Add the SDK to this React Native app. Follow the pages in order,
from Installation to Restore from seed words. Install the exact
package versions that the guide gives. Make sure that each step
works before you start the next one.