Documentation ¶
Overview ¶
Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.
The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.
The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.
The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.
The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Copyright 2018 The MATRIX Authors as well as Copyright 2014-2017 The go-ethereum Authors This file is consisted of the MATRIX library and part of the go-ethereum library.
The MATRIX-ethereum library is free software: you can redistribute it and/or modify it under the terms of the MIT License.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject tothe following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func PublishEvent(aim EventCode, data interface{}) error
- func SubscribeEvent(aim EventCode, ch interface{}) (event.Subscription, error)
- type Alternative
- type BlockData
- type BlockGenor_BroadcastMiningReqMsg
- type BlockLocalVerifyOK
- type BlockPOSFinishedNotify
- type BlockToBucket
- type BlockToLinker
- type BroadCastEvent
- type Center
- type DepositDetail
- type ElectionEvent
- type EventCode
- type HD_BlkConsensusReqMsg
- type HD_BlockInsertNotify
- type HD_BroadcastMiningRspMsg
- type HD_ConsensusVote
- type HD_FullBlockReqMsg
- type HD_FullBlockRspMsg
- type HD_MiningReqMsg
- type HD_MiningRspMsg
- type HD_OnlineConsensusReqs
- type HD_OnlineConsensusVoteResultMsg
- type HD_OnlineConsensusVotes
- type HD_ReelectInquiryReqMsg
- type HD_ReelectInquiryRspMsg
- type HD_ReelectLeaderConsensus
- type HD_ReelectLeaderReqMsg
- type HD_ReelectLeaderVoteMsg
- type HD_ReelectResultBroadcastMsg
- type HD_ReelectResultRspMsg
- type HdRev
- type LeaderChangeNotify
- type LeaderStateMsg
- type LocalBlockVerifyConsensusReq
- type MasterMinerReElectionReqMsg
- type MasterMinerReElectionRsp
- type MasterMinerReElectionRspMsg
- type MasterValidatorReElectionReqMsg
- type MasterValidatorReElectionRspMsg
- type MasterValidatorReElectionRsq
- type NewBlockReadyMsg
- type OnlineConsensusReq
- type RandomRequest
- type RecoveryStateMsg
- type RecoveryType
- type ReelectRSPType
- type RoleUpdatedMsg
- type TopologyGraph
- type TopologyNodeInfo
Constants ¶
const ( Heartbeat = "Heartbeat" // 心跳交易(广播区块Hash对99取余) Publickey = "SeedPublicKey" // 公钥交易 Privatekey = "SeedPrivateKey" // 私钥交易 CallTheRoll = "CallTheRoll" //点名交易 (广播节点随机连接1000个点) )
by hezi //YY 2018-08-18由tx_pool.go转移到此
Variables ¶
var ( SubErrorNoThisEvent = errors.New("SubscribeEvent Failed No This Event") PostErrorNoThisEvent = errors.New("PostEvent Failed No This Event") )
Functions ¶
func PublishEvent ¶
func SubscribeEvent ¶
func SubscribeEvent(aim EventCode, ch interface{}) (event.Subscription, error)
Types ¶
type BlockGenor_BroadcastMiningReqMsg ¶
type BlockGenor_BroadcastMiningReqMsg struct {
BlockMainData *BlockData
}
type BlockLocalVerifyOK ¶
type BlockPOSFinishedNotify ¶
type BlockToBucket ¶
type DepositDetail ¶
type DepositDetail struct { Address common.Address NodeID discover.NodeID Deposit *big.Int WithdrawH *big.Int OnlineTime *big.Int }
拓扑生成模块
type EventCode ¶
type EventCode int
const ( NewBlockMessage EventCode = iota SendBroadCastTx HD_MiningReq HD_MiningRsp HD_BroadcastMiningReq HD_BroadcastMiningRsp //CA CA_RoleUpdated // RoleUpdatedMsg CA_ReqCurrentBlock //P2P P2P_BlkVerifyRequest // BlockVerifyReqMsg //Leader service Leader_LeaderChangeNotify // LeaderChangeNotify Leader_RecoveryState //BlockVerify service HD_BlkConsensusReq HD_BlkConsensusVote BlkVerify_VerifyConsensusOK //BlockVerifyConsensusOK BlkVerify_POSFinishedNotify //BlockPOSFinishedNotify //BlockGenor service BlockGenor_HeaderGenerateReq HD_NewBlockInsert BlockGenor_HeaderVerifyReq BlockGenor_NewBlockReady HD_FullBlockReq HD_FullBlockRsp //topnode online HD_TopNodeConsensusReq HD_TopNodeConsensusVote HD_TopNodeConsensusVoteResult //leader HD_LeaderReelectInquiryReq HD_LeaderReelectInquiryRsp HD_LeaderReelectReq HD_LeaderReelectVote HD_LeaderReelectResultBroadcast HD_LeaderReelectResultBroadcastRsp //Topology ReElec_MasterMinerReElectionReq ReElec_MasterValidatorElectionReq Topo_MasterMinerElectionRsp Topo_MasterValidatorElectionRsp //random ReElec_TopoSeedReq Random_TopoSeedRsp P2P_HDMSG BlockToBuckets BlockToLinkers SendUdpTx LastEventCode )
type HD_BlkConsensusReqMsg ¶
type HD_BlkConsensusReqMsg struct { From common.Address Header *types.Header ConsensusTurn uint32 TxsCode []uint32 }
block verify server
type HD_BlockInsertNotify ¶
BolckGenor
type HD_ConsensusVote ¶
type HD_ConsensusVote struct { SignHash common.Hash Round uint64 Sign common.Signature From common.Address }
共识投票消息
type HD_FullBlockReqMsg ¶
type HD_FullBlockRspMsg ¶
type HD_MiningReqMsg ¶
Miner Module
type HD_MiningRspMsg ¶
type HD_OnlineConsensusReqs ¶
type HD_OnlineConsensusReqs struct { From common.Address ReqList []*OnlineConsensusReq //请求结构 }
在线状态共识请求消息
type HD_OnlineConsensusVoteResultMsg ¶
type HD_OnlineConsensusVoteResultMsg struct { Req *OnlineConsensusReq //请求结构 SignList []common.Signature //签名列表 }
共识结果
type HD_OnlineConsensusVotes ¶
type HD_OnlineConsensusVotes struct {
Votes []HD_ConsensusVote
}
type HD_ReelectInquiryReqMsg ¶
type HD_ReelectInquiryRspMsg ¶
type HD_ReelectInquiryRspMsg struct { Number uint64 ReqHash common.Hash Type ReelectRSPType AgreeSign common.Signature POSResult *HD_BlkConsensusReqMsg RLResult *HD_ReelectLeaderConsensus NewBlock *types.Header From common.Address }
type HD_ReelectLeaderConsensus ¶
type HD_ReelectLeaderConsensus struct { Req *HD_ReelectLeaderReqMsg Votes []common.Signature TimeStamp int64 }
type HD_ReelectLeaderReqMsg ¶
type HD_ReelectLeaderReqMsg struct { InquiryReq *HD_ReelectInquiryReqMsg AgreeSigns []common.Signature TimeStamp int64 }
type HD_ReelectLeaderVoteMsg ¶
type HD_ReelectLeaderVoteMsg struct { Vote HD_ConsensusVote Number uint64 }
type HD_ReelectResultBroadcastMsg ¶
type HD_ReelectResultBroadcastMsg struct { Number uint64 Type ReelectRSPType POSResult *HD_BlkConsensusReqMsg RLResult *HD_ReelectLeaderConsensus TimeStamp int64 From common.Address }
type HD_ReelectResultRspMsg ¶
type LeaderChangeNotify ¶
type LeaderStateMsg ¶
type LocalBlockVerifyConsensusReq ¶
type LocalBlockVerifyConsensusReq struct { BlkVerifyConsensusReq *HD_BlkConsensusReqMsg Txs types.Transactions // 交易列表 Receipts []*types.Receipt // 收据 State *state.StateDB // apply state changes here 状态数据库 }
type MasterMinerReElectionReqMsg ¶
type MasterMinerReElectionReqMsg struct { SeqNum uint64 RandSeed *big.Int MinerList []vm.DepositDetail }
矿工主节点生成请求
type MasterMinerReElectionRsp ¶
type MasterMinerReElectionRsp struct { SeqNum uint64 MasterMiner []TopologyNodeInfo BackUpMiner []TopologyNodeInfo }
矿工主节点生成响应
type MasterMinerReElectionRspMsg ¶
type MasterMinerReElectionRspMsg struct {
SeqNum uint64
}
Election Module
type MasterValidatorReElectionReqMsg ¶
type MasterValidatorReElectionReqMsg struct { SeqNum uint64 RandSeed *big.Int ValidatorList []vm.DepositDetail FoundationValidatoeList []vm.DepositDetail }
验证者主节点生成请求
type MasterValidatorReElectionRspMsg ¶
type MasterValidatorReElectionRspMsg struct {
SeqNum uint64
}
type MasterValidatorReElectionRsq ¶
type MasterValidatorReElectionRsq struct { SeqNum uint64 MasterValidator []TopologyNodeInfo BackUpValidator []TopologyNodeInfo CandidateValidator []TopologyNodeInfo }
验证者主节点生成响应
type NewBlockReadyMsg ¶
type OnlineConsensusReq ¶
type OnlineConsensusReq struct { Leader common.Address //leader地址 Seq uint64 //共识轮次 Node common.Address // node 地址 OnlineState int //在线状态 }
在线状态共识请求
type RandomRequest ¶
type RandomRequest struct { MinHash common.Hash PrivateMap map[common.Address][]byte PublicMap map[common.Address][]byte }
随机数生成请求
type RecoveryStateMsg ¶
type RecoveryStateMsg struct { Type RecoveryType Header *types.Header From common.Address }
type RecoveryType ¶
type RecoveryType uint8
const ( RecoveryTypePOS RecoveryType = iota RecoveryTypeFullHeader )
type ReelectRSPType ¶
type ReelectRSPType uint8
const ( ReelectRSPTypeNone ReelectRSPType = iota ReelectRSPTypePOS ReelectRSPTypeAlreadyRL ReelectRSPTypeAgree ReelectRSPTypeNewBlockReady )
type RoleUpdatedMsg ¶
type TopologyGraph ¶
type TopologyGraph struct { Number uint64 NodeList []TopologyNodeInfo CurNodeNumber uint8 }
func NewGenesisTopologyGraph ¶
func NewGenesisTopologyGraph(genesisHeader *types.Header) (*TopologyGraph, error)
func (*TopologyGraph) Transfer2NextGraph ¶
func (self *TopologyGraph) Transfer2NextGraph(number uint64, blockTopology *common.NetTopology, electList []common.Elect) (*TopologyGraph, error)