Documentation ¶
Overview ¶
ZooBC Copyright (C) 2020 Quasisoft Limited - Hong Kong This file is part of ZooBC <https://github.com/zoobc/zoobc-core>
ZooBC is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
ZooBC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with ZooBC. If not, see <http://www.gnu.org/licenses/>.
Additional Permission Under GNU GPL Version 3 section 7. As the special exception permitted under Section 7b, c and e, in respect with the Author’s copyright, please refer to this section:
- You are free to convey this Program according to GNU GPL Version 3, as long as you respect and comply with the Author’s copyright by showing in its user interface an Appropriate Notice that the derivate program and its source code are “powered by ZooBC”. This is an acknowledgement for the copyright holder, ZooBC, as the implementation of appreciation of the exclusive right of the creator and to avoid any circumvention on the rights under trademark law for use of some trade names, trademarks, or service marks.
- Complying to the GNU GPL Version 3, you may distribute the program without any permission from the Author. However a prior notification to the authors will be appreciated.
ZooBC is architected by Roberto Capodieci & Barton Johnston
contact us at roberto.capodieci[at]blockchainzoo.com and barton.johnston[at]blockchainzoo.com
Core developers that contributed to the current implementation of the software are:
Ahmad Ali Abdilah ahmad.abdilah[at]blockchainzoo.com Allan Bintoro allan.bintoro[at]blockchainzoo.com Andy Herman Gede Sukra Ketut Ariasa Nawi Kartini nawi.kartini[at]blockchainzoo.com Stefano Galassi stefano.galassi[at]blockchainzoo.com
IMPORTANT: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Index ¶
- type P2PServerService
- func (ps P2PServerService) GetCommonMilestoneBlockIDs(ctx context.Context, chainType chaintype.ChainType, ...) (*model.GetCommonMilestoneBlockIdsResponse, error)
- func (ps *P2PServerService) GetCumulativeDifficulty(ctx context.Context, chainType chaintype.ChainType) (*model.GetCumulativeDifficultyResponse, error)
- func (ps *P2PServerService) GetMorePeers(ctx context.Context, _ *model.Empty) ([]*model.Node, error)
- func (ps *P2PServerService) GetNextBlockIDs(ctx context.Context, chainType chaintype.ChainType, reqLimit uint32, ...) ([]int64, error)
- func (ps *P2PServerService) GetNextBlocks(ctx context.Context, chainType chaintype.ChainType, blockID int64, ...) (*model.BlocksData, error)
- func (ps *P2PServerService) GetNodeAddressesInfo(ctx context.Context, _ *model.GetNodeAddressesInfoRequest) (*model.GetNodeAddressesInfoResponse, error)
- func (ps *P2PServerService) GetNodeProofOfOrigin(ctx context.Context, req *model.GetNodeProofOfOriginRequest) (*model.ProofOfOrigin, error)
- func (ps *P2PServerService) GetPeerInfo(ctx context.Context, _ *model.GetPeerInfoRequest) (*model.GetPeerInfoResponse, error)
- func (ps *P2PServerService) RequestBlockTransactions(ctx context.Context, chainType chaintype.ChainType, blockID int64, ...) (*model.Empty, error)
- func (ps *P2PServerService) RequestDownloadFile(ctx context.Context, snapshotHash []byte, fileChunkNames []string) (*model.FileDownloadResponse, error)
- func (ps *P2PServerService) SendBlock(ctx context.Context, chainType chaintype.ChainType, block *model.Block, ...) (*model.SendBlockResponse, error)
- func (ps *P2PServerService) SendBlockTransactions(ctx context.Context, chainType chaintype.ChainType, transactionsBytes [][]byte, ...) (*model.SendBlockTransactionsResponse, error)
- func (ps *P2PServerService) SendNodeAddressInfo(ctx context.Context, req *model.SendNodeAddressInfoRequest) (*model.Empty, error)
- func (ps *P2PServerService) SendPeers(ctx context.Context, peers []*model.Node) (*model.Empty, error)
- func (ps *P2PServerService) SendTransaction(ctx context.Context, chainType chaintype.ChainType, ...) (*model.SendTransactionResponse, error)
- type P2PServerServiceInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type P2PServerService ¶
type P2PServerService struct { NodeRegistrationService coreService.NodeRegistrationServiceInterface FileService coreService.FileServiceInterface NodeConfigurationService coreService.NodeConfigurationServiceInterface NodeAddressInfoService coreService.NodeAddressInfoServiceInterface PeerExplorer strategy.PeerExplorerStrategyInterface BlockServices map[int32]coreService.BlockServiceInterface MempoolServices map[int32]coreService.MempoolServiceInterface NodeSecretPhrase string Observer *observer.Observer FeedbackStrategy feedbacksystem.FeedbackStrategyInterface ScrambleNodeCache storage.CacheStackStorageInterface }
P2PServerService represent of P2P server service
func NewP2PServerService ¶
func NewP2PServerService( nodeRegistrationService coreService.NodeRegistrationServiceInterface, fileService coreService.FileServiceInterface, nodeConfigurationService coreService.NodeConfigurationServiceInterface, nodeAddressInfoServiceInterface coreService.NodeAddressInfoServiceInterface, peerExplorer strategy.PeerExplorerStrategyInterface, blockServices map[int32]coreService.BlockServiceInterface, mempoolServices map[int32]coreService.MempoolServiceInterface, nodeSecretPhrase string, observer *observer.Observer, feedbackStrategy feedbacksystem.FeedbackStrategyInterface, scrambleNodeCache storage.CacheStackStorageInterface, ) *P2PServerService
NewP2PServerService return new instance of P2P server service
func (P2PServerService) GetCommonMilestoneBlockIDs ¶
func (ps P2PServerService) GetCommonMilestoneBlockIDs( ctx context.Context, chainType chaintype.ChainType, lastBlockID, lastMilestoneBlockID int64, ) (*model.GetCommonMilestoneBlockIdsResponse, error)
func (*P2PServerService) GetCumulativeDifficulty ¶
func (ps *P2PServerService) GetCumulativeDifficulty( ctx context.Context, chainType chaintype.ChainType, ) (*model.GetCumulativeDifficultyResponse, error)
GetCumulativeDifficulty responds to the request of the cumulative difficulty status of a node
func (*P2PServerService) GetMorePeers ¶
func (ps *P2PServerService) GetMorePeers(ctx context.Context, _ *model.Empty) ([]*model.Node, error)
GetMorePeers contains info other peers
func (*P2PServerService) GetNextBlockIDs ¶
func (*P2PServerService) GetNextBlocks ¶
func (ps *P2PServerService) GetNextBlocks( ctx context.Context, chainType chaintype.ChainType, blockID int64, blockIDList []int64, ) (*model.BlocksData, error)
func (*P2PServerService) GetNodeAddressesInfo ¶
func (ps *P2PServerService) GetNodeAddressesInfo( ctx context.Context, _ *model.GetNodeAddressesInfoRequest, ) (*model.GetNodeAddressesInfoResponse, error)
GetNodeAddressesInfo responds to the request of peers a (pending) node address info note: since we can return one address per nodeID and node addresses can have more than one state, 'confirmed' addresses will be preferred over 'pending' when a node has both versions, when retrieving addresses from a peer
func (*P2PServerService) GetNodeProofOfOrigin ¶
func (ps *P2PServerService) GetNodeProofOfOrigin(ctx context.Context, req *model.GetNodeProofOfOriginRequest) (*model.ProofOfOrigin, error)
GetNodeProofOfOrigin generate a proof of origin to be returned to the peer that requested it
func (*P2PServerService) GetPeerInfo ¶
func (ps *P2PServerService) GetPeerInfo(ctx context.Context, _ *model.GetPeerInfoRequest) (*model.GetPeerInfoResponse, error)
GetPeerInfo responds to the request of peers a node info
func (*P2PServerService) RequestBlockTransactions ¶
func (*P2PServerService) RequestDownloadFile ¶
func (ps *P2PServerService) RequestDownloadFile( ctx context.Context, snapshotHash []byte, fileChunkNames []string, ) (*model.FileDownloadResponse, error)
func (*P2PServerService) SendBlock ¶
func (ps *P2PServerService) SendBlock( ctx context.Context, chainType chaintype.ChainType, block *model.Block, senderPublicKey []byte, ) (*model.SendBlockResponse, error)
SendBlock receive block from other node
func (*P2PServerService) SendBlockTransactions ¶
func (ps *P2PServerService) SendBlockTransactions( ctx context.Context, chainType chaintype.ChainType, transactionsBytes [][]byte, senderPublicKey []byte, ) (*model.SendBlockTransactionsResponse, error)
SendBlockTransactions receive a list of transaction from other node and calling TransactionReceived Event
func (*P2PServerService) SendNodeAddressInfo ¶
func (ps *P2PServerService) SendNodeAddressInfo(ctx context.Context, req *model.SendNodeAddressInfoRequest) (*model.Empty, error)
SendNodeAddressInfo receives a node address info from a peer
func (*P2PServerService) SendPeers ¶
func (ps *P2PServerService) SendPeers( ctx context.Context, peers []*model.Node, ) (*model.Empty, error)
SendPeers receives set of peers info from other node and put them into the unresolved peers
func (*P2PServerService) SendTransaction ¶
func (ps *P2PServerService) SendTransaction( ctx context.Context, chainType chaintype.ChainType, transactionBytes, senderPublicKey []byte, ) (*model.SendTransactionResponse, error)
SendTransaction receive transaction from other node and calling TransactionReceived Event
type P2PServerServiceInterface ¶
type P2PServerServiceInterface interface { GetNodeAddressesInfo(ctx context.Context, req *model.GetNodeAddressesInfoRequest) (*model.GetNodeAddressesInfoResponse, error) SendNodeAddressInfo(ctx context.Context, req *model.SendNodeAddressInfoRequest) (*model.Empty, error) GetNodeProofOfOrigin(ctx context.Context, req *model.GetNodeProofOfOriginRequest) (*model.ProofOfOrigin, error) GetPeerInfo(ctx context.Context, req *model.GetPeerInfoRequest) (*model.GetPeerInfoResponse, error) GetMorePeers(ctx context.Context, req *model.Empty) ([]*model.Node, error) SendPeers(ctx context.Context, peers []*model.Node) (*model.Empty, error) GetCumulativeDifficulty( ctx context.Context, chainType chaintype.ChainType, ) (*model.GetCumulativeDifficultyResponse, error) GetCommonMilestoneBlockIDs( ctx context.Context, chainType chaintype.ChainType, lastBlockID, lastMilestoneBlockID int64, ) (*model.GetCommonMilestoneBlockIdsResponse, error) GetNextBlockIDs( ctx context.Context, chainType chaintype.ChainType, reqLimit uint32, reqBlockID int64, ) ([]int64, error) GetNextBlocks( ctx context.Context, chainType chaintype.ChainType, blockID int64, blockIDList []int64, ) (*model.BlocksData, error) SendBlock( ctx context.Context, chainType chaintype.ChainType, block *model.Block, senderPublicKey []byte, ) (*model.SendBlockResponse, error) SendTransaction( ctx context.Context, chainType chaintype.ChainType, transactionBytes, senderPublicKey []byte, ) (*model.SendTransactionResponse, error) SendBlockTransactions( ctx context.Context, chainType chaintype.ChainType, transactionsBytes [][]byte, senderPublicKey []byte, ) (*model.SendBlockTransactionsResponse, error) RequestBlockTransactions( ctx context.Context, chainType chaintype.ChainType, blockID int64, transactionsIDs []int64, ) (*model.Empty, error) RequestDownloadFile(ctx context.Context, snapshotHash []byte, fileChunkNames []string) (*model.FileDownloadResponse, error) }
P2PServerServiceInterface interface that contains registered methods of P2P Server Service