chain

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: GPL-3.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Client identifier to advertise over the network
	MainChain    = "pchain"
	TestnetChain = "testnet"
)
View Source
const (
	OFFICIAL_MINIMUM_VALIDATORS = 1
	OFFICIAL_MINIMUM_DEPOSIT    = "100000000000000000000000" // 100,000 * e18
)
View Source
const (
	POSReward  = "315000000000000000000000000"
	LockReward = "11500000000000000000000000" // 11.5m

	DefaultAccountPassword = "pchain"
)

Variables

View Source
var (
	// tendermint config
	Config cfg.Config
)

Functions

func CreateChildChain

func CreateChildChain(ctx *cli.Context, chainId string, validator tdmTypes.PrivValidator, keyJson []byte, validators []tdmTypes.GenesisValidator) error

func GetTendermintConfig

func GetTendermintConfig(chainId string, ctx *cli.Context) cfg.Config

func InitChildChainCmd added in v1.0.24

func InitChildChainCmd(ctx *cli.Context) error

func InitCmd

func InitCmd(ctx *cli.Context) error

func InitEthGenesis

func InitEthGenesis(ctx *cli.Context) error

func MustGetEthereumFromNode

func MustGetEthereumFromNode(node *node.Node) *eth.Ethereum

func StartChain

func StartChain(ctx *cli.Context, chain *Chain, startDone chan<- struct{}) error

Types

type BalaceAmount

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

type Chain

type Chain struct {
	Id      string
	Config  cfg.Config
	EthNode *eth.Node
}

func LoadChildChain

func LoadChildChain(ctx *cli.Context, chainId string) *Chain

func LoadMainChain

func LoadMainChain(ctx *cli.Context, chainId string) *Chain

type ChainManager

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

func GetCMInstance

func GetCMInstance(ctx *cli.Context) *ChainManager

func (*ChainManager) GetNodeID

func (cm *ChainManager) GetNodeID() string

func (*ChainManager) InitCrossChainHelper

func (cm *ChainManager) InitCrossChainHelper()

func (*ChainManager) InitP2P

func (cm *ChainManager) InitP2P()

func (*ChainManager) LoadChains

func (cm *ChainManager) LoadChains(childIds []string) error

func (*ChainManager) LoadChildChainInRT

func (cm *ChainManager) LoadChildChainInRT(chainId string)

func (*ChainManager) LoadMainChain

func (cm *ChainManager) LoadMainChain(ctx *cli.Context) error

func (*ChainManager) StartChains

func (cm *ChainManager) StartChains() error

func (*ChainManager) StartInspectEvent

func (cm *ChainManager) StartInspectEvent()

func (*ChainManager) StartMainChain

func (cm *ChainManager) StartMainChain() error

func (*ChainManager) StartP2PServer

func (cm *ChainManager) StartP2PServer() error

func (*ChainManager) StartRPC

func (cm *ChainManager) StartRPC() error

func (*ChainManager) Stop

func (cm *ChainManager) Stop()

func (*ChainManager) StopChain added in v1.0.19

func (cm *ChainManager) StopChain()

func (*ChainManager) Wait added in v1.0.19

func (cm *ChainManager) Wait()

func (*ChainManager) WaitChainsStop

func (cm *ChainManager) WaitChainsStop()

type CrossChainHelper

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

func (*CrossChainHelper) CanCreateChildChain

func (cch *CrossChainHelper) CanCreateChildChain(from common.Address, chainId string, minValidators uint16, minDepositAmount, startupCost *big.Int, startBlock, endBlock *big.Int) error

CanCreateChildChain check the condition before send the create child chain into the tx pool

func (*CrossChainHelper) ChangeValidators

func (cch *CrossChainHelper) ChangeValidators(chainId string)

func (*CrossChainHelper) CreateChildChain

func (cch *CrossChainHelper) CreateChildChain(from common.Address, chainId string, minValidators uint16, minDepositAmount *big.Int, startBlock, endBlock *big.Int) error

CreateChildChain Save the Child Chain Data into the DB, the data will be used later during Block Commit Callback

func (*CrossChainHelper) DeleteTX3

func (cch *CrossChainHelper) DeleteTX3(chainId string, txHash common.Hash)

func (*CrossChainHelper) GetAllTX3ProofData

func (cch *CrossChainHelper) GetAllTX3ProofData() []*types.TX3ProofData

func (*CrossChainHelper) GetChainInfoDB

func (cch *CrossChainHelper) GetChainInfoDB() dbm.DB

func (*CrossChainHelper) GetClient

func (cch *CrossChainHelper) GetClient() *ethclient.Client

func (*CrossChainHelper) GetEpochFromMainChain

func (cch *CrossChainHelper) GetEpochFromMainChain() (string, *epoch.Epoch)

func (*CrossChainHelper) GetHeightFromMainChain

func (cch *CrossChainHelper) GetHeightFromMainChain() *big.Int

func (*CrossChainHelper) GetMainChainId

func (cch *CrossChainHelper) GetMainChainId() string

func (*CrossChainHelper) GetMutex

func (cch *CrossChainHelper) GetMutex() *sync.Mutex

func (*CrossChainHelper) GetTX3

func (cch *CrossChainHelper) GetTX3(chainId string, txHash common.Hash) *types.Transaction

TX3LocalCache start

func (*CrossChainHelper) GetTX3ProofData

func (cch *CrossChainHelper) GetTX3ProofData(chainId string, txHash common.Hash) *types.TX3ProofData

func (*CrossChainHelper) GetTxFromMainChain

func (cch *CrossChainHelper) GetTxFromMainChain(txHash common.Hash) *types.Transaction

func (*CrossChainHelper) JoinChildChain

func (cch *CrossChainHelper) JoinChildChain(from common.Address, pubkey crypto.PubKey, chainId string, depositAmount *big.Int) error

JoinChildChain Join the Child Chain

func (*CrossChainHelper) ProcessPostPendingData

func (cch *CrossChainHelper) ProcessPostPendingData(newPendingIdxBytes []byte, deleteChildChainIds []string)

func (*CrossChainHelper) ReadyForLaunchChildChain

func (cch *CrossChainHelper) ReadyForLaunchChildChain(height *big.Int, stateDB *state.StateDB) ([]string, []byte, []string)

func (*CrossChainHelper) RevealVote

func (cch *CrossChainHelper) RevealVote(ep *epoch.Epoch, from common.Address, pubkey crypto.PubKey, depositAmount *big.Int, salt string, txHash common.Hash) error

func (*CrossChainHelper) SaveChildChainProofDataToMainChain

func (cch *CrossChainHelper) SaveChildChainProofDataToMainChain(bs []byte) error

func (*CrossChainHelper) ValidateJoinChildChain

func (cch *CrossChainHelper) ValidateJoinChildChain(from common.Address, consensusPubkey []byte, chainId string, depositAmount *big.Int, signature []byte) error

ValidateJoinChildChain check the criteria whether it meets the join child chain requirement

func (*CrossChainHelper) ValidateTX3ProofData

func (cch *CrossChainHelper) ValidateTX3ProofData(proofData *types.TX3ProofData) error

func (*CrossChainHelper) ValidateTX4WithInMemTX3ProofData

func (cch *CrossChainHelper) ValidateTX4WithInMemTX3ProofData(tx4 *types.Transaction, tx3ProofData *types.TX3ProofData) error

func (*CrossChainHelper) VerifyChildChainProofData

func (cch *CrossChainHelper) VerifyChildChainProofData(bs []byte) error

verify the signature of validators who voted for the block most of the logic here is from 'VerifyHeader'

func (*CrossChainHelper) VoteNextEpoch

func (cch *CrossChainHelper) VoteNextEpoch(ep *epoch.Epoch, from common.Address, voteHash common.Hash, txHash common.Hash) error

func (*CrossChainHelper) WriteTX3ProofData

func (cch *CrossChainHelper) WriteTX3ProofData(proofData *types.TX3ProofData) error

type InvalidArgs

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

func (InvalidArgs) Error

func (invalid InvalidArgs) Error() string

Jump to

Keyboard shortcuts

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