modified: README.md

modified:   cli/run.go
    modified:   configfunctions/configfunctions.go
	modified:   go.mod
	modified:   go.sum
This commit is contained in:
Gregory Bednov 2025-07-12 13:30:41 +03:00
commit 0a77f9a78c
5 changed files with 11 additions and 10 deletions

View file

@ -16,11 +16,15 @@ The binary exposes several flags. To generate configuration files and keys for a
new node run: new node run:
```bash ```bash
go run . init --mode genesis go run . init genesis
``` ```
For joining an existing network use `--mode join` instead. Once configured you For joining an existing network use `init join` instead:
can start the node with: ```bash
go run . init join <path to genesis.json>
```
Once configured you can start the node with:
```bash ```bash
go run . go run .

View file

@ -158,7 +158,7 @@ func initGenesis() {
} }
db.Close() db.Close()
cfg.UpdateGenesisJson(node.NodeInfo(), viper) cfg.UpdateGenesisJson(node.NodeInfo(), viper, filepath.Dir(defaultConfigPath))
fmt.Println("Genesis node initialized.") fmt.Println("Genesis node initialized.")
} }

View file

@ -166,8 +166,8 @@ func DefaultConfig() *cfg.Config {
return cfg.DefaultConfig() return cfg.DefaultConfig()
} }
func UpdateGenesisJson(nodeInfo p2p.NodeInfo, v *viper.Viper) { func UpdateGenesisJson(nodeInfo p2p.NodeInfo, v *viper.Viper, defaultConfigDirectoryPath string) {
file, err := os.ReadFile("./config/genesis.json") // TODO remove hardocded paths file, err := os.ReadFile(defaultConfigDirectoryPath + "/genesis.json")
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -186,7 +186,7 @@ func UpdateGenesisJson(nodeInfo p2p.NodeInfo, v *viper.Viper) {
if err != nil { if err != nil {
panic(err) panic(err)
} }
if err := os.WriteFile("./config/genesis.json", out, 0o644); err != nil { if err := os.WriteFile(defaultConfigDirectoryPath+"/genesis.json", out, 0o644); err != nil {
panic(err) panic(err)
} }
} }

1
go.mod
View file

@ -9,7 +9,6 @@ require (
github.com/spf13/cobra v1.6.0 github.com/spf13/cobra v1.6.0
github.com/spf13/viper v1.13.0 github.com/spf13/viper v1.13.0
github.com/tendermint/tendermint v0.34.24 github.com/tendermint/tendermint v0.34.24
github.com/things-go/go-socks5 v0.0.5
github.com/yggdrasil-network/yggdrasil-go v0.5.12 github.com/yggdrasil-network/yggdrasil-go v0.5.12
github.com/yggdrasil-network/yggstack v0.0.0-20250208132654-8ad1962f6456 github.com/yggdrasil-network/yggstack v0.0.0-20250208132654-8ad1962f6456
) )

2
go.sum
View file

@ -425,8 +425,6 @@ github.com/tendermint/tendermint v0.34.24 h1:879MKKJWYYPJEMMKME+DWUTY4V9f/FBpnZD
github.com/tendermint/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= github.com/tendermint/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI=
github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM= github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kGM=
github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI=
github.com/things-go/go-socks5 v0.0.5 h1:qvKaGcBkfDrUL33SchHN93srAmYGzb4CxSM2DPYufe8=
github.com/things-go/go-socks5 v0.0.5/go.mod h1:mtzInf8v5xmsBpHZVbIw2YQYhc4K0jRwzfsH64Uh0IQ=
github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg=
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q=
github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg= github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg=