Skip to content

Commit b6058d3

Browse files
Revert "Add summary for Programs page. (#296)"
This reverts commit 095bbd1.
1 parent 095bbd1 commit b6058d3

File tree

2 files changed

+157
-124
lines changed

2 files changed

+157
-124
lines changed

content/concepts/programs.md

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,22 @@ title: "Programs"
33
lead: "The purpose of an Entropy program is to determine whether a group of nodes should generate a signature or not. Developers can create and deploy programs, but validator nodes are the only agents that will directly interact with the programs once deployed. Programs do not return any data other than a _success_ or _failed_ response."
44
---
55

6-
## Quick summary
7-
8-
1. **What are Entropy Programs**: WebAssembly (WASM) components used by signing nodes to determine whether they should generate a signature and how to generate that signature.
9-
1. **Who uses them**: validator nodes are the only agents directly interacting with deployed programs. However, Entropy Program developers will create, test, and deploy them. End-users do not directly interact with Entropy programs.
10-
1. **What can they do**: define which accounts can generate specific signatures and the process by which those nodes generate the signatures. Programs can contain custom hashing functions to create arbitrary signatures.
11-
1. **What they can't do**: return any data other than success/failure responses, call external chains, access external data, or access any non-deterministic data.
12-
13-
## Simple example
14-
156
As a simple example, a program could be designed to check the length of a message. If the message is more than 10 characters, then the program returns `OK`, and the signing nodes create and return a valid signature to the account that submits the message. If the message is more than 10 characters, then the program fails, and no signature is created.
167

178
```mermaid
189
flowchart LR
19-
A[Entropy account]
20-
B{Length > 10}
21-
C[Signing nodes]
22-
D[Fail]
23-
E[Success]
24-
25-
A --> | send message | B
26-
B -- true --> E
27-
E --> | generate signature | C
28-
C --> | valid signature | A
29-
30-
B -- false --> D
10+
A[Entropy account]
11+
B{Length > 10}
12+
C[Signing nodes]
13+
D[Fail]
14+
E[Success]
15+
16+
A --> | send message | B
17+
B -- true --> E
18+
E --> | generate signature | C
19+
C --> | valid signature | A
20+
21+
B -- false --> D
3122
```
3223

3324
{{< callout "info" >}}
@@ -87,7 +78,7 @@ The workflow is as follows:
8778
- The signing key signs the transaction and becomes the deployer key
8879
- A reference counter gets set to 0 when uploading and is used to track how many users are using a program
8980
2. A program then gets stored in the Programs storage slot with the key being `H(bytecode + configuration_interface)`. The hash is used by a user to point to the programs they want applied to their key. Every time a program is referenced, the reference counter increments
90-
3. Since the key is a hash, it is not possible to edit or modify programs (since that would change the hash).
81+
3. Since the key is a hash, there is no editing programs (since that would change the hash)
9182
4. Programs can be removed if the ref count is zero by the deploy key
9283

9384
## Device-proxy

content/guides/spin-up-a-devnet.md

Lines changed: 144 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,172 +1,214 @@
11
---
2-
title: "Spin up a devnet for Entropy"
3-
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."
2+
title: "Spin up a devnet"
3+
lead: "A developer network (devnet) is a private, isolated blockchain network that developers use to test and experiment with features and programs without affecting other Entropy networks or risking real-world assets. This guide will walk you through creating a local devnet on your machine."
44
---
55

6-
A devnet is an essential tool for devs working with Entropy. It provides a safe and controlled environment to:
6+
Developers should use a devnet when testing new features, experimenting with network parameters, or during initial development stages. However, developers should avoid using it for final production deployments, security audits requiring mainnet conditions, or when real-world economic incentives need to be tested.
77

8-
- Test new features and functionalities.
9-
- Experiment with network parameters.
10-
- Debug and troubleshoot issues.
11-
- Develop and test Entropy Programs without impacting mainnet.
8+
## Docker image
129

13-
This guide will cover two primary methods for setting up a local Entropy devnet:
10+
Spinning up a devnet using the Docker images supplied in the Entropy Core repo is the easiest way to get up and running. The requirements are fairly minimal, and everything should work straight out of the box.
1411

15-
- [Using Docker containers]({{< relref "#docker-containers" >}}): The recommended method for most users due to its ease of use and simplicity.
16-
- [Building from source]({{< relref "building-from-source" >}}): For developers who require more control or are unable to use Docker.
12+
### Prerequisites
1713

18-
## Docker containers
14+
You need to have [Docker](https://docs.docker.com/engine/install/) and [Docker Compose](https://docs.docker.com/compose/install/) installed. Verify you have them both installed by running:
1915

20-
This method leverages pre-built Docker images to quickly and easily spin up a local devnet.
16+
```shell
17+
docker version && docker compose version
18+
```
2119

22-
### Prerequisites
20+
```output
21+
Client:
22+
Cloud integration: v1.0.35+desktop.13
23+
Version: 26.1.1
2324
24-
- [Docker](https://docs.docker.com/engine/install/).
25-
- [Docker Compose](https://docs.docker.com/compose/install/).
26-
- Basic understanding of Docker commands.
25+
...
26+
27+
Docker Compose version v2.27.0-desktop.2
28+
```
2729

2830
### Steps
2931

30-
1. Clone the Entropy Core repo:
32+
1. Clone the Entropy Core repository and move into the new `entropy-core` directory:
3133

32-
```bash
33-
git clone https://github.com/entropyxyz/entropy-core.git
34-
cd entropy-core
35-
```
34+
```shell
35+
git clone https://github.com/entropyxyz/entropy-core.git
36+
cd entropy-core
37+
```
3638

37-
1. Start the Docker daemon:
39+
1. Add the Alice and Bob threshold-signing services (TSS) to your local `hosts` file:
3840

39-
{{< tabs items="MacOS, Linux" >}}
40-
{{< tab >}}
41-
```shell
42-
sudo systemctl start docker
43-
```
44-
{{< /tab >}}
41+
```shell
42+
echo "127.0.0.1 alice-tss-server bob-tss-server" | sudo tee -a /etc/hosts
43+
```
4544

46-
{{< tab >}}
47-
```shell
48-
dockerd
49-
```
50-
{{< /tab >}}
51-
{{< /tabs >}}
45+
You may need to enter your computer's password when prompted.
5246
5347
1. Start the Docker containers:
5448
55-
```bash
56-
docker compose up --detach
57-
```
5849
59-
1. Verify container status:
50+
```shell
51+
docker compose up --detach # Detaching is optional.
52+
```
53+
54+
```output
55+
[+] Running 0/17
56+
⠸ bob-tss-server [⠀] Pulling
57+
⠏ b3d3cc4a5268 Waiting
58+
⠏ dec0c2d4580b Waiting
59+
60+
...
61+
62+
✔ Container entropy-devnet-local-bob-chain-node-1 Started
63+
✔ Container entropy-devnet-local-alice-tss-server-1 Started
64+
✔ Container entropy-devnet-local-bob-tss-server-1 Started
65+
```
66+
67+
1. Confirm that the containers are up and running:
68+
69+
```shell
70+
docker ps
71+
```
72+
73+
```output
74+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
75+
23116711e503 entropyxyz/entropy-tss "/usr/local/bin/entr…" 1 minutes ago Up 4 seconds 9615/tcp, 9944/tcp, 127.0.0.1:3001->3001/tcp, 30333/tcp entropy-devnet-local-alice-tss-server-1
76+
c83c2ae9da20 entropyxyz/entropy "/usr/local/bin/entr…" 1 minutes ago Up 4 seconds 3001/tcp, 9615/tcp, 30333/tcp, 127.0.0.1:9944->9944/tcp entropy-devnet-local-alice-chain-node-1
77+
5088bb75951c entropyxyz/entropy-tss "/usr/local/bin/entr…" 1 minutes ago Up 4 seconds 3001/tcp, 9615/tcp, 9944/tcp, 30333/tcp, 127.0.0.1:3002->3002/tcp entropy-devnet-local-bob-tss-server-1
78+
3b0048bcaa00 entropyxyz/entropy "/usr/local/bin/entr…" 1 minutes ago Up 4 seconds 3001/tcp, 9615/tcp, 30333/tcp, 127.0.0.1:9945->9944/tcp entropy-devnet-local-bob-chain-node-1
79+
```
80+
81+
1. Confirm that the local devnet is functioning by using the Rust test interface within the Entropy Core repo:
82+
83+
```shell
84+
cargo run -p entropy-test-cli -- --chain-endpoint="ws://127.0.0.1:9944" status
85+
```
6086
61-
```bash
62-
docker ps
63-
```
87+
```output
88+
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.60s
89+
Running `target/debug/entropy-test-cli '--chain-endpoint=ws://127.0.0.1:9944' status`
6490
65-
This command lists all running Docker containers. Look for containers like `entropy-devnet-local-alice-chain-node-1`.
91+
...
6692
67-
1. (Optional) Check server logs:
93+
Hash Stored by: Times used: Size in bytes: Configurable? Has auxiliary?
94+
0x0000…0000 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY 10 300498 true true
95+
Success: Got status
96+
That took 224.958542ms
97+
```
6898
69-
```bash
70-
docker compose logs
71-
```
99+
If this is the first time you are running the Rust testing interface, the `cargo` command above will take a few minutes to complete.
72100
73-
While optional, this command shows logs from running containers which can be helpful for troubleshooting.
101+
1. You can also verify that things are working as expected by checking the server logs:
74102
75-
1. Stop all running containers:
103+
```shell
104+
docker compose logs
105+
```
76106
77-
```bash
78-
docker stop $(docker ps -a -q)
79-
```
107+
```output
108+
alice-chain-node-1 | 2024-06-24 19:41:06 Unexpected status code: 204
109+
alice-chain-node-1 | 2024-06-24 19:41:06 💤 Idle (1 peers), best: #116 (0xd68c…bfed), finalized #113 (0x06df…be36), ⬇ 0.6kiB/s ⬆ 0.6kiB/s
110+
alice-chain-node-1 | 2024-06-24 19:41:11 💤 Idle (1 peers), best: #116 (0xd68c…bfed), finalized #114 (0xb994…0299), ⬇ 0.6kiB/s ⬆ 0.5kiB/s
111+
```
80112
81-
## Building from Source
113+
1. To stop the network, simply use the `docker stop` command followed by the ID of each Docker container:
114+
115+
```shell
116+
docker stop $(docker ps -a -q)
117+
```
118+
119+
```output
120+
23116711e503
121+
c83c2ae9da20
122+
5088bb75951c
123+
3b0048bcaa00
124+
```
125+
126+
Alternatively, you can stop each container individually.
127+
128+
```shell
129+
docker stop 23116711
130+
docker stop c83c2...
131+
132+
...
133+
```
134+
135+
1. That's it!
136+
137+
## Build from source
82138

83139
It is possible to build the chain node and threshold-signature scheme server binaries. However, the process for spinning up a devnet with this method is slightly more involved than the Docker method outlined above. We recommend that you only follow this method if you have a specific reason to _not_ run Docker.
84140

85141
### Prerequisites
86142

87-
- [Latest LTS version of Rust](https://www.rust-lang.org/)
88-
- [Substrate dependencies](https://docs.substrate.io/install/)
143+
You must have the latest LTS version of [Rust](https://www.rust-lang.org/tools/install) installed, along with all the [Substrate dependencies](https://docs.substrate.io/install/) for your operating system.
89144

90145
### Steps
91146

92-
1. Clone the Entropy Core repository:
147+
1. Clone the Entropy Core repository and move into the new `entropy-core` directory:
93148

94-
```bash
95-
git clone https://github.com/entropyxyz/entropy-core.git
96-
cd entropy-core
97-
```
149+
```shell
150+
git clone https://github.com/entropyxyz/entropy-core.git
151+
cd entropy-core
152+
```
98153

99-
1. Compile the source into an executable binary:
154+
1. Build the chain node and threshold signature scheme server binaries:
100155

101-
```bash
102-
cargo build --release
103-
```
156+
```shell
157+
cargo build --release
158+
```
104159

105-
```output
106-
Downloaded asn1-rs-derive v0.4.0
107-
Downloaded byte-tools v0.3.1
108-
Downloaded const-random-macro v0.1.16
160+
```output
161+
Downloaded asn1-rs-derive v0.4.0
162+
Downloaded byte-tools v0.3.1
163+
Downloaded const-random-macro v0.1.16
109164
110-
...
111-
```
165+
...
166+
```
112167

113-
Cargo is downloading and compiling a lot of tooling for the binaries. This process may take upwards of 10 minutes, depending on your system.
168+
Cargo is downloading and compiling a lot of tooling for the binaries. This process may take upwards of 10 minutes, depending on your system.
114169

115170
1. Run the node binary:
116171

117-
```bash
118-
./target/release/entropy --dev --rpc-external
119-
```
172+
```shell
173+
./target/release/entropy --dev --rpc-external
174+
```
120175

121-
```output
122-
2024-06-24 18:36:10 💤 Idle (0 peers), best: #4 (0xe3da…d11b), finalized #0 (0xe938…3b8f), ⬇ 0 ⬆ 0
123-
2024-06-24 18:36:12 🙌 Starting consensus session on top of parent 0xe3da43079cb427b60ca77cee0fe206b933ec9df57ece549ad46a5681ea95d11b
124-
2024-06-24 18:36:12 🎁 Prepared block for proposing at 5 (2 ms) [hash: 0x636c606f7d66d8c25bc64956c14b1a9c209d035279ff4f7dccd629c346d81047; parent_hash: 0xe3da…d11b; extrinsics (1): [0x7f45…6999
125-
```
176+
```output
177+
2024-06-24 18:36:10 💤 Idle (0 peers), best: #4 (0xe3da…d11b), finalized #0 (0xe938…3b8f), ⬇ 0 ⬆ 0
178+
2024-06-24 18:36:12 🙌 Starting consensus session on top of parent 0xe3da43079cb427b60ca77cee0fe206b933ec9df57ece549ad46a5681ea95d11b
179+
2024-06-24 18:36:12 🎁 Prepared block for proposing at 5 (2 ms) [hash: 0x636c606f7d66d8c25bc64956c14b1a9c209d035279ff4f7dccd629c346d81047; parent_hash: 0xe3da…d11b; extrinsics (1): [0x7f45…6999
180+
```
126181

127-
4. (Optional) Test with the Rust test interface:
182+
1. Confirm that the local devnet is functioning by using the Rust test interface within the Entropy Core repo:
128183

129-
```bash
130-
cargo run -p entropy-test-cli -- --chain-endpoint="ws://127.0.0.1:9944" status
184+
```shell
185+
cargo run -p entropy-test-cli -- --chain-endpoint="ws://127.0.0.1:9944" status
131186
```
132187

133188
```output
134189
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.83s
135-
Running `target/debug/entropy-test-cli '--chain-endpoint=ws://127.0.0.1:9944' status`
190+
Running `target/debug/entropy-test-cli '--chain-endpoint=ws://127.0.0.1:9944' status`
136191
137192
...
138193
139-
Hash Stored by: Times used: Size in bytes: Configurable? Has auxiliary?
140-
0x0000…0000 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY 10 300498 true true
194+
Hash Stored by: Times used: Size in bytes: Configurable? Has auxiliary?
195+
0x0000…0000 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY 10 300498 true true
141196
Success: Got status
142197
That took 182.155ms
143198
```
144199

145-
If this is the first time you are running the Rust testing interface, the `cargo` command above will take a few minutes to complete.
200+
If this is the first time you are running the Rust testing interface, the `cargo` command above will take a few minutes to complete.
201+
202+
1. That's it!
146203
147204
## Best Practices
148205
149-
It's important to regularly reset the network to maintain a clean testing environment, thoroughly document all configuration settings for reproducibility, and simulate various network conditions to ensure robustness.
206+
It's important to regularly reset the network to maintain a clean testing environment, thoroughly document all configuration settings for reproducibility, and simulate various network conditions to ensure robustness.
150207

151-
Developers should strive to mirror the mainnet environment as closely as possible while still maintaining flexibility for rapid iteration. If you plan to share access to the devnet, it's essential to establish a clear protocol for managing and distributing test tokens, implement monitoring and logging systems to track network behaviour, and regularly update the devnet software to match planned mainnet upgrades.
208+
Developers should strive to mirror the mainnet environment as closely as possible while still maintaining flexibility for rapid iteration. If you plan to share access to the devnet, it's essential to establish a clear protocol for managing and distributing test tokens, implement monitoring and logging systems to track network behaviour, and regularly update the devnet software to match planned mainnet upgrades.
152209
153210
## Troubleshooting
154211
155212
**Cannot connect to the Docker daemon**: If you see the error message `Cannot connect to the Docker daemon at unix:///Users/johnny/.docker/run/docker.sock. Is the docker daemon running?` it's likely because your Docker daemon isn't running. Double-check that you've opened the Docker application.
156213

157214
**I can't build from source**: there are quite a few dependencies for building Substrate-based nodes. Run through the [official Substrate documentation](https://docs.substrate.io/install/) and make sure you have everything installed.
158-
159-
**Permission denied while trying to connect to the Docker daemon socket**: you likely don't have the correct permissions and user-groups set. Verify that the Docker socket file /var/run/docker.sock has the correct permissions. It should be owned by the `root` user and have appropriate permissions for the `docker` group:
160-
161-
162-
```shell
163-
sudo chown root:docker /var/run/docker.sock
164-
sudo chmod 0660 /var/run/docker.sock
165-
```
166-
167-
Also, make sure that your current user is in the `docker` group:
168-
169-
```shell
170-
sudo su
171-
usermod -aG docker your_username
172-
```

0 commit comments

Comments
 (0)