Programmable MPC Wallets with Lit and Openfort
This is an example web app that shows how you can use Lit as a programmable MPC signer on an Openfort smart acoount, using social accounts, one-time passwords, and passkeys for authentication.
How to run locally
- Clone and configure the sample
git clone https://github.com/openfort-xyz/samples/
Copy the .env.local.example file into a file named .env.local in the folder of the server you want to use. For example:
cp .env.local.example .env.local
You will need an Openfort account in order to run the demo. Once you set up your account, go to the Openfort developer dashboard to find your API keys.
NEXT_PUBLIC_OPENFORT_PUBLIC_KEY="<replace with your publishable key>"
NEXTAUTH_OPENFORT_SECRET_KEY="<replace with your secret key>"
1.1. Add your social onboarding:
we're using Stytch project's
If you're not using Stytch, feel free to comment out the Stytch provider
StytchProvider and Stytch component
NEXT_PUBLIC_STYTCH_PROJECT_ID="<Your Stytch Project ID>"
NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN="<Your Stytch Public Token>"
- Create a Policy and Contract
You can create Policies and add Contracts in the Dashboard or with the API. This sample requires a Policy and a Contract to run. Once you've created them, head to the folder
pages and edit the contract and policy constants in
contract is the ID of a Contract for your contract. A contract has a chainId.
If you need a test contract address, use 0x38090d1636069c0ff1Af6bc1737Fb996B7f63AC0 (NFT contract deployed in 80001 Polygon Mumbai).
policy is the ID of a Policy for your contract. A policy has a contract and chainId. For this demo to work, the policy must have both the contract and the register sessions as rules.
- Start your development server:
npm run dev
Visit http://localhost:3000 to start playing with the app.
If you have questions, comments, or need help with code, contact the Openfort team via: