Skip to content

Commit

Permalink
Merge branch 'main' into feat/basic-sdk-example
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnymatthews committed Jan 29, 2025
2 parents 442d42d + 9c0c7ae commit 0b7a882
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 32 deletions.
93 changes: 76 additions & 17 deletions content/guides/spin-up-a-devnet.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Spin up a devnet for Entropy"
title: "Spin up a devnet"
lead: "A developer network (devnet) is a private blockchain network that mimics the mainnet but is isolated for testing and development purposes. This allows developers to make mistakes and iterate quickly without impacting real users or risking real-world assets. This guide will walk you through setting up a local devnet for the Entropy."
---

Expand Down Expand Up @@ -27,34 +27,93 @@ This method leverages pre-built Docker images to quickly and easily spin up a lo

### Steps

1. Clone the Entropy Core repo:
1. Ensure that the Docker daemon is running:

```bash
git clone https://github.com/entropyxyz/entropy-core.git
cd entropy-core
```

1. Start the Docker daemon:

{{< tabs items="MacOS, Linux" >}}
{{< tabs items="As root, Rootless" >}}
{{< tab >}}
```shell
sudo systemctl start docker
sudo systemctl status docker
```
{{< /tab >}}

{{< tab >}}
```shell
dockerd
systemctl --user status docker
```
{{< /tab >}}
{{< /tabs >}}

1. Start the Docker containers:
This should output something like:

```plaintext
● docker.service - Docker Application Container Engine (Rootless)
Loaded: loaded (/home/johnny/.config/systemd/user/docker.service; enabled; preset: enable>
Active: active (running) since Mon 2025-01-27 14:04:16 AST; 3min 27s ago
Invocation: b0aea9e287394e268914b54c6177370c
Docs: https://docs.docker.com/go/rootless/
Main PID: 46707 (rootlesskit)
Tasks: 297
Memory: 524.4M (peak: 622.2M)
```
```bash
docker compose up --detach
```
1. Create the following Docker file and call it `four-nodes.yaml`:
```shell
---
name: entropy-devnet-local-4-nodes
services:
alice-tss-server:
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:3001:3001/tcp"]
command: ["--alice", "--threshold-url", "0.0.0.0:3001", "--chain-endpoint", "ws://alice-chain-node:9944", "--no-sync"]
alice-chain-node:
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:9944:9944/tcp"]
volumes: ["${PWD}/dev:/srv/entropy/dev"]
command: ["--chain", "devnet-local", "--alice", "--base-path", ".entropy/alice", "--rpc-port", "9944", "--rpc-cors", "all", "--unsafe-rpc-external", "--node-key=0000000000000000000000000000000000000000000000000000000000000001", "--tss-server-endpoint", "http://alice-tss-server:3001"]
bob-tss-server:
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:3002:3002/tcp"]
command: ["--bob", "--threshold-url", "0.0.0.0:3002", "--chain-endpoint", "ws://bob-chain-node:9944", "--no-sync"]
bob-chain-node:
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:9945:9944/tcp"]
volumes: ["${PWD}/dev:/srv/entropy/dev"]
command: ["--chain", "devnet-local", "--bob", "--base-path", ".entropy/bob", "--rpc-port", "9944", "--rpc-cors", "all", "--unsafe-rpc-external", "--bootnodes", "/dns4/alice-chain-node/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp", "--tss-server-endpoint", "http://bob-tss-server:3002"]
charlie-tss-server:
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:3003:3003/tcp"]
command: ["--charlie", "--threshold-url", "0.0.0.0:3003", "--chain-endpoint", "ws://charlie-chain-node:9944", "--no-sync"]
charlie-chain-node:
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:9946:9944/tcp"]
volumes: ["${PWD}/dev:/srv/entropy/dev"]
command: ["--chain", "devnet-local", "--charlie", "--base-path", ".entropy/charlie", "--rpc-port", "9944", "--rpc-cors", "all", "--unsafe-rpc-external", "--bootnodes", "/dns4/alice-chain-node/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp", "--tss-server-endpoint", "http://charlie-tss-server:3003"]
dave-tss-server:
image: entropyxyz/entropy-tss:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:3004:3004/tcp"]
command: ["--dave", "--threshold-url", "0.0.0.0:3004", "--chain-endpoint", "ws://dave-chain-node:9944", "--no-sync"]
dave-chain-node:
image: entropyxyz/entropy:${ENTROPY_CORE_VERSION:-latest}
ports: ["127.0.0.1:9947:9944/tcp"]
volumes: ["${PWD}/dev:/srv/entropy/dev"]
command: ["--chain", "devnet-local", "--dave", "--base-path", ".entropy/dave", "--rpc-port", "9944", "--rpc-cors", "all", "--unsafe-rpc-external", "--bootnodes", "/dns4/alice-chain-node/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp", "--tss-server-endpoint", "http://dave-tss-server:3004"]
```
The reference for this file can be found in the [Entropy JavaScript SDK repo](https://github.com/entropyxyz/sdk/blob/4ea6037276a5e406668bd1ff25b0ea265b5e904e/dev/docker-scripts/four-nodes.yaml).
1. Grab the [entropyxyz/entropy](https://hub.docker.com/r/entropyxyz/entropy) and [entropyxyz/entropy-tss](https://hub.docker.com/r/entropyxyz/entropy-tss) Docker containers:
```shell
docker pull entropyxyz/entropy
docker pull entropyxyz/entropy-tss
```
1. Start the devnet using the two containers you just downloaded and the `four-nodes.yaml` file you created:
```shell
docker-compose -f four-up.yaml up -d
```
1. Verify container status:
Expand All @@ -70,7 +129,7 @@ This method leverages pre-built Docker images to quickly and easily spin up a lo
docker compose logs
```

While optional, this command shows logs from running containers which can be helpful for troubleshooting.
While optional, this command shows logs from running containers, which can help with troubleshooting.

1. Stop all running containers:

Expand Down
44 changes: 32 additions & 12 deletions content/guides/use-the-explorer.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,42 @@
---
title: "Use the explorer"
lead: "A blockchain explorer is a web-based tool that functions like a search engine specifically designed for blockchain data. This page explains how to connect to one for Entropy."
lead: "A blockchain explorer is a web-based tool that functions like a search engine specifically designed for blockchain data. The act as an interface, allowing users to quickly search, retrieve, and analyze information on the blockchain. This page explains how to view information about the Entropy network through an explorer."
---

Blockchains, like Entropy, store information in public databases called ledgers. These ledgers are transparent, meaning anyone can view them. However, the data can be complex and challenging to understand without assistance. Blockchain explorers act as an interface, allowing users to quickly search, retrieve, and analyze information on the blockchain.
The [Polkadot\{.js\} Apps](https://polkadot.js.org/apps) is a popular user interface for interacting with Substrate blockchains. Since Entropy is built using Substrate, we can use this explorer to search and view chain data on the Entropy network.

The [Polkadot\{.js\} Apps](https://polkadot.js.org/apps) is a user interface for interacting with Substrate blockchains. Since Entropy is built using Substrate, we can use this explorer to search and view chain data on the Entropy network.

## Prerequisites

- [Docker](https://docker.com)
## Public interface

{{< callout type="info" >}}
**Why Docker?** The Entropy networks use regular WebSockets `ws://...`, rather than Secure WebSockets `wss://...`. Due to this limitation, you must run the block explorer _locally_. The easiest way to do this is to use Docker.
**Quick hint**: You can jump straight to the explorer with this link: [polkadot.js.org/apps/?rpc=wss%3A%2F%2Ftestnet.entropy.xyz](https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Ftestnet.entropy.xyz)
{{< /callout >}}

## Run the explorer
The fastest way to view information about the Entropy blockchain is to visit the public Polkadot\{.js\} interface.

1. Go to [polkadot.js.org/apps](https://polkadot.js.org/apps/#/explorer)
1. Click the network dropdown at the top left of the screen.

![Click network dropdown.](./images/use-the-explorer-click-network-dropdown.png)

1. In the sidebar, select the **Development** dropdown.
1. Within the **custom endpoint** field, enter the address for the network you want to connect to:

```plaintext
wss://testnet.entropy.xyz
```

1. Click the **Save** icon next to the address field.
1. You should now be able to use the Polkadot\{.js\} interface with Entropy.

## Local install

If you don't want to use the public web interface, you can spin up a local copy of the Polkadot\{.js\} explorer.

### Prerequisites

- [Docker](https://docker.com)

### Run the explorer

1. Open a terminal window and run:

Expand All @@ -27,7 +48,7 @@ The [Polkadot\{.js\} Apps](https://polkadot.js.org/apps) is a user interface for

1. Open a browser and go to `http://localhost`.

## Connect to the Entropy network
### Connect to the Entropy network

1. With the explorer running, select the **Unknown** dropdown at the top left:

Expand All @@ -37,7 +58,6 @@ The [Polkadot\{.js\} Apps](https://polkadot.js.org/apps) is a user interface for
1. Within the **custom endpoint** field, enter the address for the network you want to connect to:

```plaintext
# Testnet
ws://testnet.entropy.xyz:9944
```

Expand All @@ -49,4 +69,4 @@ The [Polkadot\{.js\} Apps](https://polkadot.js.org/apps) is a user interface for

![A functioning blockchain explorer window.](./images/functioning-block-explorer.png)

You should now be able to use the block explorer as usual. Check out the [wiki](https://wiki.polkadot.network/) for details on what information you can get from this blockchain explorer.
You should now be able to use the block explorer as usual. Check out the [wiki](https://wiki.polkadot.network/) for what information you can get from this blockchain explorer.
7 changes: 4 additions & 3 deletions themes/hextra/layouts/docs/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
<div class="content">
<h1>{{ .Title }}</h1>

<p class="lead italic">{{ .Params.Lead | markdownify }}</p>

{{ .Content }}
<p class="lead italic">{{ .Params.Lead }}</p>

<div class="hextra-cards hx-mt-4 hx-gap-4 hx-grid not-prose">
{{ range .Pages }}
Expand All @@ -20,9 +21,9 @@ <h1>{{ .Title }}</h1>
</span>
<div class="hextra-card-subtitle hx-line-clamp-3 hx-text-sm hx-font-normal hx-text-gray-500 dark:hx-text-gray-400 hx-px-4 hx-mb-4 hx-mt-2">
{{ if .Params.lead }}
{{ .Params.lead | truncate 200 }}
{{ .Params.lead | truncate 200 | markdownify }}
{{ else }}
{{ .Summary | truncate 200 }}
{{ .Summary | truncate 200 | markdownify }}
{{ end }}
</div>
</a>
Expand Down

0 comments on commit 0b7a882

Please sign in to comment.