This project aims to generate an NFT for each new unique and eligible segment a Strava user runs through.
The corresponding web application is in a dedicated repository.
- Go to the
blockchain
folder and runnpm install
- Start Ganache
- Deploy the contract with
truffle migrate --reset
(--reset
to force re-deployment everytime) - Generate the TypeScript interfaces for the contract with
npm run types
First, you need to copy the server/.env
file to a server/.env.local
file. Do not push this file (it's ignored) and
add your own values, at least for:
PRIVATE_KEY
= The wallet which mints the NFT - This is a PoC, do not do anything stupid with your private keys, please...RECIPIENT
= The public address that will receive the NFT minted - This is temporary of course, pending the MetaMask integration
- Go to the
server
folder and runnpm install
- Launch the server with
npm run start
(npm run start:dev
for the watch mode) - The server runs on http://localhost:3001/
It's here!
- Go to the
blockchain
folder and runnpm install
- Start Ganache
- Test the contract with
truffle test
- Go to the
server
folder and runnpm install
- Unit test the server with
npm run test
(npm run test:watch
for the watch mode andnpm run test:coverage
to generate the coverage data) - E2E test the server with
npm run test:e2e
(npm run test:watch
for the watch mode andnpm run e2e:coverage
to generate the coverage data)
- Framework: NestJS
- Database: MongoDB accessed via Mongoose
- Wrap Strava's API: strava-v3
- Decode Strava's segment encoded polyline: polyline-encoded
- Generate an image: canvas library, following Sean Davis' blog post
- Draw polyline on a canvas: StackOverflow
- ✔️ Create a database of eligible segments
- ✔️ CRUD for these eligible segments
- ✔️ Get a Strava activity via its ID
- ✔️ Extract new segments IDs from this activity
- ✔️ For matching segments, generate a PNG image
- ✔️ This image should display the segment's name, distance and GPS path
- ✔️ Strava connect from the webapp
- ✔️ Upload image to IPFS
- ✔️ Make an NFT from this image
- ✔️ Frontend connection with MetaMask
- ❌ Frontend connection with Wallet Connect
- ❌ Mint NFTs from the frontend with MetaMask
- ❌ Create sets of segments, to make a complete collection of NFTs
- ❌ When a collection is completed, generate a "GOLD" NFT
- Remove backend NFT minting (to be done by the end-user)
- Stop using end-user's Strava token in backend, get everything needed in frontend and send it to the backend
- WebApp: use axios to manage API calls?
- WebApp: get contract address from the endpoint