common

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2018 License: LGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ADDR_LEN = 20
View Source
const (
	Decimal = 100000000
)
View Source
const UINT256_SIZE = 32

Variables

View Source
var ADDRESS_EMPTY = Address{}
View Source
var UINT256_EMPTY = Uint256{}

Functions

func BigIntFromNeoBytes

func BigIntFromNeoBytes(ba []byte) *big.Int

func BigIntToNeoBytes

func BigIntToNeoBytes(data *big.Int) []byte

func FileExisted

func FileExisted(filename string) bool

FileExisted checks whether filename exists in filesystem

func GetCompactUint

func GetCompactUint(buf []byte) (uint64, uint8)

func GetNonce

func GetNonce() uint64

GetNonce returns random nonce

func HexToBytes

func HexToBytes(value string) ([]byte, error)

HexToBytes convert hex string to []byte

func SetCompactUint

func SetCompactUint(num uint64) []byte

TODO Fix the return value to the correct number

func ToArrayReverse

func ToArrayReverse(arr []byte) []byte

func ToHexString

func ToHexString(data []byte) string

ToHexString convert []byte to hex string

Types

type Address

type Address [ADDR_LEN]byte

func AddressFromBase58

func AddressFromBase58(encoded string) (Address, error)

AddressFromBase58 returns Address from encoded base58 string

func AddressFromHexString

func AddressFromHexString(s string) (Address, error)

AddressParseFromHexString returns parsed Address

func AddressParseFromBytes

func AddressParseFromBytes(f []byte) (Address, error)

AddressParseFromBytes returns parsed Address

func (*Address) Deserialize

func (self *Address) Deserialize(r io.Reader) error

Deserialize deserialize Address from io.Reader

func (*Address) Serialize

func (self *Address) Serialize(w io.Writer) error

Serialize serialize Address into io.Writer

func (*Address) ToBase58

func (f *Address) ToBase58() string

ToBase58 returns base58 encoded address string

func (*Address) ToHexString

func (self *Address) ToHexString() string

ToHexString returns hex string representation of Address

type CompactUint

type CompactUint struct {
	// contains filtered or unexported fields
}

type Fixed64

type Fixed64 int64

the 64 bit fixed-point number, precise 10^-8

func FromDecimal

func FromDecimal(value int64) Fixed64

func (*Fixed64) Deserialize

func (f *Fixed64) Deserialize(r io.Reader) error

func (Fixed64) GetData

func (f Fixed64) GetData() int64

func (*Fixed64) Serialize

func (f *Fixed64) Serialize(w io.Writer) error

func (Fixed64) String

func (f Fixed64) String() string

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 Uint256

type Uint256 [UINT256_SIZE]byte

func ComputeMerkleRoot

func ComputeMerkleRoot(hashes []Uint256) Uint256

input a []uint256, create a merkleTree & calc the root hash

func Uint256FromHexString

func Uint256FromHexString(s string) (Uint256, error)

func Uint256ParseFromBytes

func Uint256ParseFromBytes(f []byte) (Uint256, error)

func (*Uint256) Deserialize

func (u *Uint256) Deserialize(r io.Reader) error

func (*Uint256) Serialize

func (u *Uint256) Serialize(w io.Writer) error

func (*Uint256) ToArray

func (u *Uint256) ToArray() []byte

func (*Uint256) ToHexString

func (u *Uint256) ToHexString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL