geth

package module
v0.15.45 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: GPL-3.0, LGPL-3.0 Imports: 5 Imported by: 22

README

Geth and the C-Chain

Lux is a network composed of multiple blockchains. Each blockchain is an instance of a Virtual Machine (VM), much like an object in an object-oriented language is an instance of a class. That is, the VM defines the behavior of the blockchain. Geth (from core Ethereum) is the Virtual Machine (VM) that defines the Contract Chain (C-Chain). This chain implements the Ethereum Virtual Machine and supports Solidity smart contracts as well as most other Ethereum client functionality.

Building

Geth is a dependency of Lux which is used to implement the EVM based Virtual Machine for the Lux C-Chain. In order to run with a local version of Geth, users must update their Geth dependency within Lux to point to their local Geth directory. If Geth and Lux are at the standard location within your GOPATH, this will look like the following:

cd $GOPATH/src/github.com/luxfi/node
go mod edit -replace github.com/luxfi/geth=../geth

Now that Lux depends on the local version of Geth, we can build with the normal build script:

./scripts/build.sh
./build/node

Note: the C-Chain originally ran in a separate process from the main Lux process and communicated with it over a local gRPC connection. When this was the case, Lux's build script would download Geth, compile it, and place the binary into the node/build/plugins directory.

API

The C-Chain supports the following API namespaces:

  • eth
  • personal
  • txpool
  • debug

Only the eth namespace is enabled by default. To enable the other namespaces see the instructions for passing the C-Chain config to Lux here. Full documentation for the C-Chain's API can be found here.

Compatibility

The C-Chain is compatible with almost all Ethereum tooling, including Core, Metamask, Remix and Truffle.

Differences Between Lux C-Chain and Ethereum

Atomic Transactions

As a network composed of multiple blockchains, Lux uses atomic transactions to move assets between chains. Geth modifies the Ethereum block format by adding an ExtraData field, which contains the atomic transactions.

Block Timing

Blocks are produced asynchronously in Linear Consensus, so the timing assumptions that apply to Ethereum do not apply to Geth. To support block production in an async environment, a block is permitted to have the same timestamp as its parent. Since there is no general assumption that a block will be produced every 10 seconds, smart contracts built on Lux should use the block timestamp instead of the block number for their timing assumptions.

A block with a timestamp more than 10 seconds in the future will not be considered valid. However, a block with a timestamp more than 10 seconds in the past will still be considered valid as long as its timestamp is greater than or equal to the timestamp of its parent block.

Difficulty and Random OpCode

Linear Consensus does not use difficulty in any way, so the difficulty of every block is required to be set to 1. This means that the DIFFICULTY opcode should not be used as a source of randomness.

Additionally, with the change from the DIFFICULTY OpCode to the RANDOM OpCode (RANDOM replaces DIFFICULTY directly), there is no planned change to provide a stronger source of randomness. The RANDOM OpCode relies on the Eth2.0 Randomness Beacon, which has no direct parallel within the context of either Geth or Linear Consensus. Therefore, instead of providing a weaker source of randomness that may be manipulated, the RANDOM OpCode will not be supported. Instead, it will continue the behavior of the DIFFICULTY OpCode of returning the block's difficulty, such that it will always return 1.

Block Format

To support these changes, there have been a number of changes to the C-Chain block format compared to what exists on Ethereum.

Block Body
  • Version: provides version of the ExtData in the block. Currently, this field is always 0.
  • ExtData: extra data field within the block body to store atomic transaction bytes.
Block Header
  • ExtDataHash: the hash of the bytes in the ExtDataHash field
  • BaseFee: Added by EIP-1559 to represent the base fee of the block (present in Ethereum as of EIP-1559)
  • ExtDataGasUsed: amount of gas consumed by the atomic transactions in the block
  • BlockGasCost: surcharge for producing a block faster than the target rate

Documentation

Index

Constants

View Source
const (
	HashLength    = common.HashLength
	AddressLength = common.AddressLength
)

Re-export common types and constants

Variables

View Source
var (
	Big0   = common.Big0
	Big1   = common.Big1
	Big2   = common.Big2
	Big3   = common.Big3
	Big32  = common.Big32
	Big256 = common.Big256
	Big257 = common.Big257
)

Big integers

View Source
var (
	BytesToHash         = common.BytesToHash
	BigToHash           = common.BigToHash
	HexToHash           = common.HexToHash
	BytesToAddress      = common.BytesToAddress
	BigToAddress        = common.BigToAddress
	HexToAddress        = common.HexToAddress
	IsHexAddress        = common.IsHexAddress
	Hex2Bytes           = common.Hex2Bytes
	FromHex             = common.FromHex
	CopyBytes           = common.CopyBytes
	LeftPadBytes        = common.LeftPadBytes
	RightPadBytes       = common.RightPadBytes
	TrimLeftZeroes      = common.TrimLeftZeroes
	TrimRightZeroes     = common.TrimRightZeroes
	Bytes2Hex           = common.Bytes2Hex
	NewMixedcaseAddress = common.NewMixedcaseAddress
	LoadJSON            = common.LoadJSON
	FileExist           = common.FileExist
	AbsolutePath        = common.AbsolutePath
)

Common functions

View Source
var (
	Encode           = hexutil.Encode
	EncodeBig        = hexutil.EncodeBig
	EncodeUint64     = hexutil.EncodeUint64
	Decode           = hexutil.Decode
	DecodeBig        = hexutil.DecodeBig
	DecodeUint64     = hexutil.DecodeUint64
	MustDecode       = hexutil.MustDecode
	MustDecodeBig    = hexutil.MustDecodeBig
	MustDecodeUint64 = hexutil.MustDecodeUint64
)

Hexutil exports

View Source
var (
	BigPow         = math.BigPow
	PaddedBigBytes = math.PaddedBigBytes
	ReadBits       = math.ReadBits
)

Math exports

View Source
var (
	CompressBytes   = bitutil.CompressBytes
	DecompressBytes = bitutil.DecompressBytes
	XORBytes        = bitutil.XORBytes
	ANDBytes        = bitutil.ANDBytes
	ORBytes         = bitutil.ORBytes
	TestBytes       = bitutil.TestBytes
)

Bitutil exports

Functions

func IsHex added in v0.15.11

func IsHex(str string) bool

IsHex validates whether each byte is valid hexadecimal string.

Types

type Address added in v0.15.5

type Address = common.Address

Common types

type Hash

type Hash = common.Hash

Common types

type HexBig added in v0.15.11

type HexBig = hexutil.Big

Hexutil types

type HexBytes added in v0.15.11

type HexBytes = hexutil.Bytes

Hexutil types

type HexOrDecimal64 added in v0.15.11

type HexOrDecimal64 = math.HexOrDecimal64

Math types

type HexUint added in v0.15.11

type HexUint = hexutil.Uint

Hexutil types

type HexUint64 added in v0.15.11

type HexUint64 = hexutil.Uint64

Hexutil types

type MixedcaseAddress added in v0.15.11

type MixedcaseAddress = common.MixedcaseAddress

Common types

type PrettyAge added in v0.15.11

type PrettyAge = common.PrettyAge

Common types

type PrettyBytes added in v0.15.11

type PrettyBytes = common.PrettyBytes

Common types

type PrettyDuration added in v0.15.11

type PrettyDuration = common.PrettyDuration

Common types

type StorageSize added in v0.15.11

type StorageSize = common.StorageSize

Common types

type UnprefixedAddress added in v0.15.11

type UnprefixedAddress = common.UnprefixedAddress

Common types

type UnprefixedHash added in v0.15.11

type UnprefixedHash = common.UnprefixedHash

Common types

Directories

Path Synopsis
Package accounts implements high level Ethereum account management.
Package accounts implements high level Ethereum account management.
abi
Package abi implements the Ethereum ABI (Application Binary Interface).
Package abi implements the Ethereum ABI (Application Binary Interface).
abi/bind
Package bind generates Ethereum contract Go bindings.
Package bind generates Ethereum contract Go bindings.
keystore
Package keystore implements encrypted storage of secp256k1 private keys.
Package keystore implements encrypted storage of secp256k1 private keys.
cmd
abigen command
(c) 2023, Lux Industries, Inc.
(c) 2023, Lux Industries, Inc.
utils
Package utils contains internal helper functions for go-ethereum commands.
Package utils contains internal helper functions for go-ethereum commands.
Package common provides formatting utilities
Package common provides formatting utilities
bitutil
Package bitutil provides wrapper types for go-ethereum's bitutil implementation
Package bitutil provides wrapper types for go-ethereum's bitutil implementation
compiler
Package compiler provides compatibility layer for removed compiler functionality
Package compiler provides compatibility layer for removed compiler functionality
hexutil
Package hexutil provides wrapper types for go-ethereum's hexutil implementation
Package hexutil provides wrapper types for go-ethereum's hexutil implementation
lru
Package lru provides wrapper types for go-ethereum's lru implementation
Package lru provides wrapper types for go-ethereum's lru implementation
math
Package math provides wrapper types for go-ethereum's math implementation
Package math provides wrapper types for go-ethereum's math implementation
prque
Package prque provides wrapper types for go-ethereum's prque implementation
Package prque provides wrapper types for go-ethereum's prque implementation
Package compat provides compatibility shims for functions removed from go-ethereum
Package compat provides compatibility shims for functions removed from go-ethereum
Package consensus implements different Ethereum consensus engines.
Package consensus implements different Ethereum consensus engines.
Package core implements the Ethereum consensus protocol.
Package core implements the Ethereum consensus protocol.
bloombits
Package bloombits implements bloom filtering on batches of data.
Package bloombits implements bloom filtering on batches of data.
extheader
Package extheader provides Lux-specific header extensions This wrapper allows us to add Lux-specific fields while maintaining compatibility with upstream ethereum types.
Package extheader provides Lux-specific header extensions This wrapper allows us to add Lux-specific fields while maintaining compatibility with upstream ethereum types.
rawdb
Package rawdb contains a collection of low level database accessors.
Package rawdb contains a collection of low level database accessors.
state
Package state provides a caching layer atop the Ethereum state trie.
Package state provides a caching layer atop the Ethereum state trie.
state/snapshot
Package snapshot implements a journalled, dynamic state dump.
Package snapshot implements a journalled, dynamic state dump.
tracing
Package tracing provides wrapper types for go-ethereum's tracing implementation
Package tracing provides wrapper types for go-ethereum's tracing implementation
txpool/blobpool
Package blobpool implements the EIP-4844 blob transaction pool.
Package blobpool implements the EIP-4844 blob transaction pool.
txpool/legacypool
Package legacypool implements the normal EVM execution transaction pool.
Package legacypool implements the normal EVM execution transaction pool.
types
Package types provides type aliases to ethereum types This ensures compatibility with ethereum interfaces while allowing our own extensions
Package types provides type aliases to ethereum types This ensures compatibility with ethereum interfaces while allowing our own extensions
vm
Package vm implements the Ethereum Virtual Machine.
Package vm implements the Ethereum Virtual Machine.
vm/runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.
Package crypto provides wrapper types for go-ethereum's crypto implementation
Package crypto provides wrapper types for go-ethereum's crypto implementation
blake2b
Package blake2b provides wrapper types for go-ethereum's blake2b implementation
Package blake2b provides wrapper types for go-ethereum's blake2b implementation
bn256
Package bn256 provides wrapper types for go-ethereum's bn256 implementation
Package bn256 provides wrapper types for go-ethereum's bn256 implementation
kzg4844
Package kzg4844 provides wrapper types for go-ethereum's kzg4844 implementation
Package kzg4844 provides wrapper types for go-ethereum's kzg4844 implementation
eth
Package eth implements the Ethereum protocol.
Package eth implements the Ethereum protocol.
filters
Package filters implements an ethereum filtering system for block, transactions and log events.
Package filters implements an ethereum filtering system for block, transactions and log events.
tracers
Package tracers is a manager for transaction tracing engines.
Package tracers is a manager for transaction tracing engines.
tracers/internal/tracetest
(c) 2023, Lux Industries, Inc.
(c) 2023, Lux Industries, Inc.
tracers/js/internal/tracers
Package tracers contains the actual JavaScript tracer assets.
Package tracers contains the actual JavaScript tracer assets.
Package ethclient provides a client for the Ethereum RPC API.
Package ethclient provides a client for the Ethereum RPC API.
corethclient
Package gethclient provides an RPC client for geth-specific APIs.
Package gethclient provides an RPC client for geth-specific APIs.
Package ethdb provides batch extensions
Package ethdb provides batch extensions
leveldb
Package leveldb provides a wrapper for go-ethereum's leveldb implementation
Package leveldb provides a wrapper for go-ethereum's leveldb implementation
memorydb
Package memorydb provides a wrapper for go-ethereum's memorydb implementation
Package memorydb provides a wrapper for go-ethereum's memorydb implementation
pebble
Package pebble provides a wrapper for go-ethereum's pebble implementation
Package pebble provides a wrapper for go-ethereum's pebble implementation
Package event provides wrapper types for go-ethereum's event system
Package event provides wrapper types for go-ethereum's event system
Package interfaces provides type definitions for Lux-specific interfaces
Package interfaces provides type definitions for Lux-specific interfaces
internal
debug
Package debug interfaces Go runtime debugging facilities.
Package debug interfaces Go runtime debugging facilities.
ethapi
Package ethapi implements the general Ethereum API functions.
Package ethapi implements the general Ethereum API functions.
luxcache
Package luxcache provides backward compatibility types for cache that were present in older Lux versions
Package luxcache provides backward compatibility types for cache that were present in older Lux versions
reexec
This file originates from Docker/Moby, https://github.com/moby/moby/blob/master/pkg/reexec/reexec.go Licensed under Apache License 2.0: https://github.com/moby/moby/blob/master/LICENSE Copyright 2013-2018 Docker, Inc.
This file originates from Docker/Moby, https://github.com/moby/moby/blob/master/pkg/reexec/reexec.go Licensed under Apache License 2.0: https://github.com/moby/moby/blob/master/LICENSE Copyright 2013-2018 Docker, Inc.
version
Package version implements reading of build version information.
Package version implements reading of build version information.
Go port of Coda Hale's Metrics library
Go port of Coda Hale's Metrics library
prometheus
(c) 2025 Lux Industries, Inc.
(c) 2025 Lux Industries, Inc.
Package miner implements Ethereum block creation and mining.
Package miner implements Ethereum block creation and mining.
evm
evm/upgrade/acp176
ACP176 implements the fee logic specified here: https://github.com/lux-foundation/ACPs/blob/main/ACPs/176-dynamic-evm-gas-limit-and-price-discovery-updates/README.md
ACP176 implements the fee logic specified here: https://github.com/lux-foundation/ACPs/blob/main/ACPs/176-dynamic-evm-gas-limit-and-price-discovery-updates/README.md
evm/upgrade/ap0
AP0 defines constants used during the initial network launch.
AP0 defines constants used during the initial network launch.
evm/upgrade/ap1
AP1 defines constants used after the Apricot Phase 1 upgrade.
AP1 defines constants used after the Apricot Phase 1 upgrade.
evm/upgrade/ap3
AP3 defines the dynamic fee window used after the Apricot Phase 3 upgrade.
AP3 defines the dynamic fee window used after the Apricot Phase 3 upgrade.
evm/upgrade/ap4
AP4 implements the block gas cost logic activated by the Apricot Phase 4 upgrade.
AP4 implements the block gas cost logic activated by the Apricot Phase 4 upgrade.
evm/upgrade/ap5
AP5 defines constants used after the Apricot Phase 5 upgrade.
AP5 defines constants used after the Apricot Phase 5 upgrade.
evm/upgrade/cortina
Cortina defines constants used after the Cortina upgrade.
Cortina defines constants used after the Cortina upgrade.
evm/upgrade/etna
Etna defines constants used after the Etna upgrade.
Etna defines constants used after the Etna upgrade.
precompile
contract
Defines the interface for the configuration and execution of a precompile contract
Defines the interface for the configuration and execution of a precompile contract
precompileconfig
Defines the stateless interface for unmarshalling an arbitrary config of a precompile
Defines the stateless interface for unmarshalling an arbitrary config of a precompile
registry
Module to facilitate the registration of precompiles and their configuration.
Module to facilitate the registration of precompiles and their configuration.
Package rlp provides wrapper types for go-ethereum's rlp implementation
Package rlp provides wrapper types for go-ethereum's rlp implementation
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
Package rpc implements bi-directional JSON-RPC 2.0 on multiple transports.
signer
sync
Package trie implements Merkle Patricia Tries.
Package trie implements Merkle Patricia Tries.
aggregator
Package aggregator is a generated GoMock package.
Package aggregator is a generated GoMock package.
warptest
warptest exposes common functionality for testing the warp package.
warptest exposes common functionality for testing the warp package.

Jump to

Keyboard shortcuts

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