forked from TrueCloudLab/neoneo-go
cli: add config generate command
Add cli command to generate YAML configuration files. Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
e95d87779b
commit
c3705664c2
12 changed files with 1462 additions and 6 deletions
32
.github/workflows/tests.yml
vendored
32
.github/workflows/tests.yml
vendored
|
@ -150,6 +150,38 @@ jobs:
|
|||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
verbose: true
|
||||
|
||||
check_config:
|
||||
name: Check Configuration Files
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: 'go.mod'
|
||||
|
||||
- name: Build NeoGo
|
||||
run: |
|
||||
echo "=> Building binary"
|
||||
export GOGC=off
|
||||
export CGO_ENABLED=0
|
||||
VERSION=$(git describe --tags --always || echo "untagged")
|
||||
COMMIT=$(git rev-parse HEAD)
|
||||
BUILD_FLAGS="-X main.Version=$VERSION -X main.Commit=$COMMIT"
|
||||
BINARY_PATH="./neo-go"
|
||||
go build -trimpath -v -ldflags "$BUILD_FLAGS" -o ${BINARY_PATH} ./cli/main.go
|
||||
|
||||
- name: Generate Configurations
|
||||
run: |
|
||||
./neo-go config generate --all
|
||||
|
||||
- name: Check for configuration changes
|
||||
run: |
|
||||
git diff --exit-code ./config || (echo "::error ::Configuration mismatch detected. Please update the configuration files:" && git diff ./config)
|
||||
|
||||
tests:
|
||||
name: Run tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
|
25
README.md
25
README.md
|
@ -75,15 +75,28 @@ The resulting binary is `bin/neo-go.exe`.
|
|||
|
||||
## Running a node
|
||||
|
||||
A node needs to connect to some network, either local one (usually referred to
|
||||
as `privnet`) or public (like `mainnet` or `testnet`). Network configuration
|
||||
is stored in a file and NeoGo allows you to store multiple files in one
|
||||
directory (`./config` by default) and easily switch between them using network
|
||||
flags.
|
||||
Before running a Neo node, you need to generate the necessary configuration files
|
||||
for the network you wish to connect to, such as a local network (`privnet`), or
|
||||
a public network like `mainnet` or `testnet`. NeoGo stores network configuration
|
||||
files in a directory (`./config` by default) and allows you to easily switch
|
||||
between them using network flags.
|
||||
|
||||
To start Neo node on a private network, use:
|
||||
### Initial Setup
|
||||
|
||||
First, generate the configuration files for all available networks:
|
||||
|
||||
```bash
|
||||
./bin/neo-go config generate --all
|
||||
```
|
||||
|
||||
This command will create configuration files for each network in
|
||||
the `./config` directory. You need to run this step only once before the first run.
|
||||
|
||||
### Starting the Node
|
||||
|
||||
To start a Neo node on a private network, use:
|
||||
|
||||
```bash
|
||||
./bin/neo-go node
|
||||
```
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"os"
|
||||
"runtime"
|
||||
|
||||
nodeconfig "github.com/nspcc-dev/neo-go/cli/config"
|
||||
"github.com/nspcc-dev/neo-go/cli/query"
|
||||
"github.com/nspcc-dev/neo-go/cli/server"
|
||||
"github.com/nspcc-dev/neo-go/cli/smartcontract"
|
||||
|
@ -37,5 +38,6 @@ func New() *cli.App {
|
|||
ctl.Commands = append(ctl.Commands, vm.NewCommands()...)
|
||||
ctl.Commands = append(ctl.Commands, util.NewCommands()...)
|
||||
ctl.Commands = append(ctl.Commands, query.NewCommands()...)
|
||||
ctl.Commands = append(ctl.Commands, nodeconfig.NewCommands()...)
|
||||
return ctl
|
||||
}
|
||||
|
|
121
cli/config/config.go
Normal file
121
cli/config/config.go
Normal file
|
@ -0,0 +1,121 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/cli/cmdargs"
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/urfave/cli"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// NewCommands returns 'config' command.
|
||||
func NewCommands() []cli.Command {
|
||||
return []cli.Command{
|
||||
{
|
||||
Name: "config",
|
||||
Usage: "NeoGo node configuration management",
|
||||
Subcommands: []cli.Command{
|
||||
{
|
||||
Name: "generate",
|
||||
Usage: "generate configuration files",
|
||||
UsageText: "neo-go config generate [--privnet | --mainnet | --testnet | --unit_testnet | --mainnet_neofs | --testnet_neofs | --docker | --all] [--config-path path]",
|
||||
Action: configGenerate,
|
||||
Flags: []cli.Flag{
|
||||
cli.BoolFlag{Name: "privnet, p", Usage: "generate private network configuration"},
|
||||
cli.BoolFlag{Name: "mainnet, m", Usage: "generate mainnet network configuration"},
|
||||
cli.BoolFlag{Name: "testnet, t", Usage: "generate testnet network configuration"},
|
||||
cli.BoolFlag{Name: "unit_testnet", Usage: "generate unit test network configuration"},
|
||||
cli.BoolFlag{Name: "mainnet_neofs", Usage: "generate mainnet NeoFS network configuration"},
|
||||
cli.BoolFlag{Name: "testnet_neofs", Usage: "generate testnet NeoFS network configuration"},
|
||||
cli.BoolFlag{Name: "docker", Usage: "generate Docker configuration"},
|
||||
cli.BoolFlag{Name: "all", Usage: "generate all networks configurations"},
|
||||
cli.StringFlag{Name: "config-path", Usage: "path to the directory where configuration files will be generated"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func configGenerate(ctx *cli.Context) error {
|
||||
if err := cmdargs.EnsureNone(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
filesToGenerate := make(map[string]config.Config)
|
||||
|
||||
if ctx.Bool("all") {
|
||||
filesToGenerate = map[string]config.Config{
|
||||
"protocol.mainnet.yml": Mainnet,
|
||||
"protocol.mainnet.neofs.yml": MainnetNeoFS,
|
||||
"protocol.testnet.yml": Testnet,
|
||||
"protocol.testnet.neofs.yml": TestnetNeoFS,
|
||||
"protocol.unit_testnet.yml": UnitTestnet,
|
||||
"protocol.unit_testnet.single.yml": UnitTestnetSingle,
|
||||
"protocol.privnet.docker.one.yml": PrivnetDockerOne,
|
||||
"protocol.privnet.docker.two.yml": PrivnetDockerTwo,
|
||||
"protocol.privnet.docker.three.yml": PrivnetDockerThree,
|
||||
"protocol.privnet.docker.four.yml": PrivnetDockerFour,
|
||||
"protocol.privnet.docker.single.yml": PrivnetDockerSingle,
|
||||
"protocol.privnet.yml": Privnet,
|
||||
}
|
||||
} else {
|
||||
if ctx.Bool("privnet") {
|
||||
filesToGenerate["protocol.privnet.yml"] = Privnet
|
||||
}
|
||||
if ctx.Bool("mainnet") {
|
||||
filesToGenerate["protocol.mainnet.yml"] = Mainnet
|
||||
}
|
||||
if ctx.Bool("testnet") {
|
||||
filesToGenerate["protocol.testnet.yml"] = Testnet
|
||||
}
|
||||
if ctx.Bool("unit_testnet") {
|
||||
filesToGenerate["protocol.unit_testnet.yml"] = UnitTestnet
|
||||
filesToGenerate["protocol.unit_testnet.single.yml"] = UnitTestnetSingle
|
||||
}
|
||||
if ctx.Bool("mainnet_neofs") {
|
||||
filesToGenerate["protocol.mainnet.neofs.yml"] = MainnetNeoFS
|
||||
}
|
||||
if ctx.Bool("testnet_neofs") {
|
||||
filesToGenerate["protocol.testnet.neofs.yml"] = TestnetNeoFS
|
||||
}
|
||||
if ctx.Bool("docker") {
|
||||
filesToGenerate["protocol.privnet.docker.one.yml"] = PrivnetDockerOne
|
||||
filesToGenerate["protocol.privnet.docker.two.yml"] = PrivnetDockerTwo
|
||||
filesToGenerate["protocol.privnet.docker.three.yml"] = PrivnetDockerThree
|
||||
filesToGenerate["protocol.privnet.docker.four.yml"] = PrivnetDockerFour
|
||||
filesToGenerate["protocol.privnet.docker.single.yml"] = PrivnetDockerSingle
|
||||
}
|
||||
}
|
||||
configDir := ctx.String("config-path")
|
||||
if configDir == "" {
|
||||
configDir = "config"
|
||||
}
|
||||
if err := os.MkdirAll(configDir, 0755); err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("unable to create configuration directory: %w", err), 1)
|
||||
}
|
||||
|
||||
for fileName, cfg := range filesToGenerate {
|
||||
if err := writeConfigToFile(cfg, filepath.Join(configDir, fileName)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func writeConfigToFile(cfg config.Config, filename string) error {
|
||||
file, err := os.Create(filename)
|
||||
if err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to create file %s: %w", filename, err), 1)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
encoder := yaml.NewEncoder(file)
|
||||
if err := encoder.Encode(cfg); err != nil {
|
||||
return cli.NewExitError(fmt.Errorf("failed to encode configuration to file %s: %w", filename, err), 1)
|
||||
}
|
||||
return nil
|
||||
}
|
127
cli/config/mainnet.go
Normal file
127
cli/config/mainnet.go
Normal file
|
@ -0,0 +1,127 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// Mainnet is the configuration for the Neo N3 mainnet.
|
||||
var Mainnet = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 860833102,
|
||||
MaxTraceableBlocks: 2102400,
|
||||
InitialGASSupply: 52000000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"03b209fd4f53a7170ea4444e0cb0a6bb6a53c2bd016926989cf85f9b0fba17a70c",
|
||||
"02df48f60e8f3e01c48ff40b9b7f1310d7a8b2a193188befe1c2e3df740e895093",
|
||||
"03b8d9d5771d8f513aa0869b9cc8d50986403b78c6da36890638c3d46a5adce04a",
|
||||
"02ca0e27697b9c248f6f16e085fd0061e26f44da85b58ee835c110caa5ec3ba554",
|
||||
"024c7b7fb6c310fccf1ba33b082519d82964ea93868d676662d4a59ad548df0e7d",
|
||||
"02aaec38470f6aad0042c6e877cfd8087d2676b0f516fddd362801b9bd3936399e",
|
||||
"02486fd15702c4490a26703112a5cc1d0923fd697a33406bd5a1c00e0013b09a70",
|
||||
"023a36c72844610b4d34d1968662424011bf783ca9d984efa19a20babf5582f3fe",
|
||||
"03708b860c1de5d87f5b151a12c2a99feebd2e8b315ee8e7cf8aa19692a9e18379",
|
||||
"03c6aa6e12638b36e88adc1ccdceac4db9929575c3e03576c617c49cce7114a050",
|
||||
"03204223f8c86b8cd5c89ef12e4f0dbb314172e9241e30c9ef2293790793537cf0",
|
||||
"02a62c915cf19c7f19a50ec217e79fac2439bbaad658493de0c7d8ffa92ab0aa62",
|
||||
"03409f31f0d66bdc2f70a9730b66fe186658f84a8018204db01c106edc36553cd0",
|
||||
"0288342b141c30dc8ffcde0204929bb46aed5756b41ef4a56778d15ada8f0c6654",
|
||||
"020f2887f41474cfeb11fd262e982051c1541418137c02a0f4961af911045de639",
|
||||
"0222038884bbd1d8ff109ed3bdef3542e768eef76c1247aea8bc8171f532928c30",
|
||||
"03d281b42002647f0113f36c7b8efb30db66078dfaaa9ab3ff76d043a98d512fde",
|
||||
"02504acbc1f4b3bdad1d86d6e1a08603771db135a73e61c9d565ae06a1938cd2ad",
|
||||
"0226933336f1b75baa42d42b71d9091508b638046d19abd67f4e119bf64a7cfb4d",
|
||||
"03cdcea66032b82f5c30450e381e5295cae85c5e6943af716cc6b646352a6067dc",
|
||||
"02cd5a5547119e24feaa7c2a0f37b8c9366216bab7054de0065c9be42084003c8a",
|
||||
},
|
||||
ValidatorsCount: 7,
|
||||
VerifyTransactions: false,
|
||||
P2PSigExtensions: false,
|
||||
Hardforks: map[string]uint32{
|
||||
"Aspidochelone": 1730000,
|
||||
"Basilisk": 4120000,
|
||||
"Cockatrice": 5450000,
|
||||
},
|
||||
SeedList: []string{
|
||||
"seed1.neo.org:10333",
|
||||
"seed2.neo.org:10333",
|
||||
"seed3.neo.org:10333",
|
||||
"seed4.neo.org:10333",
|
||||
"seed5.neo.org:10333",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false,
|
||||
},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB, // Other options: 'inmemory','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "./chains/mainnet",
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/mainnet.bolt"
|
||||
},
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":10333"}, // in form of "[host]:[port][:announcedPort]"
|
||||
DialTimeout: 3000 * time.Millisecond,
|
||||
ProtoTickInterval: 2000 * time.Millisecond,
|
||||
PingInterval: 30000 * time.Millisecond,
|
||||
PingTimeout: 90000 * time.Millisecond,
|
||||
MaxPeers: 100,
|
||||
MinPeers: 10,
|
||||
AttemptConnPeers: 20,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/cn_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":10332"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
TLSConfig: config.TLS{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":10331"}},
|
||||
CertFile: "serv.crt",
|
||||
KeyFile: "serv.key",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
96
cli/config/mainnet_neofs.go
Normal file
96
cli/config/mainnet_neofs.go
Normal file
|
@ -0,0 +1,96 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// MainnetNeoFS is the configuration for the NeoFS mainnet.
|
||||
var MainnetNeoFS = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 91414437,
|
||||
MaxTraceableBlocks: 2102400,
|
||||
InitialGASSupply: 52000000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"026fa34ec057d74c2fdf1a18e336d0bd597ea401a0b2ad57340d5c220d09f44086",
|
||||
"039a9db2a30942b1843db673aeb0d4fd6433f74cec1d879de6343cb9fcf7628fa4",
|
||||
"0366d255e7ce23ea6f7f1e4bedf5cbafe598705b47e6ec213ef13b2f0819e8ab33",
|
||||
"023f9cb7bbe154d529d5c719fdc39feaa831a43ae03d2a4280575b60f52fa7bc52",
|
||||
"039ba959e0ab6dc616df8b803692f1c30ba9071b76b05535eb994bf5bbc402ad5f",
|
||||
"035a2a18cddafa25ad353dea5e6730a1b9fcb4b918c4a0303c4387bb9c3b816adf",
|
||||
"031f4d9c66f2ec348832c48fd3a16dfaeb59e85f557ae1e07f6696d0375c64f97b",
|
||||
},
|
||||
ValidatorsCount: 7,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: true,
|
||||
Hardforks: map[string]uint32{
|
||||
"Aspidochelone": 3000000,
|
||||
"Basilisk": 4500000,
|
||||
"Cockatrice": 5800000,
|
||||
},
|
||||
SeedList: []string{
|
||||
"morph1.fs.neo.org:40333",
|
||||
"morph2.fs.neo.org:40333",
|
||||
"morph3.fs.neo.org:40333",
|
||||
"morph4.fs.neo.org:40333",
|
||||
"morph5.fs.neo.org:40333",
|
||||
"morph6.fs.neo.org:40333",
|
||||
"morph7.fs.neo.org:40333",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB,
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "./chains/mainnet.neofs",
|
||||
},
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":40333"},
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 100,
|
||||
MinPeers: 5,
|
||||
AttemptConnPeers: 20,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/cn_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":40332"},
|
||||
},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
TLSConfig: config.TLS{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":40331"},
|
||||
},
|
||||
CertFile: "serv.crt",
|
||||
KeyFile: "serv.key",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
101
cli/config/privnet.go
Normal file
101
cli/config/privnet.go
Normal file
|
@ -0,0 +1,101 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// Privnet is the configuration for the Neo N3 privnet.
|
||||
var Privnet = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
SeedList: []string{
|
||||
"localhost:20333",
|
||||
"localhost:20334",
|
||||
"localhost:20335",
|
||||
"localhost:20336",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB,
|
||||
// Other options: 'inmemory','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "./chains/privnet",
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
},
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20332"}, // In form of "[host]:[port][:announcedPort]"
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 3,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/cn_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20331"},
|
||||
},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
SessionExpirationTime: 180, // Higher expiration time for manual requests and tests.
|
||||
TLSConfig: config.TLS{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20330"},
|
||||
},
|
||||
CertFile: "serv.crt",
|
||||
KeyFile: "serv.key",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
492
cli/config/privnet_docker.go
Normal file
492
cli/config/privnet_docker.go
Normal file
|
@ -0,0 +1,492 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// PrivnetDockerOne is the configuration for the first node in the Dockerized private network.
|
||||
var PrivnetDockerOne = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
SeedList: []string{
|
||||
"node_one:20333",
|
||||
"node_two:20334",
|
||||
"node_three:20335",
|
||||
"node_four:20336",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{SkipBlockVerification: false},
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB, // Change DB type if required. Other options: 'inmemory','boltdb'
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "/chains/one",
|
||||
},
|
||||
// BoltDBOptions: dbconfig.BoltDBOptions{
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
// }
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20333"}, // Standard port configuration for this environment
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 2,
|
||||
},
|
||||
Relay: true,
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
Nodes: []string{
|
||||
"http://node_one:30333",
|
||||
"http://node_two:30334",
|
||||
"http://node_three:30335",
|
||||
"http://node_four:30336",
|
||||
},
|
||||
RequestTimeout: 5 * time.Second,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet1.json",
|
||||
Password: "one",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":30333"},
|
||||
},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20001"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20011"},
|
||||
},
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet1.json",
|
||||
Password: "one",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// PrivnetDockerTwo is the configuration for the second node in the Dockerized private network.
|
||||
var PrivnetDockerTwo = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
SeedList: []string{
|
||||
"node_one:20333",
|
||||
"node_two:20334",
|
||||
"node_three:20335",
|
||||
"node_four:20336",
|
||||
},
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB, // other options: 'inmemory','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "/chains/two",
|
||||
},
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20334"}, // in form of "[host]:[port][:announcedPort]"
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 2,
|
||||
},
|
||||
Relay: true,
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
Nodes: []string{
|
||||
"http://node_one:30333",
|
||||
"http://node_two:30334",
|
||||
"http://node_three:30335",
|
||||
"http://node_four:30336",
|
||||
},
|
||||
RequestTimeout: 5 * time.Second,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet2.json",
|
||||
Password: "two",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":30334"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20002"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20012"},
|
||||
},
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet2.json",
|
||||
Password: "two",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// PrivnetDockerThree is the configuration for the third node in the Dockerized private network.
|
||||
var PrivnetDockerThree = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
SeedList: []string{
|
||||
"node_one:20333",
|
||||
"node_two:20334",
|
||||
"node_three:20335",
|
||||
"node_four:20336",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB, // other options: 'inmemory','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "/chains/three",
|
||||
},
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20335"}, // in form of "[host]:[port][:announcedPort]"
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 2,
|
||||
},
|
||||
Relay: true,
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
Nodes: []string{
|
||||
"http://node_one:30333",
|
||||
"http://node_two:30334",
|
||||
"http://node_three:30335",
|
||||
"http://node_four:30336",
|
||||
},
|
||||
RequestTimeout: 5 * time.Second,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet3.json",
|
||||
Password: "three",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":30335"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20003"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20013"},
|
||||
},
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet3.json",
|
||||
Password: "three",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// PrivnetDockerFour is the configuration for the fourth node in the Dockerized private network.
|
||||
var PrivnetDockerFour = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
SeedList: []string{
|
||||
"node_one:20333",
|
||||
"node_two:20334",
|
||||
"node_three:20335",
|
||||
"node_four:20336",
|
||||
},
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB, // other options: 'inmemory','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "/chains/four",
|
||||
},
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20336"}, // in form of "[host]:[port][:announcedPort]"
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 2,
|
||||
},
|
||||
Relay: true,
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
Nodes: []string{
|
||||
"http://node_one:30333",
|
||||
"http://node_two:30334",
|
||||
"http://node_three:30335",
|
||||
"http://node_four:30336",
|
||||
},
|
||||
RequestTimeout: 5 * time.Second,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet4.json",
|
||||
Password: "four",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":30336"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20004"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20014"},
|
||||
},
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet4.json",
|
||||
Password: "four",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// PrivnetDockerSingle is the configuration for the single node in the Dockerized private network.
|
||||
var PrivnetDockerSingle = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 1 * time.Second, // TimePerBlock adjusted to 1 second
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
},
|
||||
ValidatorsCount: 1,
|
||||
SeedList: []string{
|
||||
"node_single:20333",
|
||||
},
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB, // other options: 'inmemory','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "/chains/single",
|
||||
},
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20333"}, // Standard port configuration for single-node
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 0,
|
||||
},
|
||||
Relay: true,
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
Nodes: []string{
|
||||
"http://node_single:30333",
|
||||
},
|
||||
RequestTimeout: 5 * time.Second,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet1_solo.json",
|
||||
Password: "one",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":30333"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20001"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20011"},
|
||||
},
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet1.json",
|
||||
Password: "one",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
121
cli/config/testnet.go
Normal file
121
cli/config/testnet.go
Normal file
|
@ -0,0 +1,121 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// Testnet is the configuration for the Neo N3 testnet.
|
||||
var Testnet = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 894710606,
|
||||
MaxBlockSize: 2097152,
|
||||
MaxBlockSystemFee: 150000000000,
|
||||
MaxTraceableBlocks: 2102400,
|
||||
MaxTransactionsPerBlock: 5000,
|
||||
InitialGASSupply: 52000000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"03408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a259477806",
|
||||
"02a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b",
|
||||
"0214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff01",
|
||||
"030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba",
|
||||
"025831cee3708e87d78211bec0d1bfee9f4c85ae784762f042e7f31c0d40c329b8",
|
||||
"02cf9dc6e85d581480d91e88e8cbeaa0c153a046e89ded08b4cefd851e1d7325b5",
|
||||
"03840415b0a0fcf066bcc3dc92d8349ebd33a6ab1402ef649bae00e5d9f5840828",
|
||||
"026328aae34f149853430f526ecaa9cf9c8d78a4ea82d08bdf63dd03c4d0693be6",
|
||||
"02c69a8d084ee7319cfecf5161ff257aa2d1f53e79bf6c6f164cff5d94675c38b3",
|
||||
"0207da870cedb777fceff948641021714ec815110ca111ccc7a54c168e065bda70",
|
||||
"035056669864feea401d8c31e447fb82dd29f342a9476cfd449584ce2a6165e4d7",
|
||||
"0370c75c54445565df62cfe2e76fbec4ba00d1298867972213530cae6d418da636",
|
||||
"03957af9e77282ae3263544b7b2458903624adc3f5dee303957cb6570524a5f254",
|
||||
"03d84d22b8753cf225d263a3a782a4e16ca72ef323cfde04977c74f14873ab1e4c",
|
||||
"02147c1b1d5728e1954958daff2f88ee2fa50a06890a8a9db3fa9e972b66ae559f",
|
||||
"03c609bea5a4825908027e4ab217e7efc06e311f19ecad9d417089f14927a173d5",
|
||||
"0231edee3978d46c335e851c76059166eb8878516f459e085c0dd092f0f1d51c21",
|
||||
"03184b018d6b2bc093e535519732b3fd3f7551c8cffaf4621dd5a0b89482ca66c9",
|
||||
},
|
||||
ValidatorsCount: 7,
|
||||
VerifyTransactions: false,
|
||||
P2PSigExtensions: false,
|
||||
Hardforks: map[string]uint32{
|
||||
"Aspidochelone": 210000,
|
||||
"Basilisk": 2680000,
|
||||
"Cockatrice": 3967000,
|
||||
},
|
||||
SeedList: []string{
|
||||
"seed1t5.neo.org:20333",
|
||||
"seed2t5.neo.org:20333",
|
||||
"seed3t5.neo.org:20333",
|
||||
"seed4t5.neo.org:20333",
|
||||
"seed5t5.neo.org:20333",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB,
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "./chains/testnet",
|
||||
},
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20333"},
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 100,
|
||||
MinPeers: 10,
|
||||
AttemptConnPeers: 20,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/cn_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20332"},
|
||||
},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
TLSConfig: config.TLS{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20331"},
|
||||
},
|
||||
CertFile: "serv.crt",
|
||||
KeyFile: "serv.key",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
105
cli/config/testnet_neofs.go
Normal file
105
cli/config/testnet_neofs.go
Normal file
|
@ -0,0 +1,105 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// TestnetNeoFS is the configuration for the NeoFS testnet.
|
||||
var TestnetNeoFS = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 735783775,
|
||||
MaxTraceableBlocks: 2102400,
|
||||
InitialGASSupply: 52000000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"0337f5f45e5be5aeae4a919d0787fcb743656560949061d5b8b05509b85ffbfd53",
|
||||
"020b86534a9a264d28b79155b0ec36d555ed0068eb1b0c4d40c35cc7d2f04759b8",
|
||||
"02c2efdc01181b0bc14fc19e0acb12281396c8c9ffe64458d621d781a1ded436b7",
|
||||
"026f9b40a73f29787ef5b289ac845bc43c64680fdd42fc170b1171d3c57213a89f",
|
||||
"0272350def90715494b857315c9b9c70181739eeec52d777424fef2891c3396cad",
|
||||
"03a8cee2d3877bcce5b4595578714d77ca2d47673150b8b9cd4e391b7c73b6bda3",
|
||||
"0215e735a657f6e23478728d1d0718d516bf50c06c2abd92ec7c00eba2bd7a2552",
|
||||
},
|
||||
ValidatorsCount: 7,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: true,
|
||||
SeedList: []string{
|
||||
"morph1.t5.fs.neo.org:50333",
|
||||
"morph2.t5.fs.neo.org:50333",
|
||||
"morph3.t5.fs.neo.org:50333",
|
||||
"morph4.t5.fs.neo.org:50333",
|
||||
"morph5.t5.fs.neo.org:50333",
|
||||
"morph6.t5.fs.neo.org:50333",
|
||||
"morph7.t5.fs.neo.org:50333",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.LevelDB,
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "./chains/testnet.neofs",
|
||||
},
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":50333"},
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 100,
|
||||
MinPeers: 5,
|
||||
AttemptConnPeers: 20,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/cn_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Oracle: config.OracleConfiguration{
|
||||
Enabled: false,
|
||||
AllowedContentTypes: []string{
|
||||
"application/json",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":50332"},
|
||||
},
|
||||
MaxGasInvoke: 100,
|
||||
EnableCORSWorkaround: false,
|
||||
StartWhenSynchronized: false,
|
||||
TLSConfig: config.TLS{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":50331"},
|
||||
},
|
||||
CertFile: "server.crt",
|
||||
KeyFile: "server.key",
|
||||
},
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
145
cli/config/unit_testnet.go
Normal file
145
cli/config/unit_testnet.go
Normal file
|
@ -0,0 +1,145 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// UnitTestnet is the configuration for the unit test network with four validators.
|
||||
var UnitTestnet = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 42,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
"02c429b3ea1aa486cb2edfd6e99d8055c1f81f1a9206664e2c40a586d187257557",
|
||||
"02c4de32252c50fa171dbe25379e4e2d55cdc12f69e382c39f59a44573ecff2f9d",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: true,
|
||||
Hardforks: map[string]uint32{
|
||||
"Aspidochelone": 25,
|
||||
},
|
||||
SeedList: []string{
|
||||
"127.0.0.1:20334",
|
||||
"127.0.0.1:20335",
|
||||
"127.0.0.1:20336",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.InMemoryDB, // Utilizing in-memory database for unit testing
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20333"}, // Standard port configuration for this unit test environment
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 50,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 0,
|
||||
},
|
||||
Relay: true,
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{"127.0.0.1:0"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
SessionExpirationTime: 2,
|
||||
MaxFindStorageResultItems: 2,
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: false, // Disabled for unit tests
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false, // Disabled for unit tests
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/wallet1.json",
|
||||
Password: "one",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// UnitTestnetSingle is the configuration for the unit test network with one validator.
|
||||
var UnitTestnetSingle = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 42,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 100 * time.Millisecond,
|
||||
MemPoolSize: 100,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
},
|
||||
ValidatorsCount: 1,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: true,
|
||||
Hardforks: map[string]uint32{
|
||||
"Aspidochelone": 25,
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.InMemoryDB,
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":0"},
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MinPeers: 0,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: true,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "../testdata/wallet1_solo.json",
|
||||
Password: "one",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{"127.0.0.1:0"}},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: false, // Disabled for unit tests
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false, // Disabled for unit tests
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
101
cli/config/vm.go
Normal file
101
cli/config/vm.go
Normal file
|
@ -0,0 +1,101 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/config"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/storage/dbconfig"
|
||||
)
|
||||
|
||||
// VM is a default configuration for the chain-backed VM CLI.
|
||||
var VM = config.Config{
|
||||
ProtocolConfiguration: config.ProtocolConfiguration{
|
||||
Magic: 56753,
|
||||
MaxTraceableBlocks: 200000,
|
||||
TimePerBlock: 15 * time.Second,
|
||||
MemPoolSize: 50000,
|
||||
StandbyCommittee: []string{
|
||||
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
|
||||
"02103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e",
|
||||
"03d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699",
|
||||
"02a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd62",
|
||||
},
|
||||
ValidatorsCount: 4,
|
||||
VerifyTransactions: true,
|
||||
P2PSigExtensions: false,
|
||||
SeedList: []string{
|
||||
"localhost:20333",
|
||||
"localhost:20334",
|
||||
"localhost:20335",
|
||||
"localhost:20336",
|
||||
},
|
||||
},
|
||||
|
||||
ApplicationConfiguration: config.ApplicationConfiguration{
|
||||
Ledger: config.Ledger{
|
||||
SkipBlockVerification: false},
|
||||
// LogPath could be set up in case you need stdout logs to some proper file.
|
||||
// LogPath: "./log/neogo.log"
|
||||
DBConfiguration: dbconfig.DBConfiguration{
|
||||
Type: dbconfig.InMemoryDB,
|
||||
// Other options: 'leveldb','boltdb'
|
||||
// DB type options. Uncomment those you need in case you want to switch DB type.
|
||||
LevelDBOptions: dbconfig.LevelDBOptions{
|
||||
DataDirectoryPath: "./chains/privnet",
|
||||
// BoltDBOptions:
|
||||
// FilePath: "./chains/privnet.bolt"
|
||||
},
|
||||
},
|
||||
P2P: config.P2P{
|
||||
Addresses: []string{":20332"}, // In form of "[host]:[port][:announcedPort]"
|
||||
DialTimeout: 3 * time.Second,
|
||||
ProtoTickInterval: 2 * time.Second,
|
||||
PingInterval: 30 * time.Second,
|
||||
PingTimeout: 90 * time.Second,
|
||||
MaxPeers: 10,
|
||||
AttemptConnPeers: 5,
|
||||
MinPeers: 3,
|
||||
},
|
||||
Relay: true,
|
||||
Consensus: config.Consensus{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/cn_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
P2PNotary: config.P2PNotary{
|
||||
Enabled: false,
|
||||
UnlockWallet: config.Wallet{
|
||||
Path: "/notary_wallet.json",
|
||||
Password: "pass",
|
||||
},
|
||||
},
|
||||
RPC: config.RPC{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":20331"},
|
||||
},
|
||||
MaxGasInvoke: 15,
|
||||
EnableCORSWorkaround: false,
|
||||
SessionEnabled: true,
|
||||
SessionExpirationTime: 180, // Higher expiration time for manual requests and tests.
|
||||
TLSConfig: config.TLS{
|
||||
BasicService: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":20330"},
|
||||
},
|
||||
CertFile: "serv.crt",
|
||||
KeyFile: "serv.key",
|
||||
},
|
||||
},
|
||||
Prometheus: config.BasicService{
|
||||
Enabled: true,
|
||||
Addresses: []string{":2112"},
|
||||
},
|
||||
Pprof: config.BasicService{
|
||||
Enabled: false,
|
||||
Addresses: []string{":2113"},
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue