Skip to content

Commit 15ada26

Browse files
committed
docs: ✏️ Updated root README
1 parent 79cd271 commit 15ada26

File tree

1 file changed

+110
-21
lines changed

1 file changed

+110
-21
lines changed

README.md

+110-21
Original file line numberDiff line numberDiff line change
@@ -13,68 +13,157 @@ This project is an MVP based on the WindingTree Market Protocol, aimed at demons
1313

1414
Additional documentation can be found in the `/docs` directory.
1515

16-
## Setup and Installation
16+
## Repository Setup
1717

18-
### Clone the repository:
18+
First, you need to clone the MVP repository to your local machine or development environment. Open your terminal, and execute the following command:
1919

2020
```bash
2121
git clone [email protected]:windingtree/mvp.git ./<your-project-directory>
2222
cd <your-project-directory>
2323
```
2424

25-
### Install dependencies using pnpm:
25+
Replace `<your-project-directory>` with the name of your project directory.
26+
27+
## Installing Dependencies
28+
29+
The project uses `pnpm` for managing dependencies. Install all required dependencies by running:
2630

2731
```bash
2832
pnpm install
2933
```
3034

31-
### Configure local environment
35+
Ensure you have `pnpm` installed; if not, follow the installation instructions on the official pnpm website.
36+
37+
## Configuring the Local Environment
38+
39+
Copy the example environment files to a new `.env` files, which you'll need to configure according to your setup:
3240

3341
```bash
34-
cp ./packages/shared/.env.example ./packages/shared/.env
42+
cp ./packages/server/.env.example ./packages/server/.env
43+
cp ./packages/node/.env.example ./packages/node/.env
44+
cp ./packages/dapp-client/.env.example ./packages/dapp-client/.env
45+
cp ./packages/dapp-supplier/.env.example ./packages/dapp-supplier/.env
3546
```
3647

37-
Then edit the content of `./packages/shared/.env` according needs of you setup.
48+
### Server Configuration
3849

39-
### Build packages
50+
```ini
51+
SERVER_PORT=33333
52+
SERVER_ID=""
53+
SERVER_PR_KEY=""
54+
SERVER_PB_KEY=""
55+
```
56+
57+
Keys generation can be started by the following command:
4058

4159
```bash
42-
pnpm run build
60+
pnpm gen:key
4361
```
4462

45-
## Development
63+
As result you will get something like this:
4664

47-
### Smart Contracts
65+
```ini
66+
SERVER_ID="QmXH7wT21maJx9TrAk3neP45CeD3X5E8QnPLUH6AEYFxRt"
67+
SERVER_PR_KEY="CAISIQKx/mfSakZuFh2x9YJh276O5gI+SX8FLvMH3uC4jRvkkQ=="
68+
SERVER_PB_KEY="CAISIJCpUNDUly32nN2HFDeYNFsqRdOXCUV5K6x9CZnnI4A2"
69+
```
4870

49-
- For contracts setup follow this repository: https://github.com/windingtree/contracts
71+
> Important! The private key of the server is a confidential information. Do not publish this key anywhere. Compromising this key will allow evil parties to fake p2p traffic between clients, servers and supplier nodes.
72+
73+
## Supplier Node configuration
74+
75+
```ini
76+
NODE_TOPIC="<should be common between a node and client>"
77+
NODE_CHAIN="gnosisChiado"
78+
NODE_ENTITY_SIGNER_MNEMONIC="<will be generated during a setup procedure in the Supplier's Dapp>"
79+
NODE_ENTITY_ID="<will be generated during a setup procedure in the Supplier's Dapp>"
80+
NODE_ENTITY_OWNER_ADDRESS="<the supplier's entity owner>"
81+
NODE_SERVER_ADDRESS="<see details below>"
82+
NODE_ENTITY_OFFER_GAP=0.5
83+
NODE_API_CORS="http://localhost:5174"
84+
NODE_RESTART_MAX_COUNT=10
85+
NODE_RESTART_EVERY_TIME_SEC=5
86+
NODE_QUEUE_MAX_RETRIES=20
87+
NODE_QUEUE_RETRIES_DELAY=2000
88+
```
5089

51-
### Coordination server
90+
To get the value of `NODE_SERVER_ADDRESS` you have to use the following command:
5291

53-
- Start the protocol coordination server:
92+
1. For local environment (testing):
5493

5594
```bash
56-
pnpm run start:server
95+
pnpm gen:address --env local --id QmXH7wT21maJx9TrAk3neP45CeD3X5E8QnPLUH6AEYFxRt --address 127.0.0.1 --port 33333
5796
```
5897

59-
### Supplier Node
98+
You will get something like this:
99+
100+
```text
101+
/ip4/127.0.0.1/tcp/33333/ws/p2p/QmXH7wT21maJx9TrAk3neP45CeD3X5E8QnPLUH6AEYFxRt
102+
```
103+
104+
2. For production environment
105+
106+
```bash
107+
pnpm gen:address --env prod --id QmXH7wT21maJx9TrAk3neP45CeD3X5E8QnPLUH6AEYFxRt --address coordinator.windingtree.com
108+
```
109+
110+
Address of the server in production looks like:
111+
112+
```text
113+
/dns4/coordinator.windingtree.com/tcp/443/wss/p2p/QmXH7wT21maJx9TrAk3neP45CeD3X5E8QnPLUH6AEYFxRt
114+
```
115+
116+
## Supplier's Dapp configuration
117+
118+
```ini
119+
VITE_CHAIN="gnosisChiado"
120+
VITE_WC_PROJECT_ID="<see guidelines of WalletConnect project registration above>"
121+
VITE_SERVER_IP="127.0.0.1" # 46.101.211.99 in production
122+
VITE_SERVER_PORT=33333 # 443 in production
123+
VITE_SERVER_ID="server id generated above"
124+
```
125+
126+
## Client's Dapp configuration
127+
128+
```ini
129+
VITE_CHAIN="gnosisChiado"
130+
VITE_NODE_TOPIC="<must be equal to NODE_TOPIC defined above>"
131+
VITE_WC_PROJECT_ID="<see guidelines of WalletConnect project registration above>"
132+
VITE_SERVER_ADDRESS="<must be equal to NODE_SERVER_ADDRESS defined above>"
133+
```
134+
135+
## Building the Project
136+
137+
Compile the project's packages with:
138+
139+
```bash
140+
pnpm run build
141+
```
142+
143+
## Smart Contracts
144+
145+
The smart contracts are central to the MVP. Follow the specific setup instructions in the [smart contracts repository](https://github.com/windingtree/contracts).
146+
147+
## Coordination Server
60148

61-
- Start the protocol supplier Node server:
149+
The coordination server facilitates communication between different parts of the MVP. Launch it with:
62150

63151
```bash
64-
pnpm run start:node
152+
pnpm run start:server:dev
65153
```
66154

67-
### Supplier Dapp
155+
## Supplier Node and Dapp
68156

69-
- Start the protocol supplier web application:
157+
The supplier node acts as the backend for suppliers, while the supplier Dapp provides a user interface. Start these with:
70158

71159
```bash
160+
pnpm run start:node:dev
72161
pnpm run start:manager
73162
```
74163

75-
### Client Dapp
164+
## Client Dapp
76165

77-
- Start the protocol client web application:
166+
The client Dapp is the frontend for the end-users. Get it running with:
78167

79168
```bash
80169
pnpm run start:client

0 commit comments

Comments
 (0)