MCPcopy Index your code
hub / github.com/Fantom-foundation/Sonic

github.com/Fantom-foundation/Sonic @v1.2.1-a

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.2.1-a ↗ · + Follow
4,140 symbols 14,520 edges 395 files 2,019 documented · 49% updated 4mo agov1.2.1-j · 2026-03-05★ 3317 open issues
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.21 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 output are build/sonicd and build/sonictool executables.

Initialization of the Sonic Database

You will need a genesis file to join a network. Please check the following site for details how to get one: https://github.com/Fantom-foundation/lachesis_launch Once you obtain the most recent genesis file available, you need to use the sonictool create a starting 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

Launching sonicd readonly (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 how the file should look like you can use the dumpconfig subcommand to export the default configuration:

sonictool --datadir=<DB path> dumpconfig

Validator

New validator private key may be created with sonictool --datadir=<DB path> validator new command.

To launch a validator, you have to use --validator.id and --validator.pubkey flags to enable events emitter. Check the Fantom Documentation for the detailed process of obtaining the validator ID and registering your initial stake.

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

sonicd will prompt you for a password to decrypt your validator private key. Optionally, you can specify password with a file using --validator.password flag.

Participation in discovery

Optionally you can specify your public IP to straighten connectivity of the network. Ensure your TCP/UDP p2p port (5050 by default) isn't blocked by your firewall.

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

Extension points exported contracts — how you extend this code

HeavyCheck (Interface)
(no doc) [9 implementers]
eventcheck/parentlesscheck/parentless_check.go
HeavyCheck (Interface)
(no doc) [9 implementers]
eventcheck/bvallcheck/all_check.go
HeavyCheck (Interface)
(no doc) [9 implementers]
eventcheck/evallcheck/evallcheck.go
TmpWriter (Interface)
(no doc) [6 implementers]
opera/genesisstore/fileshash/write_file.go
TxListenerModule (Interface)
(no doc) [16 implementers]
gossip/blockproc/interface.go
Processor (Interface)
Processor is an interface for processing blocks using a given initial state. [4 implementers]
evmcore/types.go
SignerI (Interface)
(no doc) [5 implementers]
valkeystore/signer.go
External (Interface)
External world [3 implementers]
gossip/emitter/world.go

Core symbols most depended-on inside this repo

Equal
called by 191
gossip/emitter/mock/world.go
Error
called by 179
inter/state/adapter.go
Bytes
called by 168
topicsdb/key.go
Equal
called by 161
opera/genesis/types.go
Hash
called by 141
inter/inter_llr.go
Hash
called by 121
gossip/emitter/mock/world.go
Unlock
called by 119
valkeystore/keystore.go
Add
called by 116
valkeystore/keystore.go

Shape

Method 2,545
Function 918
Struct 580
Interface 49
TypeAlias 42
FuncType 6

Languages

Go100%

Modules by API surface

gossip/contract/sfclib100/contract.go313 symbols
gossip/contract/sfc100/contract.go179 symbols
ethapi/api.go136 symbols
gossip/contract/driver100/contract.go124 symbols
gossip/contract/driverauth100/contract.go99 symbols
evmcore/tx_pool.go94 symbols
inter/event.go87 symbols
evmcore/tx_pool_test.go87 symbols
gossip/emitter/mock/world.go86 symbols
gossip/contract/ballot/Ballot.go54 symbols
gossip/ethapi_backend.go53 symbols
gossip/common_test.go52 symbols

For agents

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

⬇ download graph artifact