MCPcopy Index your code
hub / github.com/0xsoniclabs/sonic

github.com/0xsoniclabs/sonic @v2.2.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.2.0 ↗ · + Follow
10,092 symbols 53,622 edges 845 files 5,678 documented · 56%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Sonic

EVM-compatible chain secured by the Lachesis consensus algorithm.

Building the source

Building Sonic requires both a Go (version 1.26 or later) and a C compiler. You can install them using your favourite package manager. Once the dependencies are installed, run:

make all

The build outputs are build/sonicd and build/sonictool executables.

Initialization of the Sonic Database

You will need a genesis file to join a network. See lachesis_launch for details on obtaining one. Once you have a genesis file, initialize the DB:

sonictool --datadir=<target DB path> genesis <path to the genesis file>

Running sonicd

Going through all the possible command line flags is out of scope here, but we've enumerated a few common parameter combos to get you up to speed quickly on how you can run your own sonicd instance.

Launching a network

To launch a sonicd read-only (non-validator) node for network specified by the genesis file:

sonicd --datadir=<DB path>

Configuration

As an alternative to passing the numerous flags to the sonicd binary, you can also pass a configuration file via:

sonicd --datadir=<DB path> --config /path/to/your/config.toml

To get an idea of what the file should look like you can use the dumpconfig subcommand to export the default configuration:

sonictool --datadir=<DB path> dumpconfig

Validator

To create a new validator private key:

sonictool --datadir=<DB path> validator new

To launch a validator, use the --validator.id and --validator.pubkey flags. See the Sonic Documentation for details on obtaining a validator ID and registering your initial stake.

sonicd --datadir=<DB path> --validator.id=YOUR_ID --validator.pubkey=0xYOUR_PUBKEY

sonicd will prompt for a password to decrypt your validator private key. Optionally, use --validator.password to specify a password file.

Participation in discovery

Optionally, specify your public IP to improve connectivity. Ensure your TCP/UDP p2p port (5050 by default) is open:

sonicd --datadir=<DB path> --nat=extip:1.2.3.4

Contributing

See CONTRIBUTING.md for guidelines. Please also review our Code of Conduct.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 4,951
Function 3,589
Struct 1,347
Interface 128
TypeAlias 62
FuncType 15

Languages

Go100%

Modules by API surface

gossip/contract/sfc100/contract.go337 symbols
tests/contracts/blsContracts/blsContracts.go234 symbols
gossip/contract/driver100/contract.go152 symbols
api/ethapi/api.go146 symbols
inter/event_mock.go130 symbols
gossip/contract/driverauth100/contract.go115 symbols
inter/state/adapter_mock.go114 symbols
evmcore/tx_pool_test.go109 symbols
evmcore/state_processor_test.go102 symbols
evmcore/tx_pool.go97 symbols
api/sonicapi/backend_mock.go96 symbols
gossip/emitter/world_mock.go94 symbols

For agents

$ claude mcp add sonic \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page