This challenge will guide you through the process of building and shipping a crowdfunding dapp on Stellar using Soroban. You will learn how to deploy smart contracts to Futurenet, and how to interact with them through a web frontend. In this context, the term "ship" refers to finalizing the development process of your dapp, ensuring that it functions as expected, and is accessible for user interaction and testing through a hosted frontend. However, it's crucial to clarify that despite its functionality, the dapp is not promoted nor intended for deployment in a production-level setting on Futurenet. The challenge is designed for educational purposes, helping you understand how a dapp can be built and interacted with, with further customization and development, it has the potential to evolve into a full-fledged, ready-to-use crowdfunding solution.
Checkpoint 0: 📦 Install 📚
Start by installing the required dependencies.
soroban-cli alias: Download Soroban Alias
docker(Standalone backend requires it): Download Docker
Nodev18: Download Node
Freighter Wallet: Freighter Wallet
First, clone the Soroban example dapp repo and check out the
git clone https://github.com/stellar/soroban-example-dapp
git checkout challenge
Then, install soroban-cli alias by running the following command:
Then, and build the soroban-preview docker image:
Building the docker image lets you avoid installing the specific version of soroban-cli if desired.
Checkpoint 1: 🚀 Launch Backend 🌐
Open your Docker Desktop app and make sure it is running. Then run the following command to start the backend:
and wait for it to start.
Checkpoint 2: 🎬 Deploy Smart Contracts
Now that the backend environment is set up, we need to deploy our smart contracts to in a sandbox environment.
In another terminal, load the contracts and initialize them on the Standalone network by running the following commands:
npm run clean
NETWORK=standalone npm run setup
If the command runs successfully, your terminal will return a series of messages notifying you about the successful initialization of the contracts and the post-installation sequence.
Contract deployed successfully with ID: CBXHU5BWWTOCZRYX3DMSSKCFG7B3K2YG2I5F75ALPQ6GCY6ZES2XKLTI
Deploy the crowdfund contract
Contract deployed successfully with ID: CBKY7UN5VGD4LIQFOBOTSUSQWK67BZZTA23NIEVWSWRR5SAT26JQN2BN
Initialize the abundance token contract
Initialize the crowdfund contract
> [email protected] build-contracts
Please, save your deployed contract ID, you will need it to complete the challenge.
Checkpoint 3: 🤝 Connect the Frontend to the Backend
First, start the development server:
npm run dev
Now open your browser and visit http://localhost:3000. You should be able to see the frontend of your dapp.
Note: Follow the instructions below and ensure that you have funded your wallet address that you intend to use from browser, otherwise the dapp display will be blank and a 'Account not found' will be printed on browser's console only.
Now that we have the frontend running, it's time to connect it with our smart contracts.
First, be sure that you have properly configured the Freighter Wallet by following the instructions here.
Then, add the Standalone network in Freighter:
Standalone Network ; February 2017
- Allow HTTP connection:
- Switch to this network:
Next, add some Standalone network lumens to your Freighter wallet by doing the following:
- Copy the address for your freighter wallet.
Note: These are test lumens for use with your local network and cannot be used on Futurenet or Mainnet
Checkpoint 4: 🏦 Mint Tokens for the Crowdfunding Campaign
Open the dapp frontend and click on the "Mint 100 ABND" button.
You should see a popup from Freighter asking you to sign the transaction. Click on "Approve" and wait for the transaction to be confirmed.
You should see an updated balance in the pledge component.
Note: These are test tokens for use with your local network and cannot be used on Futurenet or Mainnet
Checkpoint 5: 💰 Fund the Crowdfunding Campaign
Now that you have your wallet set up, let's fund the crowdfunding campaign.
Open the frontend and click on the "Back this project" button. You should see a popup from Freighter asking you to sign the transaction.
Click on "Approve" and wait for the transaction to be confirmed.
Once the transaction is confirmed, you should see a success message.
You should see an updated balance in the amount you have pledged in the pledge component.
Checkpoint 6: 🚢 Ship it! 🚁
Now that your dapp is fully functional locally, next prepare it for deployment on Futurenet.
Stop the development server by pressing
ctrl+c in the terminal where it is running.
If you are running docker, now is a good time to stop the Stellar and Soroban preview containers.
docker stop stellar soroban-preview
Then, run the following commands to initialize the contracts on Futurenet:
npm run clean
npm run setup
Then run the dev server again:
npm run dev
Now, open your browser and visit http://localhost:3000.
Ensure that you are connected to Futurenet and you should be able to see the frontend of your dapp!
Next, you will use the Vercel cli to complete our deployment.
Note: If you don’t already have a Vercel account, you will need to create one and link it to your GitHub account.
First install the Vercel cli:
npm i global vercel
Then, run the following command to deploy your dapp:
Then, continue through the prompts (you will not need to modify any settings) until you reach the completion prompt similar to the following:
Vercel CLI 30.1.1
🔗 Linked to julian-dev28/soroban-example-dapp (created .vercel)
🔍 Inspect: https://vercel.com/julian-dev28/soroban-example-dapp/C1YZVQSqh6WcyR1uvxz8q2tW1tjD [2s]
✅ Production: https://soroban-example-dapp-rho.vercel.app [42s]
Please, save your production url, you will need it to complete the challenge.
You can now visit the preview link to see your deployed dapp! 🎉
You will need to add some Futurenet network lumens to your Freighter wallet to interact with the deployed dapp. Visit https://laboratory.stellar.org/#account-creator?network=futurenet, and follow the instructions to create your Freighter account on Futurenet.
Checkpoint 7: 💪 Pass the Challenge!
Submit your public url to the challenge form and proceed to the next step to check your work.
Join our Community in Discord in case you have any issues or questions.
Checkpoint 8: ✅ Check your work!
In order to successfully complete this challenge, your work needs to be checked. Please, follow this steps:
- Fork the challenge repository.
crowdfund/challenge/output.txtfile with your wallet address, contract ID and production url. Filled file should look like:
public key: GBSXUXZSA2VEXN5VGOWE5ODAJLC575JCMWRJ4FFRDWSTRCJ123456789
contract Id: CBKY7UN5VGD4LIQFOBOTSUSQWK67BZZTA23NIEVWSWRR5SAT26JQN2BN
- Create a Pull Request to the
stellar/soroban-dapps-challenge/mainbranch. When the PR will be created, CI actions will check the
crowdfund/challenge/output.txtfile data and update your progress.
- Wait for the CI/CD pipeline results.
- Fix errors if present:
- find the error reason in the Crowdfund challenge CI results (you can find a link right in the pull request);
- return to your forked repository;
- fix errors and commit changes. The existing PR will be checked again.
- If the pipeline was successful, then congratulations! You completed the challenge!👏
Invite a friend to try out your dapp and ask them to provide feedback!
⚔️ Side Quests
🌐 Explore Stellar Laboratory to inspect your account assets on Futurenet.
You should see something like this:
📚 User Workflows Checklist
During this exercise you should be able to:
- Clone the example repo (Crowdfund Dapp)
- Choose your target amount and deadline
- Deploy your contract to Futurenet
- Deploy the example web ui somewhere (e.g. netlify, vercel, surge, etc.)
Then via the web UI, you should be able to:
- Connect your wallet
- See your current balance(s)
- See the current fundraising status (total amount & time remaining)
- See allowed assets
- Deposit an allowed asset
- See your deposit(s) appear on the page as the transactions are confirmed.
- "Live"-Update the page with the total amount with the new amount