• Stars
    star
    951
  • Rank 48,061 (Top 1.0 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created about 2 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

End-to-End Example Soroban Dapp

Soroban Crowdfunding Dapp Example

Screenshot of the Example Dapp

This is a Next.js project, demoing how to build a dapp frontend backed by smart contracts on Stellar.

Getting Started

Install Dependencies

  1. rustc >= 1.71.0 with the wasm32-unknown-unknown target installed. See https://soroban.stellar.org/docs/getting-started/setup#install-rust . If you have already a lower version, the easiest way to upgrade is to uninstall (rustup self uninstall) and install it again.

  2. soroban-cli. See https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli, but instead of cargo install soroban-cli, run cargo install_soroban. This is an alias set up in .cargo/config.toml, which pins the local soroban-cli to a specific version. If you add ./target/bin/ to your PATH, then you'll automatically use this version of soroban-cli when you're in this directory.

  3. If you want to run everything locally: docker (you can run both Standalone and Futurenet backends with it)

  4. Node.js v18

  5. Freighter Wallet β‰₯v5.0.2. Or from the Firefox / Chrome extension store. Once installed, enable "Experimental Mode" in the settings (gear icon).

  6. If you want to skip step (1) and (2) and avoid installing specific rustc or soroban-cli versions, build the soroban-preview docker image:

    make build-docker
    
  7. NOTE - Follow the instructions below for Futurenet or Standalone 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.

Run Backend

Make sure to start from a clean setup:

npm run clean

You have three options: 1. Deploy on Futurenet using a remote RPC endpoint, 2. Run your own Futerenet RPC node with Docker and deploy to it, 3. run in localnet/standalone mode.

Option 1: Deploy on Futurenet

  1. Make sure you have soroban-cli installed, as explained above

  2. Deploy the contracts and initialize them

    npm run setup
    

    This runs ./initialize.sh futurenet behind the scenes, which will create a token-admin identity for you (soroban config identity create token-admin) and deploy a Fungible Token contract as well as the crowdfund contract, with this account as admin.

  3. Select the Futurenet network in your Freighter browser extension

Option 2: Run your own Futurenet node

  1. Run the backend docker container with ./quickstart.sh futurenet, and wait for it to start.

    Note: This can take up to 5 minutes to start syncing. You can tell it is working by visiting http://localhost:8000/, and look at the ingest_latest_ledger, field. If it is 0, the quickstart image is not ready yet. The quickstart container also prints console statements on start status, it will print soroban rpc: waiting for ready state... at first and then soroban rpc: up and ready when network sync has been reached.

  2. Load the contracts and initialize them

    Use your own local soroban-cli:

    ./initialize.sh futurenet http://localhost:8000
    

    Or run it inside the soroban-preview docker container:

    docker exec soroban-preview ./initialize.sh futurenet
    
  3. Add the Futurenet custom network in Freighter (Note, the out-of-the-box "Future Net" network in Freighter will not work with a local quickstart container, so we need to add our own):

    Name Futurenet Local RPC
    URL http://localhost:8000/soroban/rpc
    Passphrase Test SDF Future Network ; October 2022
    Allow HTTP connection Enabled
    Switch to this network Enabled
  4. Add some Futurenet network lumens to your Freighter wallet.

    Visit https://laboratory.stellar.org/#create-account, and follow the instructions to create your freighter account on Futurenet.

Option 3: Localnet/Standalone

  1. If you didn't yet, build the soroban-preview docker image, as described above:

    make build-docker
    
  2. In one terminal, run the backend docker containers and wait for them to start:

    ./quickstart.sh standalone
    

    You know that it fully started if it goes into a loop publishing & syncing checkpoints.

    You can stop this process with ctrlc

  3. Keep that running, then deploy the contracts and initialize them:

    You can use your own local soroban-cli:

    NETWORK=standalone npm run setup
    

    Or run it inside the soroban-preview docker container:

    docker exec soroban-preview ./initialize.sh standalone
    

    Note: this state will be lost if the quickstart docker container is removed, which will happen if you stop the quickstart.sh process. You will need to re-run ./initialize.sh every time you restart the container.

  4. Add the Standalone custom network in Freighter

    Name Standalone
    URL http://localhost:8000/soroban/rpc
    Passphrase Standalone Network ; February 2017
    Allow HTTP connection Enabled
    Switch to this network Enabled
  5. Add some Standalone network lumens to your Freighter wallet.

    1. Copy the address for your freighter wallet.
    2. Visit http://localhost:8000/friendbot?addr=<your address>

Frontend

Now that you're running the backend, you can run the development server:

npm run dev

Open http://localhost:3000 with your browser to see the result.

Note: Before you can "Back this project", you'll need to have some EXT (example token) in your freighter wallet. There is a "Mint 100 EXT" button, which will gift you 100 EXT tokens for that purpose.

User Workflows

The contract dev should be able to:

  • Clone the example repo (this one)
  • Choose their target amount and deadline
  • Deploy their contract to futurenet
  • Deploy a soroban rpc server somewhere (TBD)
  • Deploy the example web ui somewhere (e.g. netlify)

Then via the web UI, users should be able to:

  • Connect their wallet (freighter for now)
  • See their current balance(s)
  • See the current fundraising status (total amount & time remaining)
  • See allowed assets (xlm-only for now?)
  • Deposit an allowed asset
  • See their deposit(s) appear on the page as the transactions are confirmed.
  • "Live"-Update the page with the total amount with the new amount

More Repositories

1

stellar-core

Reference implementation for the peer-to-peer agent that manages the Stellar network.
C
3,098
star
2

go

Stellar's public monorepo of go code
Go
1,268
star
3

kelp

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Go
1,054
star
4

js-stellar-sdk

Main Stellar client library for the JavaScript language.
JavaScript
606
star
5

stellar-protocol

Developer discussion about possible changes to the protocol.
RPC
506
star
6

slingshot

A new blockchain architecture under active development, with a strong focus on scalability, privacy and safety
Rust
403
star
7

stellar-client

INACTIVE. Browser based client for stellard. This repository is inactive. It points to the stellard network, which is being replaced by stellar-core. Please refer to the replacement repository, interstellar-client, which points to the stellar-core network.
JavaScript
306
star
8

dashboard

JavaScript
215
star
9

quickstart

Home of the stellar/quickstart docker image for development and testing
Shell
183
star
10

java-stellar-sdk

Java
173
star
11

awesome-stellar

πŸ‘¨β€πŸš€ A curated list of Stellar applications, blog posts, educational resources, tools, and more.
159
star
12

js-stellar-base

The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr
JavaScript
103
star
13

stellar-wallet

Holds encrypted data. Used by stellar-client to store the user's key in a secure way.
JavaScript
103
star
14

django-polaris

An extendable Django app for building modular Stellar services
Python
95
star
15

rs-soroban-sdk

Rust SDK for Soroban contracts.
Rust
89
star
16

laboratory

JavaScript
77
star
17

freighter

Stellar chrome extension
TypeScript
72
star
18

new-docs

JavaScript
68
star
19

js-stellar-wallets

A library to make it easier to write wallets that interact with Stellar
TypeScript
62
star
20

rs-soroban-env

Rust environment for Soroban contracts.
Rust
57
star
21

stellar-demo-wallet

Provides a front-end interface to test SEP interoperability. Website at https://demo-wallet.stellar.org/
TypeScript
51
star
22

soroban-cli

CLI for Soroban contracts.
Rust
51
star
23

soroban-docs

Documentation for Soroban
MDX
50
star
24

soroban-examples

Example Soroban Contracts
Rust
47
star
25

packages

SDF - Packages
Shell
46
star
26

paper-wallet

HTML
43
star
27

os-projects

42
star
28

sorobanathon

Sorobanathon: First Light
42
star
29

starlight

Layer 2 payment channel protocol for the Stellar network.
Go
40
star
30

starbridge

Software that facilitates bridge builders who are connecting the Stellar network to other blockchains.
Go
39
star
31

account-viewer-v2

A simple tool to view an account on the Stellar network and make transactions from it.
TypeScript
37
star
32

stellar-docs

Documentation for Stellar
MDX
35
star
33

java-stellar-anchor-sdk

Java SDK for the Stellar network anchor development.
Kotlin
35
star
34

developers

Stellar developer portal site generator.
JavaScript
33
star
35

stellar-etl-airflow

Airflow DAGs for the Stellar ETL project
Python
31
star
36

stellar-disbursement-platform-backend

Stellar Disbursement Platform Backend
Go
28
star
37

stellar-etl

Stellar ETL will enable real-time analytics on the Stellar network
Go
28
star
38

js-xdr

Read/write XDR encoded data structures (RFC 4506)
JavaScript
24
star
39

js-soroban-client

Main Soroban client library for the Javascript language
TypeScript
23
star
40

xdrgen

A code generator for XDR
Rust
22
star
41

stellar-xdr

Staging area for future version of Stellar XDR.
RPC
18
star
42

rs-stellar-xdr

Rust lib for Stellar XDR.
Rust
18
star
43

docs-wallet

SCSS
17
star
44

stellar-disbursement-platform-frontend

Stellar Disbursement Platform Frontend
TypeScript
16
star
45

stellar-turrets

Reference implementation of the Stellar Turrets protocol
JavaScript
15
star
46

stellar-anchor-tests

A library and CLI tool for testing Stellar anchors.
TypeScript
13
star
47

typescript-wallet-sdk

Typescript Wallet SDK to build Stellar wallets
TypeScript
12
star
48

stories

JavaScript
12
star
49

hack-stellar

TypeScript
12
star
50

.github

11
star
51

moneygram-access-wallet-mvp

An MVP wallet integrated with MoneyGram Access
Python
11
star
52

stellar-tutorials

This repository holds tools and tutorials to help developers build on Stellar.
JavaScript
10
star
53

scaffold-soroban

Soroban example dapps
JavaScript
10
star
54

hackathon-get-started

πŸ’» All the resources you'll need to begin your Stellar project.
10
star
55

integration-tests

JavaScript
9
star
56

stellar-design-system

Components for Stellar’s design system
TypeScript
9
star
57

supercluster

Stellar-core integration test automation tool
F#
9
star
58

bower-js-stellar-sdk

JavaScript
9
star
59

soroban-rpc

RPC server for Soroban contracts.
Go
9
star
60

react-starter

Stellar's starter kit for React projects.
TypeScript
9
star
61

stellar-core-prometheus-exporter

Stellar Core Prometheus Exporter
Python
8
star
62

scp-proofs

SCP proofs and models
Python
8
star
63

product-conventions

A layout of all conventions to be used by all Stellar frontend products
JavaScript
8
star
64

soroban-react-payment

Soroban example dapps
TypeScript
7
star
65

django-polaris-circle

A reusable Django app for Circle USDC custody support in django-polaris deployments
Python
6
star
66

fca00c-asteroids

Learn Soroban and compete for a top spot on the leaderboard in Fast, Cheap & Out of Control
Rust
6
star
67

sorobounty-spectacular

Sorobounty Spectacular
5
star
68

sep24-reference-ui

TypeScript
5
star
69

regulated-assets-poc

JavaScript
5
star
70

core-node-admin-panel

TypeScript
5
star
71

recoverysigner-firebase-auth

A simple demo frontend web app for performing Firebase phone auth for use with recoverysigner.
TypeScript
5
star
72

soroflare

The Soroban environment and vm running on a Cloudflare Worker. (a simplified version of the backend running fca00c.com)
Rust
5
star
73

kotlin-wallet-sdk

Kotlin Wallet SDK to build Stellar wallets
Kotlin
5
star
74

sorobounties

The Soroban content bounty program
5
star
75

stellar-community-fund-contracts

Rust
4
star
76

stellar-turrets-docs

Docs repo for the Stellar Turrets protocol
4
star
77

anchor-transfer-utils

Utilities for anchors and wallets implementing SEP6 transfer protocol
TypeScript
4
star
78

stellar-upgrade-web

JavaScript
4
star
79

stellar-upgrade

Go
4
star
80

convert-stellar-address

JavaScript
4
star
81

soroban-name-service

Soroban name service
Rust
4
star
82

soroban-react-atomic-swap

A react demo dapp for making an atomic swap on Soroban
TypeScript
4
star
83

recoverysigner-demo-client

A limited feature demo client for a SEP-30 Recoverysigner server.
JavaScript
4
star
84

soroban-quest

Soroban Quest is a gamified educational course where you’ll learn Soroban and earn rewards!
Rust
4
star
85

solar-stellarorg

Stellar.org's Solar CSS framework theme
CSS
4
star
86

js-stellar-elements

Styled basic components for Stellar projects
JavaScript
3
star
87

solar-stellarorg-pages

CSS
3
star
88

golistcmp

A tool for comparing the output of 'go list -m -json all' executions.
Go
3
star
89

basic-payment-app

An example payments application demonstrating integrations of various features and SEPs in a user-facing product.
Svelte
3
star
90

soroban-dapps-challenge

Dapps for the Soroban Dapps Challenge
3
star
91

stellar-dbt-public

Public DBT instance to aid in data transformation for analytics purposes
Shell
3
star
92

bower-js-stellar-base

JavaScript
3
star
93

amm-reference-ui

A reference codebase to serve as a proof of concept for an AMM UI
TypeScript
3
star
94

helm-charts

Helm charts for deploying SDF maintained software
Smarty
3
star
95

stellar-account-prometheus-exporter

Stellar Account Prometheus Exporter - Monitor Stellar Network Accounts
Python
3
star
96

dts-xdr

A library for generating TypeScript declarations (.d.ts) for js-xdr auto-generated files.
JavaScript
3
star
97

crate-git-revision

Embed git revision into crates built and published.
Rust
2
star
98

actions

GitHub Actions for Stellar repositories.
TypeScript
2
star
99

project-viewer

Navigating projects on Stellar
Go
2
star
100

soroban-react-mint-token

An example dapp for minting tokens on Soroban
TypeScript
2
star