Documentation ¶
Index ¶
- Variables
- func GetBlockFees(block *pb.Block) uint64
- func GetMinerReward(block *pb.Block) (*pb.Transaction, error)
- func GetTxCount(block *pb.Block) uint32
- func HashHeader(header *pb.Header) (multihash.Multihash, error)
- func HashTransaction(tx *pb.Transaction) (multihash.Multihash, error)
- func TransactionRoot(txs []*pb.Transaction) ([]byte, error)
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMultipleMinerRewards is returned when a block contains multiple miner rewards. ErrMultipleMinerRewards = errors.New("only one miner reward transaction is allowed per block") )
Functions ¶
func GetBlockFees ¶
GetBlockFees sums the fees from all transactions in a block.
func GetMinerReward ¶
func GetMinerReward(block *pb.Block) (*pb.Transaction, error)
GetMinerReward verifies that there is a single reward transaction in the block and returns it.
func GetTxCount ¶
GetTxCount returns the number of user transactions in a block. It skips the miner rewards.
func HashHeader ¶
HashHeader computes the hash of a given header.
func HashTransaction ¶
func HashTransaction(tx *pb.Transaction) (multihash.Multihash, error)
HashTransaction computes the hash of a given transaction.
func TransactionRoot ¶
func TransactionRoot(txs []*pb.Transaction) ([]byte, error)
TransactionRoot computes the merkle root of a set of transactions.
Types ¶
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey is a private key.
func NewPrivateKey ¶
func NewPrivateKey(privKey ic.PrivKey, keyType pb.KeyType) *PrivateKey
NewPrivateKey creates a new PrivateKey from a libp2p one.
func (PrivateKey) GetPublicKey ¶
func (k PrivateKey) GetPublicKey() *PublicKey
GetPublicKey returns the corresponding PublicKey.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey is a public key.
func NewPublicKey ¶
NewPublicKey creates a PublicKey from a libp2p one.
Click to show internal directories.
Click to hide internal directories.