blockchain

package
v1.13.4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSubnet

func GetSubnet(subnetID ids.ID, network network.Network) (platformvm.GetSubnetClientResponse, error)

Types

type CustomVMParams

type CustomVMParams struct {
	// File path of the Custom VM binary to use
	VMFilePath string

	// Git Repo URL to be used to build Custom VM
	// Only set CustomVMRepoURL value when VMFilePath value is not set
	CustomVMRepoURL string

	// Git branch or commit to be used to build Custom VM
	// Only set CustomVMBranch value when VMFilePath value is not set
	CustomVMBranch string

	// Filepath of the script to be used to build Custom VM
	// Only set CustomVMBuildScript value when VMFilePath value is not set
	CustomVMBuildScript string
}

type DeployParams

type DeployParams struct {
	// ControlKeys is a list of P-Chain addresses that are authorized to create new chains and add
	// new validators to the Subnet
	ControlKeys []ids.ShortID

	// SubnetAuthKeys is a list of P-Chain addresses that will be used to sign transactions that
	// will modify the Subnet.
	//
	// SubnetAuthKeys has to be a subset of ControlKeys
	SubnetAuthKeys []ids.ShortID

	// Threshold is the minimum number of signatures needed before a transaction can be issued
	// Number of addresses in SubnetAuthKeys has to be more than or equal to Threshold number
	Threshold uint32
}

type Subnet

type Subnet struct {
	// Name is alias for the Subnet
	Name string

	// Genesis is the initial state of a blockchain when it is first created. Each Virtual Machine
	// defines the format and semantics of its genesis data.
	//
	// For more information regarding Genesis, head to https://docs.lux.network/build/subnet/upgrade/customize-a-subnet#genesis
	Genesis []byte

	// SubnetID is the transaction ID from an issued CreateSubnetTX and is used to identify
	// the target Subnet for CreateChainTx and AddValidatorTx
	SubnetID ids.ID

	// BlockchainID is the transaction ID from an issued CreateChainTx
	BlockchainID ids.ID

	// VMID specifies the vm that the new chain will run when CreateChainTx is called
	VMID ids.ID

	// DeployInfo contains all the necessary information for createSubnetTx
	DeployInfo DeployParams

	// RPC URL that Subnet can be reached at
	RPC string

	// OwnerAddress is address of the owner of the Validator Manager Contract
	OwnerAddress *common.Address

	// BootstrapValidators are bootstrap validators that are included in the ConvertSubnetToL1Tx call
	// that made Subnet a sovereign L1
	BootstrapValidators []*txs.ConvertSubnetToL1Validator
}

func New

func New(subnetParams *SubnetParams) (*Subnet, error)

New takes SubnetParams as input and creates Subnet as an output

The created Subnet object can be used to :

  • Create the Subnet on a specified network (Testnet / Mainnet)
  • Create Blockchain(s) in the Subnet
  • Add Validator(s) into the Subnet

func (*Subnet) Commit

func (c *Subnet) Commit(ms multisig.Multisig, wallet wallet.Wallet, waitForTxAcceptance bool) (ids.ID, error)

func (*Subnet) CreateBlockchainTx

func (c *Subnet) CreateBlockchainTx(wallet wallet.Wallet) (*multisig.Multisig, error)

CreateBlockchainTx creates uncommitted CreateChainTx keychain in wallet will be used to build, sign and pay for the transaction

func (*Subnet) CreateSubnetTx

func (c *Subnet) CreateSubnetTx(wallet wallet.Wallet) (*multisig.Multisig, error)

CreateSubnetTx creates uncommitted CreateSubnetTx keychain in wallet will be used to build, sign and pay for the transaction

func (*Subnet) InitializeProofOfAuthority

func (c *Subnet) InitializeProofOfAuthority(
	log logging.Logger,
	network network.Network,
	privateKey string,
	aggregatorLogger logging.Logger,
	validatorManagerAddressStr string,
	useACP99 bool,
	signatureAggregatorEndpoint string,
) error

InitializeProofOfAuthority setups PoA manager after a successful execution of ConvertSubnetToL1Tx on P-Chain needs the list of validators for that tx, [convertSubnetValidators], together with an evm [ownerAddress] to set as the owner of the PoA manager

func (*Subnet) InitializeProofOfStake

func (c *Subnet) InitializeProofOfStake(
	log logging.Logger,
	network network.Network,
	privateKey string,
	aggregatorLogger logging.Logger,
	posParams validatormanager.PoSParams,
	managerAddress string,
	specializedManagerAddress string,
	managerOwnerPrivateKey string,
	useACP99 bool,
	signatureAggregatorEndpoint string,
) error

func (*Subnet) SetParams

func (c *Subnet) SetParams(controlKeys []ids.ShortID, subnetAuthKeys []ids.ShortID, threshold uint32)

func (*Subnet) SetSubnetAuthKeys

func (c *Subnet) SetSubnetAuthKeys(subnetAuthKeys []ids.ShortID)

SetSubnetAuthKeys sets subnetAuthKeys, which are keys that are being used to sign a transaction that changes a Subnet

func (*Subnet) SetSubnetControlParams

func (c *Subnet) SetSubnetControlParams(controlKeys []ids.ShortID, threshold uint32)

SetSubnetControlParams sets:

  • control keys, which are keys that are allowed to make changes to a Subnet
  • threshold, which is the number of keys that need to sign a transaction that changes a Subnet

func (*Subnet) SetSubnetID

func (c *Subnet) SetSubnetID(subnetID ids.ID)

type SubnetEVMParams

type SubnetEVMParams struct {
	// ChainID identifies the current chain and is used for replay protection
	ChainID *big.Int

	// FeeConfig sets the configuration for the dynamic fee algorithm
	FeeConfig commontype.FeeConfig

	// Allocation specifies the initial state that is part of the genesis block.
	Allocation core.GenesisAlloc

	// Ethereum uses Precompiles to efficiently implement cryptographic primitives within the EVM
	// instead of re-implementing the same primitives in Solidity.
	//
	// Precompiles are a shortcut to execute a function implemented by the EVM itself,
	// rather than an actual contract. A precompile is associated with a fixed address defined in
	// the EVM. There is no byte code associated with that address.
	//
	// For more information regarding Precompiles, head to https://docs.lux.network/build/vm/evm/intro.
	Precompiles params.Precompiles

	// Timestamp
	// TODO: add description what timestamp is
	Timestamp *uint64
}

type SubnetParams

type SubnetParams struct {
	// File path of Genesis to use
	// Do not set SubnetEVMParams or CustomVMParams
	// if GenesisFilePath value is set
	//
	// See https://docs.lux.network/build/subnet/upgrade/customize-a-subnet#genesis for
	// information on Genesis
	GenesisFilePath string

	// Subnet-EVM parameters to use
	// Do not set SubnetEVM value if you are using Custom VM
	SubnetEVM *SubnetEVMParams

	// Name is alias for the Subnet, it is used to derive VM ID, which is required
	// during for createBlockchainTx
	Name string
}

Jump to

Keyboard shortcuts

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