Skip to content
Peter Maksymowsky edited this page Mar 23, 2022 · 6 revisions

Bringing up the project

For development, there are 4 things you should be bringing up

  1. Shuffle node
  2. Flask API
  3. NextJS APP
  4. Diem Testnet Faucet

Shuffle Node

Install shuffle:

Install brew: https://brew.sh/
Install deno: https://deno.land/#installation

From diem directory:

  • Install Diem dependencies including Rust, Clang, Deno, etc, by running the following script in diem root directory:
./scripts/dev_setup.sh
  • Install shuffle binary
cargo install --path shuffle/cli

Running Shuffle:

  1. Run shuffle node to bring up a local testnet
  2. cd into the shuffle_dex_modules directory
  3. Run shuffle account which generates 2 accounts, our Parent VASP account for modules and a second for testing P2P transactions
  4. Run shuffle build to do a test build and see if everything works as intended
  5. Run shuffle deploy to deploy the modules once you are happy. You should see them be deployed in the output.
  6. Run shuffle console to run an interactive repl console where you can run functions from the .ts files.

Resetting Shuffle

With shuffle not running: rm -rf ~/.shuffle then, refer to running shuffle above

Flask API

Installation

  1. Install Python (prefer 3.9.10)
  2. Install pip
  3. cd into the api directory and run pip install -r requirements.txt

Running the API

PYTHONUNBUFFERED=1 ENVIRONMENT=development FLASK_DEBUG=True FLASK_ENV=development flask run --host 0.0.0.0

Initializing db Info/Exchanges

You can do this in the browser or in something like postman, navigate to the following urls:

  1. http://localhost:5000/db_reset
  2. http://localhost:5000/initialize

For now, you can use admin as a credential to see the exchange account. NOTE: Make sure you overwrite the addresses in diem_blockchain.py:

  1. MODULE_ADDRESS = <address in shuffle that the modules are published under>
  2. EXCHANGE_ADDRESS = <address of the "admin" account from initialize>

NextJS APP

Installation

  1. Install NodeJS (prefer v16.6.1)
  2. Install yarn (prefer 1.22.17)
  3. cd into the app directory and run yarn install

Running the APP

  1. From the app directory, run yarn run dev

Diem Testnet Faucet

Installation

  1. In your diem directory, build the faucet: cargo build --release -p diem-faucet

Running the Faucet

  1. cd target/release in the diem directory
  2. Make sure that shuffle is set up at the very least, then: ./diem-faucet -c 4 -m ~/.shuffle/nodeconfig/mint.key -p 8000 -s http://0.0.0:8080