Skip to content

Commit

Permalink
Enable futurenet (#37)
Browse files Browse the repository at this point in the history
* use a randomly generated token admin account instead of the standalone root one

* fix friendbot url for futurenet

* enable futurenet chain
  • Loading branch information
paulbellamy authored Oct 10, 2022
1 parent 966676c commit 1d5ae48
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 21 deletions.
53 changes: 44 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,23 @@ backed by smart contracts on Stellar.

## Getting Started

### Backend (Local Sandbox)
### Dependencies

1. Install the soroban-cli from https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli
2. Run the backend with `soroban-cli serve`
3. Run `./initialize.sh sandbox` to load the contracts and initialize it.
2. Install Docker for Standalone and Futurenet backends.

### Backend (Local Sandbox)

1. Run the backend with `soroban-cli serve`
2. Run `./initialize.sh sandbox` to load the contracts and initialize it.
- Note: this will create a `.soroban` sub-directory, to contain the sandbox
network data.
4. Configure Freighter
3. Configure Freighter
a. Install the custom Freighter Soroban release from https://github.com/stellar/freighter/releases/tag/v2.6.0-beta.2
b. Enable "Experimental Mode" in the settings (gear icon).
c. Add a custom network:
| | |
|---|---|
| Name | Sandbox |
| URL | http://localhost:8000/soroban/rpc |
| Passphrase | Local Sandbox Stellar Network ; September 2022 |
Expand All @@ -26,23 +32,48 @@ backed by smart contracts on Stellar.

### Backend (Local Standalone Network)

1. Install the soroban-cli from https://soroban.stellar.org/docs/getting-started/setup#install-the-soroban-cli
2. Run the backend docker container with `./quickstart.sh standalone`, and wait for it to start.
3. Run `./initialize.sh standalone` to load the contracts and initialize it.
1. Run the backend docker container with `./quickstart.sh standalone`, and wait for it to start.
2. Run `./initialize.sh standalone` to load the contracts and initialize it.
- Note: this state will be lost if the quickstart docker container is removed.
4. Configure Freighter
3. Configure Freighter
a. Install the custom Freighter Soroban release from https://github.com/stellar/freighter/releases/tag/v2.6.0-beta.2
b. Enable "Experimental Mode" in the settings (gear icon).
c. Add a custom network:
| | |
|---|---|
| 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.
4. Add some Standalone network lumens to your Freighter wallet.
a. Copy the address for your freighter wallet.
b. Visit `http://localhost:8000/friendbot?addr=<your address>`

### Backend (Futurenet)

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.
2. Run `./initialize.sh futurenet` to load the contracts and initialize it.
3. Configure Freighter
a. Install the custom Freighter Soroban release from https://github.com/stellar/freighter/releases/tag/v2.6.0-beta.2
b. Enable "Experimental Mode" in the settings (gear icon).
c. Add a custom network (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 |
| 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-futurenet.stellar.org/#create-account, and follow
the instructions to create your freighter account.

### Frontend

Expand All @@ -54,6 +85,10 @@ npm run dev

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

Note: Before you can "Approve transfer & 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:
Expand Down
18 changes: 10 additions & 8 deletions initialize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,28 @@ set -e
# TODO: Set the recipient to something reasonable here. Probably whatever account
# soroban is running stuff as?
# TODO: Have a nicer way to build Identifiers on the CLI
TOKEN_ADMIN=GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI
TOKEN_ADMIN_IDENTIFIER="AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAcAAAAAc3b96I5M1hzA+ylKF4az8dBh9fLxyldGX6qTIhG5RtY="
TOKEN_ADMIN="GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U"
TOKEN_ADMIN_IDENTIFIER="AAAABAAAAAEAAAAAAAAAAgAAAAUAAAAHQWNjb3VudAAAAAAEAAAAAQAAAAcAAAAA56a6LMl9LU+PnxwUp5tzx7M+LZpNu1alDvvp0PbMGU8="

case "$1" in
standalone)
echo "Using standalone network"
export SOROBAN_RPC_URL=http://localhost:8000/soroban/rpc
export SOROBAN_RPC_HOST="http://localhost:8000"
export SOROBAN_RPC_URL="$SOROBAN_RPC_HOST/soroban/rpc"
export SOROBAN_NETWORK_PASSPHRASE="Standalone Network ; February 2017"
export SOROBAN_SECRET_KEY="SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L"
export SOROBAN_SECRET_KEY="SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT"

echo Fund token admin account from friendbot
curl "$SOROBAN_RPC_URL/friendbot?addr=$TOKEN_ADMIN"
curl "$SOROBAN_RPC_HOST/friendbot?addr=$TOKEN_ADMIN"
;;
futurenet)
echo "Using Futurenet network"
export SOROBAN_RPC_URL=http://localhost:8000/soroban/rpc
export SOROBAN_RPC_HOST="http://localhost:8000"
export SOROBAN_RPC_URL="$SOROBAN_RPC_HOST/soroban/rpc"
export SOROBAN_NETWORK_PASSPHRASE="Test SDF Future Network ; October 2022"
export SOROBAN_SECRET_KEY="SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L"
export SOROBAN_SECRET_KEY="SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT"
# TODO: Use friendbot to fund the token admin, or figure our token admin here...
# curl "$SOROBAN_RPC_URL/friendbot?addr=$TOKEN_ADMIN"
curl "https://friendbot-futurenet.stellar.org/?addr=$TOKEN_ADMIN"
;;
""|sandbox)
# no-op
Expand Down
2 changes: 1 addition & 1 deletion pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
getDefaultWallets,
} from "../wallet";

const chains: ChainMetadata[] = [chain.sandbox, chain.standalone];
const chains: ChainMetadata[] = [chain.sandbox, chain.standalone, chain.futurenet];

const { wallets } = getDefaultWallets({
appName: "Example Stellar App",
Expand Down
2 changes: 1 addition & 1 deletion quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

REVISION=42641a3dbc46565584e424697f042aec7d5063681cc22a0f490f78fa1f1e1de0
REVISION=089d356c55f7e5da92d5440d29a1772c701422e6db8ac0400ef8e85518d2df9f

case "$1" in
standalone)
Expand Down
7 changes: 5 additions & 2 deletions shared/constants.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// These were randomly generated from https://laboratory.stellar.org/#account-creator
const TokenAdmin = 'GDT2NORMZF6S2T4PT4OBJJ43OPD3GPRNTJG3WVVFB356TUHWZQMU6C3U'
const TokenAdminSecretKey = 'SAKCFFFNCE7XAWYMYVRZQYKUK6KMUCDIINLWISJYTMYJLNR2QLCDLFVT'

// Contract IDs, set up by ./initialize.sh
const CrowdfundId = process.env.CROWDFUND_ID ?? ''
const TokenAdmin = 'GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI'
const TokenAdminSecretKey = 'SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L'
const TokenId = process.env.TOKEN_ID ?? ''

const Constants = {
Expand Down

0 comments on commit 1d5ae48

Please sign in to comment.