新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Commit f0b8d5cd authored by F lq's avatar F lq

update README

parent 7ebeb2a6
No related merge requests found
......@@ -5,7 +5,7 @@ Implementation of Walnut-HS. The entire protocol was implemented by Lei Tian, wi
In the following, we show how to run the code.
## Deploy the Amazon EC2 experiment
1. Before depolying the code on the Amazon EC2 instances, you need to manually start the EC2 instances and record their IP addresses and port numbers. Then, configure the information of your instances in xxxxxxxx.
1. Before depolying the code on the Amazon EC2 instances, you need to manually start the EC2 instances and record their IP addresses and port numbers. Then, configure the information of your instances in **genesis_config.yaml** and **node.yaml**.
2. Generate the key pairs.
In **walnut-hs/pkg/myecdsa** and **walnut-hs/pkg/vrf** , there are two functions for generating key pairs: **myecdsa.SigKeysGen** and **vrf.VrfKeysGen**. Each node needs to generate one myecdsa key pair and one vrf key pair. After the key pairs are generated, you need to output them in PEM format.
......@@ -72,7 +72,7 @@ type Configuration struct {
Before starting node, move each node's configuration file to its directory.
```shell
cd $nodePath
./walnut-hs -config_path node1.yaml -n_cnt 100 -cn_cnt 10 -batch_size 2000 -views 30 -start_time 1730199940 &
./walnut-hs -config_path node.yaml -n_cnt 100 -cn_cnt 10 -batch_size 2000 -views 30 -start_time 1730199940 &
```
Program Arguments:
```-config_path```: path of node configuration.
......
package config
import (
"fmt"
"os"
"testing"
"gopkg.in/yaml.v2"
)
var (
ips = []string{
"172.31.3.113",
"172.31.32.241",
"172.31.1.239",
"172.31.14.126",
"172.31.1.189",
"172.31.0.10",
"172.31.5.105",
"172.31.12.231",
"172.31.13.18",
"172.31.15.209",
}
)
func TestGenerateCfg(t *testing.T) {
cfg := &GenesisConfig{}
ipList := make([]string, 100)
portList := make([]string, 100)
privKeys := make([]string, 100)
pubKeys := make([]string, 100)
vrfPrivKeys := make([]string, 100)
vrfPubKeys := make([]string, 100)
for j := 0; j < 10; j++ {
for i := 0; i < 10; i++ {
port := fmt.Sprintf("%d", 23301+j)
ipList[j*10+i] = ips[i]
portList[j*10+i] = port
privKeys[j*10+i] = fmt.Sprintf("D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/priv_%d.key", j*10+i)
pubKeys[j*10+i] = fmt.Sprintf("D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/pub_%d.key", j*10+i)
vrfPrivKeys[j*10+i] = fmt.Sprintf("D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/vrf_priv_%d.key", j*10+i)
vrfPubKeys[j*10+i] = fmt.Sprintf("D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/vrf_pub_%d.key", j*10+i)
}
}
cfg.IpList = ipList
cfg.PortList = portList
cfg.PublicKeys = pubKeys
cfg.PrivateKeys = privKeys
cfg.VrfPrivateKeys = vrfPrivKeys
cfg.VrfPublicKeys = vrfPubKeys
yamlBytes, _ := yaml.Marshal(&cfg)
f, _ := os.Create("genesis_100.yaml")
f.Write(yamlBytes)
f.Close()
}
func TestGenerateCfg2(t *testing.T) {
cfg := &GenesisConfig{}
ipList := make([]string, 211)
portList := make([]string, 211)
privKeys := make([]string, 211)
pubKeys := make([]string, 211)
for j := 0; j < 7; j++ {
for i := 0; i < 30; i++ {
ip := ips[i]
port := fmt.Sprintf("%d", 23301+j)
ipList[30*j+i] = ip
portList[30*j+i] = port
privKeys[30*j+i] = fmt.Sprintf("D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/priv_%d.key", 30*j+i)
pubKeys[30*j+i] = fmt.Sprintf("D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/pub_%d.key", 30*j+i)
}
}
ipList[210] = "10.18.1.4"
portList[210] = "23308"
privKeys[210] = "D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/priv_210.key"
pubKeys[210] = "D:/gopath/src/viewsources.com/basic_hotstuff/main/keys/pub_210.key"
cfg.IpList = ipList
cfg.PortList = portList
cfg.PublicKeys = pubKeys
cfg.PrivateKeys = privKeys
yamlBytes, _ := yaml.Marshal(&cfg)
f, _ := os.Create("genesis_211.yaml")
f.Write(yamlBytes)
f.Close()
}
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment