based

package module
v0.0.0-...-c5242a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

Based

🚀 BasedNode is configured to operate in based sequencing mode. This mode leverages Celestia as a base layer for ordering transactions and data availability.

This implementation supports EVM execution via go-execution-evm and allows configuration for both chain DA and based sequencing DA independently.


📦 Features

  • Modular Evolve node launcher
  • Supports based sequencing via Celestia or dummy DA
  • Integrated with EVM execution (reth + geth compatible)
  • Configurable DA layers (chain and based)
  • Lightweight node initialization
  • RPC and P2P setup out of the box

🔧 Usage

based start [flags]
Example (Mocha Network with dummy DA)
based start \
  --home ~/.evnode/based \
  --evm.eth-url http://localhost:8545 \
  --evm.engine-url http://localhost:8551 \
  --evm.jwt-secret /path/to/jwt.hex \
  --evm.genesis-hash 0xabc123... \
  --evm.fee-recipient 0xYourAddress \
  --based.url http://localhost:26658 \
  --based.namespace 0102030405060708090a \
  --based.start-height 0 \
  --based.max-height-drift 1 \
  --based.gas-multiplier 1.0 \
  --based.gas-price 1.0

💠 Command-Line Flags

🧐 EVM Execution Configuration
Flag Description
--evm.eth-url Ethereum JSON-RPC URL (default http://localhost:8545)
--evm.engine-url Engine API URL (default http://localhost:8551)
--evm.jwt-secret JWT secret file path for the Engine API
--evm.genesis-hash Genesis block hash of the chain
--evm.fee-recipient Address to receive priority fees (used by the execution layer)

⚙️ Based Sequencer Configuration
Flag Description
--based.url URL for Celestia light node or other DA endpoint (default http://localhost:26658)
--based.auth Auth token for based DA layer
--based.namespace Hex-encoded namespace ID for submitting transactions (e.g., 010203...)
--based.start-height Starting DA height for fetching transactions (default 0)
--based.max-height-drift Max number of DA heights to look ahead during batching (default 1)
--based.gas-multiplier Gas multiplier to apply on DA submission (default 1.0)
--based.gas-price Base gas price to use during DA submission (default 1.0)

📁 Node Configuration
Flag Description
--home Directory to store config, keys, and state (default ~/.evnode/based)

📡 Ports

  • 26657 – Core RPC (not used in light mode)
  • 26658 – Light node RPC
  • 26659 – P2P
  • 9090 – Prometheus metrics

🧪 Development

  • To test with a dummy DA, leave --based.auth empty.
  • Namespace ID must be hex-encoded (e.g., use hex.EncodeToString in Go).
  • Supports both Celestia RPC-based DA and mock in-memory DA for testing.

🚠 Troubleshooting

  • Ensure correct permissions on the --home directory for Docker.
  • Ensure JWT secrets and engine URLs match reth/op-geth config.
  • Use --based.max-height-drift to control batching latency.

Documentation

Overview

This package implements a based sequencer.

Index

Constants

View Source
const (
	FlagBasedURL            = "based.url"
	FlagBasedAuth           = "based.auth"
	FlagBasedNamespace      = "based.namespace"
	FlagBasedStartHeight    = "based.start-height"
	FlagBasedMaxHeightDrift = "based.max-height-drift"
	FlagBasedGasMultiplier  = "based.gas-multiplier"
	FlagBasedGasPrice       = "based.gas-price"
)
View Source
const (
	DefaultMaxBlobSize uint64 = 1_500_000
)

Variables

View Source
var (
	ErrInvalidId       = errors.New("invalid  id")
	ErrInvalidMaxBytes = errors.New("invalid max bytes")
)

Functions

This section is empty.

Types

type PersistentPendingTxs

type PersistentPendingTxs struct {
	// contains filtered or unexported fields
}

PersistentPendingTxs is a persistent queue for pending transactions.

func NewPersistentPendingTxs

func NewPersistentPendingTxs(store datastore.Batching) (*PersistentPendingTxs, error)

NewPersistentPendingTxs creates a new PersistentPendingTxs instance.

func (*PersistentPendingTxs) Load

func (pt *PersistentPendingTxs) Load() error

Load loads the pending transactions from the datastore.

func (*PersistentPendingTxs) PopUpToMaxBytes

func (pt *PersistentPendingTxs) PopUpToMaxBytes(maxBytes uint64) ([][]byte, [][]byte, uint64, time.Time)

PopUpToMaxBytes pops transactions from the queue until the total size is less than maxBytes.

func (*PersistentPendingTxs) Push

func (pt *PersistentPendingTxs) Push(txs [][]byte, ids [][]byte, timestamp time.Time) error

Push adds transactions to the pending queue with a timestamp.

func (*PersistentPendingTxs) Save

func (pt *PersistentPendingTxs) Save() error

Save saves the pending transactions to the datastore.

type Sequencer

type Sequencer struct {

	// id is the unique identifier for the chain associated with this Sequencer.
	Id []byte

	// DA represents the Data Availability layer interface used by the Sequencer.
	DA coreda.DA
	// contains filtered or unexported fields
}

Sequencer is responsible for managing transactions and interacting with the Data Availability (DA) layer. It handles tasks such as adding transactions to a pending queue, retrieving batches of transactions, verifying batches, and submitting them to the DA layer. The Sequencer ensures that transactions are processed in a reliable and efficient manner while adhering to constraints like maximum blob size and height drift. Sequencer represents a structure responsible for managing the sequencing of transactions and interacting with the Data Availability (DA) layer.

func NewSequencer

func NewSequencer(
	logger zerolog.Logger,
	daImpl coreda.DA,
	Id []byte,
	daStartHeight uint64,
	maxHeightDrift uint64,
	ds datastore.Batching,
) (*Sequencer, error)

NewSequencer creates a new Sequencer instance.

func (*Sequencer) AddToPendingTxs

func (s *Sequencer) AddToPendingTxs(txs [][]byte, ids [][]byte, timestamp time.Time)

AddToPendingTxs adds transactions to the pending queue.

func (*Sequencer) GetNextBatch

GetNextBatch implements sequencer.Sequencer.

func (*Sequencer) SubmitBatchTxs

SubmitBatchTxs implements sequencer.Sequencer.

func (*Sequencer) VerifyBatch

VerifyBatch implements sequencer.Sequencer.

type TxsWithTimestamp

type TxsWithTimestamp struct {
	Txs       [][]byte
	IDs       [][]byte
	Timestamp time.Time
}

TxsWithTimestamp is a struct that holds transactions and their IDs along with a timestamp.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL