Skip to content

Commit

Permalink
add explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
containerman17 committed Sep 20, 2024
1 parent 2d3a02d commit b7a4ed1
Show file tree
Hide file tree
Showing 6 changed files with 383 additions and 106 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@

## 1. Start the Whole Stack

Run: `docker compose up -d --build devnet faucet frontend`. Might take 5 minutes to download dependencies.
Run: `docker compose pull && docker compose up -d --build devnet faucet frontend explorer`. Might take 5 minutes to download dependencies.

For devcontainers or codespaces, forward ports 8765 for faucet, 9650 for the chain, and 5173 for the frontend.
For devcontainers or codespaces, forward ports 8765 for faucet, 9650 for the chain, 5173 for the frontend, and 3000 for the explorer.

Open [http://localhost:5173](http://localhost:5173) to see the frontend. Play around with it. Try both the Temporary key and Metamask snap (from npm, not local).

That's how it should look with Metamask Snap signing:

![Screenshot](assets/screenshot.png)

You can access the explorer at [http://localhost:3000](http://localhost:3000).

BTW a relatively fresh version should be deployed at [https://ec2-18-224-139-0.us-east-2.compute.amazonaws.com/](https://ec2-18-224-139-0.us-east-2.compute.amazonaws.com/)


When finished, shut everything down with: `docker compose down`

## 2. Develop a VM

To develop or port new actions:
1. Add them in the `actions/` folder.
2. Register them in `vm/vm.go`.
3. Rebuild the stack with: `docker compose up -d --build devnet faucet frontend`
3. Rebuild the stack with: `docker compose up -d --build devnet faucet frontend explorer`

There are read-only and read-write actions. Ensure actions have `***Result` types defined in `vm/vm.go`. Use read-only actions instead of RPC API.

By the way, the Go code depends on the [`read-only-actions` branch](https://github.com/ava-labs/hypersdk/tree/read-only-actions) of HyperSDK. So copy-pasting actions would not work; you'll need to define the return types.

## 3. Develop a Frontend
1. Bring down the frontend container: `docker compose down`
2. Start only the devnet and faucet: `docker compose up -d --build devnet faucet`
2. Start only the devnet, faucet, and explorer: `docker compose up -d --build devnet faucet explorer`
3. Navigate to the web wallet: `cd web_wallet`
4. Install dependencies and start the dev server: `npm i && npm run dev`

Ensure ports `8765` (faucet), `9650` (chain), and `5173` (frontend) are forwarded.
Ensure ports `8765` (faucet), `9650` (chain), `5173` (frontend), and `3000` (explorer) are forwarded.

Note that most functionality depends on the `hypersdk-client` npm package.

Expand All @@ -55,6 +55,6 @@ Note that most functionality depends on the `hypersdk-client` npm package.
- Faucet: `go run ./cmd/faucet/`
- Chain: `./scripts/run.sh`
- Frontend: `npm run dev` in `web_wallet`
- Instead of `docker compose up -d --build devnet faucet frontend`, you can use `docker compose up -d --build frontend`. The `frontend` service will automatically start `faucet` and `devnet` as dependencies.
- Explorer: Use the provided Docker image or set up your own instance
- Be aware of potential port conflicts if issues arise. `docker rm -f $(docker ps -a -q)` is your friend.
-
- To update the explorer image, run `docker compose pull explorer` before starting the stack.
10 changes: 10 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ services:
retries: 5
start_period: 300s

explorer:
container_name: explorer
restart: always
ports:
- "127.0.0.1:3000:3000"
image: containerman17/hypersdk-explorer:latest
environment:
INDEXER_API_URL: http://devnet:9650/ext/bc/morpheusvm/indexer
depends_on:
- devnet

faucet:
container_name: faucet
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.22.5

require (
github.com/ava-labs/avalanchego v1.11.11-0.20240827034238-fc892827880a
github.com/ava-labs/hypersdk v0.0.17
github.com/ava-labs/hypersdk v0.0.18-0.20240920115159-c34272093511
github.com/fatih/color v1.13.0
github.com/gorilla/mux v1.8.0
github.com/joho/godotenv v1.5.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ github.com/ava-labs/hypersdk v0.0.17-0.20240919113201-7a8bb2de0f67 h1:0T+S8bK4hX
github.com/ava-labs/hypersdk v0.0.17-0.20240919113201-7a8bb2de0f67/go.mod h1:IH+fJyFJWfrwRR4YHwKVpdPIJUqO9n3URH2odigGfDE=
github.com/ava-labs/hypersdk v0.0.17 h1:a3h4Hm2TNA3ekZbhDjmMOwNUnxVZ5bvGZ5riME9KQ5k=
github.com/ava-labs/hypersdk v0.0.17/go.mod h1:IH+fJyFJWfrwRR4YHwKVpdPIJUqO9n3URH2odigGfDE=
github.com/ava-labs/hypersdk v0.0.18-0.20240920110143-2deade85d8e5 h1:0gUC3p0n5iyvvwoL4Fl5dKAm3mMfZrQ1gaKHV7WVOn8=
github.com/ava-labs/hypersdk v0.0.18-0.20240920110143-2deade85d8e5/go.mod h1:IH+fJyFJWfrwRR4YHwKVpdPIJUqO9n3URH2odigGfDE=
github.com/ava-labs/hypersdk v0.0.18-0.20240920115159-c34272093511 h1:13p7Zk9zFeRI/FglqqPfJJGe79Y/gJHhQeuEYKVPf2M=
github.com/ava-labs/hypersdk v0.0.18-0.20240920115159-c34272093511/go.mod h1:IH+fJyFJWfrwRR4YHwKVpdPIJUqO9n3URH2odigGfDE=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
Expand Down
Loading

0 comments on commit b7a4ed1

Please sign in to comment.