Documentation
¶
Index ¶
- Constants
- func BytesReverse(u []byte) []byte
- func BytesToInt16(b []byte) int16
- func CompareHeight(blockHeight uint64, heights []uint64) bool
- func FileExisted(filename string) bool
- func GetCompactUint(buf []byte) (uint64, uint8)
- func GetNonce() uint64
- func HexToBytes(value string) ([]byte, error)
- func IntToBytes(n int) []byte
- func IsEqualBytes(b1 []byte, b2 []byte) bool
- func SetCompactUint(num uint64) []byte
- func ToHexString(data []byte) string
- type Address
- type CompactUint
- type Fixed64
- type Inventory
- type InventoryType
- type MerkleTree
- type MerkleTreeNode
- type Uint256
Constants ¶
View Source
const ADDR_LEN = 20
View Source
const (
Decimal = 100000000
)
View Source
const UINT256_SIZE = 32
Variables ¶
This section is empty.
Functions ¶
func BytesReverse ¶
func BytesToInt16 ¶
func CompareHeight ¶
func FileExisted ¶
func GetCompactUint ¶
func HexToBytes ¶
func IntToBytes ¶
func IsEqualBytes ¶
func SetCompactUint ¶
TODO Fix the return value to the correct number
func ToHexString ¶
Types ¶
type Address ¶
func AddressFromBase58 ¶
func AddressParseFromBytes ¶
func ToCodeHash ¶
func (*Address) ToHexString ¶
type CompactUint ¶
type CompactUint struct {
// contains filtered or unexported fields
}
type Inventory ¶
type Inventory interface {
//sig.SignableData
Hash() Uint256
Verify() error
Type() InventoryType
}
TODO: temp inventory
type InventoryType ¶
type InventoryType byte
const ( TRANSACTION InventoryType = 0x01 BLOCK InventoryType = 0x02 CONSENSUS InventoryType = 0xe0 )
type MerkleTree ¶
type MerkleTree struct {
Depth uint
Root *MerkleTreeNode
}
func NewMerkleTree ¶
func NewMerkleTree(hashes []Uint256) (*MerkleTree, error)
use []Uint256 to create a new MerkleTree
type MerkleTreeNode ¶
type MerkleTreeNode struct {
Hash Uint256
Left *MerkleTreeNode
Right *MerkleTreeNode
}
func (*MerkleTreeNode) IsLeaf ¶
func (t *MerkleTreeNode) IsLeaf() bool
type Uint256 ¶
type Uint256 [UINT256_SIZE]uint8
func ComputeRoot ¶
input a []uint256, create a MerkleTree & calc the root hash
func Uint256ParseFromBytes ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.