DEV Community

Cover image for I Built TalknDo over the Weekend
Bello Bambo
Bello Bambo

Posted on

I Built TalknDo over the Weekend

DEV Weekend Challenge: Passion Edition Submission

This is a submission for Weekend Challenge: Passion Edition

What I Built

I built TalknDo, a Solana-based accountability platform for people who have important goals but struggle to take action because nothing is at stake. TalknDo gives them a financial reason to follow through by allowing them to stake SOL on personal challenges. Users create a challenge with a title, detailed description or supporting file, stake amount, and deadline, then sign a Solana transaction to activate it. After completing the challenge, they upload proof, review their submission, reclaim their staked SOL, and receive a non-transferable NFT completion badge minted with Metaplex Core. If they miss the deadline, the challenge expires and the staked funds are transferred to a charity escrow account. Only authorized treasury accounts can withdraw these funds for charitable causes.

Live Project: https://talkndo-fe.vercel.app

Demo

Video Demo For TalknDo

Code

Smart Contract Function to create a Challenge/Goal:

Smart Contract Function to complete a challenge:

Function to Expire an ended/uncompleted challenge:

Function to Withdraw Charity Funds:

Function to Give User Charity Funds Withdrawal Access:

Function to Remove a User From Charity Funds Withdrawal Access:

Frontend Required Imports to sign transactions on-chain:

IDL JSON file:

Deployed Program ID(Devnet):

Github (Smart Contract): https://github.com/bellobambo/talk-do
Github (Frontend): https://github.com/bellobambo/talkndo-fe

How I Built It

  1. I built the TalknDo smart contract on Solana using Rust and the Anchor framework. The program is deployed with the Program ID (Solana Devnet): 9CLYHqqCBfDsuDrwooBbzV8FuvVzsZwadUCZ2NLWSURE, which identifies the contract on the Solana network.

  2. I used Program Derived Addresses (PDAs) to create secure and deterministic accounts for challenges, program configuration, treasury members, and charity funds. Each challenge PDA is derived from the challenge seed, the creator’s wallet address, and a unique challenge ID.

  3. I built the frontend with Next.js, React, TypeScript, Tailwind CSS, and Ant Design. Solana Wallet Adapter connects the user’s wallet, while Web3.js and the Anchor TypeScript client handle account addresses, transaction construction, signing, and submission.

  4. The frontend imports the generated Anchor IDL, which describes the program’s instructions, accounts, arguments, and data structures. It uses the IDL, connected wallet, RPC connection, and Program ID to create an Anchor Program instance. This allows the frontend to call the Rust smart contract through methods such as initializeChallenge(), completeChallenge(), and expireChallenge().

  5. When a user creates a challenge, the frontend uploads any supporting file to IPFS through Pinata and receives a metadata URI. It then converts the stake from SOL to lamports, converts the deadline to a Unix timestamp, derives the challenge PDA, and calls initializeChallenge(). The smart contract validates the title, deadline, metadata URI, and stake before transferring the SOL into the challenge PDA, which acts as an on-chain escrow account.

  6. The frontend reads challenge accounts from the program and uses their on-chain status and deadlines to organize them into active, completed, and expired challenges.

  7. To complete a challenge, the user uploads a PDF or image as proof. The frontend stores the file on IPFS, generates and uploads the NFT badge metadata, creates a new badge asset keypair, and calls completeChallenge(). The wallet signs the transaction before it is submitted to the Solana network.

  8. The completeChallenge() instruction verifies that the challenge is active, the deadline has not passed, and the proof and badge URIs are valid. It then records the proof URI, returns the staked SOL to the creator, and updates the challenge status to completed.

  9. After successful completion, the smart contract uses a Cross-Program Invocation to Metaplex Core to mint an NFT achievement badge. A permanent freeze delegate makes the badge non-transferable, allowing it to serve as permanent proof that the user completed the challenge.

  10. If a user misses the deadline, the frontend can call expireChallenge(). The smart contract confirms that the challenge is overdue, changes its status to failed, and transfers the staked SOL from the challenge escrow to the charity escrow. Authorized treasury members can call
    withdrawCharityFunds() to send funds from the charity account to a selected recipient. The contract validates their treasury membership, checks the available balance, and preserves the account’s minimum rent reserve.

  11. I included account constraints, signer checks, deadline and status validation, checked arithmetic, custom errors, and PDA verification to improve the security and reliability of the program.

  12. The smart contract emits events for challenge creation, proof submission, NFT badge issuance, challenge expiration, treasury membership changes, and charity withdrawals, helping the frontend track and display on-chain activity.

Prize Categories

Best Use of Solana: TalknDo uses Solana for on-chain goal setting, SOL staking through PDA-based escrow accounts, proof-of-completion records, and charity fund management. Successful users also receive non-transferable NFT badges minted with Metaplex Core.

Top comments (0)