Documentation
¶
Overview ¶
Bitcoin-blockchain specific functions.
Index ¶
- func DownloadBlock(dir string) (string, error)
- func EnsureBlockIsAvailable(dir string) error
- func GetBlockDir() string
- func GetBlockName(dir string) string
- func HashHeader(h *Header) string
- func HashRootTransactions(transactions TransactionList) string
- func SimulDirToBlockDir(dir string) string
- type BitCoSiMessage
- type Block
- type BlockReply
- type Header
- type KeyBlock
- type MessageType
- type Parser
- type SeqNo
- type TrBlock
- type TransactionAnnouncment
- type TransactionList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadBlock ¶
DownloadBlock takes 'dir' as the directory where to download the block. It returns the downloaded file
func EnsureBlockIsAvailable ¶
EnsureBlockIsAvailable tests if the block is already downloaded, else it will download it. Finally the block will be copied to the 'simul'-provided directory for simulation.
func GetBlockDir ¶
func GetBlockDir() string
Gets the block-directory starting from the current directory - this will hold up when running it with 'simul'
func GetBlockName ¶
CheckBlockAvailable looks if the directory with the block exists or not. It takes 'dir' as the base-directory, generated from 'cothority/simul'.
func HashHeader ¶
func HashRootTransactions ¶
func HashRootTransactions(transactions TransactionList) string
func SimulDirToBlockDir ¶
SimulDirToBlockDir creates a path to the 'protocols/byzcoin/block'-dir by using 'dir' which comes from 'cothority/simul' If that directory doesn't exist, it will be created.
Types ¶
type BitCoSiMessage ¶
type BitCoSiMessage struct { ReqNo SeqNo // Request sequence number // ErrorReply *ErrorReply // Generic error reply to any request Type MessageType Treq *TransactionAnnouncment Brep *BlockReply }
func (BitCoSiMessage) MarshalBinary ¶
func (tsm BitCoSiMessage) MarshalBinary() ([]byte, error)
func (*BitCoSiMessage) UnmarshalBinary ¶
func (sm *BitCoSiMessage) UnmarshalBinary(data []byte) error
type Block ¶
type Block struct { Magic [4]byte BlockSize uint32 HeaderHash string *Header TransactionList }
func (*Block) Calculate_root ¶
func (trb *Block) Calculate_root(transactions TransactionList) (res string)
type BlockReply ¶
type BlockReply struct { SuiteStr string Timestamp int64 // The timestamp requested for the block to prove its ordering BlockLen int // Length of Block Block Block // The Block including a number of transactions MerkleRoot []byte // root of the merkle tree PrfLen int // Length of proof Prf crypto.Proof // Merkle proof of value Response abstract.Secret // Aggregate response Challenge abstract.Secret // Aggregate challenge AggCommit abstract.Point // Aggregate commitment key AggPublic abstract.Point // Aggregate public key (use for easy troubleshooting) SignatureInfo []byte // All other elements necessary }
NOTE: In order to decode correctly the proof, we need to the get the suite somehow. We could just simply add it as a field and not (un)marhsal it We'd just make sure that the suite is setup before unmarshaling.
func (BlockReply) MarshalBinary ¶
func (Treq BlockReply) MarshalBinary() ([]byte, error)
func (*BlockReply) MarshalJSON ¶
func (sr *BlockReply) MarshalJSON() ([]byte, error)
func (*BlockReply) UnmarshalBinary ¶
func (Treq *BlockReply) UnmarshalBinary(data []byte) error
func (*BlockReply) UnmarshalJSON ¶
func (sr *BlockReply) UnmarshalJSON(dataJSON []byte) error
type Header ¶
type Header struct { MerkleRoot string Parent string ParentKey string PublicKey string LeaderId net.IP }
func NewHeader ¶
func NewHeader(transactions TransactionList, parent, parentKey string) *Header
type KeyBlock ¶
type KeyBlock struct {
Block
}
func (*KeyBlock) NewKeyBlock ¶
func (*KeyBlock) NewKeyBlock(transactions TransactionList, header *Header) (tr KeyBlock)
type MessageType ¶
type MessageType int
type TrBlock ¶
type TrBlock struct {
Block
}
func NewTrBlock ¶
func NewTrBlock(transactions TransactionList, header *Header) *TrBlock
Porting to public method non related to Header / TrBlock whatsoever
func (*TrBlock) MarshalBinary ¶
func (*TrBlock) NewHeader ¶
func (t *TrBlock) NewHeader(transactions TransactionList, parent string, parentKey string) *Header
func (*TrBlock) NewTrBlock ¶
func (trb *TrBlock) NewTrBlock(transactions TransactionList, header *Header) *TrBlock
type TransactionAnnouncment ¶
type TransactionList ¶
type TransactionList struct { Txs []blkparser.Tx `json:"tx,omitempty"` TxCnt uint32 `json:"n_tx"` Fees float64 `json:"-"` }
func NewTransactionList ¶
func NewTransactionList(transactions []blkparser.Tx, n int) (tr TransactionList)
func (*TransactionList) HashSum ¶
func (tl *TransactionList) HashSum() []byte
func (*TransactionList) Print ¶
func (tran *TransactionList) Print()
Directories
¶
Path | Synopsis |
---|---|
Basically adapation from the file at https://github.com/tsileo/blkparser Copy/paste from the file at https://github.com/tsileo/blkparser Basically adapation from the file at https://github.com/tsileo/blkparser Package blkparser basically is an adaptation from a file at https://github.com/tsileo/blkparser
|
Basically adapation from the file at https://github.com/tsileo/blkparser Copy/paste from the file at https://github.com/tsileo/blkparser Basically adapation from the file at https://github.com/tsileo/blkparser Package blkparser basically is an adaptation from a file at https://github.com/tsileo/blkparser |