Mint and collection web3 media with just an email address
- yarn
- Node version manager (NVM) or node version 16.x
- Redis client
First, run the development server:
git clone git@github.com:Castle-Link/memento-hack.git
cd memento-hack
nvm install # if using NVM
yarn
Create an env file at in the root directory called: .env.local (for local) .env.prod (for prod)
Use .env.example as a reference for required env vars
MongoDB is used for keeping record of users, mementos, claims, and transactions
Install mongo db locally
brew install mongodb-community
brew services start mongodb-community
The following providers are support for user authentication. By default Web3auth with @safe-global/authKit is used. This can be changed by changing the providerApplication
and providerMethod
parameters provided in the connectUser
function
- Create a web3auth account with web3auth.
- Set env vars
NEXT_PUBLIC_WEB3_AUTH_CLIENT_ID
andNEXT_PUBLIC_WEB3_AUTH_NETWORK
- Create a web3auth account with web3auth.
- Setup a custom JWT verifier (https://web3auth.io/docs/auth-provider-setup/byo-jwt-providers)
- set
kid
toWEB3_AUTH_VERIFIER_KEY_ID
when prompted
- set
- Create an private key with and encrypt it with
WEB3_AUTH_VERIFIER_ENCRYPTION_PASSPHRASE
- Export the encrypted private key to a pem file at
src/lib/web3auth/privateKey.pem
- Set
NEXT_PUBLIC_WEB3_AUTH_NETWORK
,NEXT_PUBLIC_WEB3_AUTH_CLIENT_ID
,WEB3_AUTH_VERIFIER_KEY_ID
, andWEB3_AUTH_VERIFIER_ENCRYPTION_PASSPHRASE
- Create magic link account at magic.link
- Set env vars
NEXT_PUBLIC_MAGIC_API_KEY
andMAGIC_API_SECRET
- Create a stripe account
- Add your API keys
- Create a webhook that points to [domain]/api/webhooks/stripe that subscribes to the following events:
- checkout.session.async_payment_failed
- checkout.session.completed
- checkout.session.async_payment_succeeded
- checkout.session.expired
yarn dev
The app will run at http://localhost:3000
Jobs are run in the background to update the db with transaction hashes once Gelato has processed a transaction. Backround tasks are handled with Bull and ioredis
For local development, you'll need to install redis
brew install redis
brew services start redis
With redis installed, you can run the background jobs with:
yarn build:workers
yarn run:workers
Each time a worker is updated, you will need to run yarn build:workers
again
Custom smart contracts were developed for this hack. You can find them in the contracts
folder in the root directory. The contracts were developed with Foundry.