Documentation ¶
Index ¶
- Constants
- Variables
- func AppendZeroes(in []byte, l int) []byte
- func BalanceKey(key [32]byte) ([]byte, error)
- func Blake2b128(in []byte) ([]byte, error)
- func BytesToHex(in []byte) string
- func BytesToStringArray(in [][]byte) []string
- func Concat(s1 []byte, s2 ...byte) []byte
- func HexToBytes(in string) ([]byte, error)
- func MustHexToBytes(in string) []byte
- func NonceKey(key [32]byte) ([]byte, error)
- func Read32Bytes(r io.Reader) ([32]byte, error)
- func ReadByte(r io.Reader) (byte, error)
- func ReadUint32(r io.Reader) (uint32, error)
- func ReadUint64(r io.Reader) (uint64, error)
- func StringArrayToBytes(in []string) [][]byte
- func StringToInts(in string) ([]int, error)
- func SwapByteNibbles(b byte) byte
- func SwapNibbles(k []byte) []byte
- func Twox128Hash(msg []byte) ([]byte, error)
- func Twox64(in []byte) ([]byte, error)
- func Uint16ToBytes(in uint16) (out []byte)
- type Address
- type Hash
- func Blake2bHash(in []byte) (Hash, error)
- func BytesToHash(b []byte) Hash
- func HexToHash(in string) (Hash, error)
- func Keccak256(in []byte) (Hash, error)
- func MustHexToHash(in string) Hash
- func NewHash(in []byte) (res Hash)
- func ReadHash(r io.Reader) (Hash, error)
- func Twox256(in []byte) (Hash, error)
- type Health
- type NetworkState
- type PeerInfo
Constants ¶
const (
// HashLength is the expected length of the common.Hash type
HashLength = 32
)
Variables ¶
var ( // BestBlockHashKey is the db location the hash of the best (unfinalized) block header. BestBlockHashKey = []byte("best_hash") // LatestStorageHashKey is the db location of the hash of the latest storage trie. LatestStorageHashKey = []byte("latest_storage_hash") // FinalizedBlockHashKey is the db location of the hash of the latest finalized block header. FinalizedBlockHashKey = []byte("finalized_head") // GenesisDataKey is the db location of the genesis data. GenesisDataKey = []byte("genesis_data") // BlockTreeKey is the db location of the encoded block tree structure. BlockTreeKey = []byte("block_tree") // LatestFinalizedRoundKey is the key where the last finalized grandpa round is stored LatestFinalizedRoundKey = []byte("latest_finalized_round") )
var ( // CodeKey is the key where runtime code is stored in the trie CodeKey = []byte(":code") )
var ErrNoPrefix = errors.New("could not byteify non 0x prefixed string")
ErrNoPrefix is returned when trying to convert a hex-encoded string with no 0x prefix
Functions ¶
func AppendZeroes ¶
AppendZeroes appends zeroes to the input byte array up until it has length l
func BalanceKey ¶
BalanceKey returns the storage trie key for the balance of the account with the given public key
func Blake2b128 ¶
Blake2b128 returns the 128-bit blake2b hash of the input data
func BytesToHex ¶
BytesToHex turns a byte slice into a 0x prefixed hex string
func BytesToStringArray ¶
BytesToStringArray turns an array of byte arrays into an array strings
func Concat ¶
Concat concatenates two byte arrays used instead of append to prevent modifying the original byte array
func HexToBytes ¶
HexToBytes turns a 0x prefixed hex string into a byte slice
func MustHexToBytes ¶ added in v0.2.0
MustHexToBytes turns a 0x prefixed hex string into a byte slice it panic if it cannot decode the string
func NonceKey ¶
NonceKey returns the storage trie key for the nonce of the account with the given public key
func Read32Bytes ¶
Read32Bytes reads 32 bytes from the reader and returns it
func ReadUint32 ¶
ReadUint32 reads a 4-byte uint32 from the reader and returns it
func ReadUint64 ¶
ReadUint64 reads an 8-byte uint32 from the reader and returns it
func StringArrayToBytes ¶
StringArrayToBytes turns an array of strings into an array of byte arrays
func StringToInts ¶
StringToInts turns a string consisting of ints separated by commas into an int array
func SwapByteNibbles ¶
SwapByteNibbles swaps the two nibbles of a byte
func SwapNibbles ¶
SwapNibbles swaps the nibbles for each byte in the byte array
func Twox128Hash ¶ added in v0.2.0
Twox128Hash computes xxHash64 twice with seeds 0 and 1 applied on given byte array
func Uint16ToBytes ¶
Uint16ToBytes converts a uint16 into a 2-byte slice
Types ¶
type Hash ¶
type Hash [32]byte
Hash used to store a blake2b hash
func Blake2bHash ¶
Blake2bHash returns the 256-bit blake2b hash of the input data
func BytesToHash ¶
BytesToHash sets b to hash. If b is larger than len(h), b will be cropped from the left.
func MustHexToHash ¶ added in v0.2.0
MustHexToHash turns a 0x prefixed hex string into type Hash it panics if it cannot turn the string into a Hash
func NewHash ¶
NewHash casts a byte array to a Hash if the input is longer than 32 bytes, it takes the first 32 bytes
type NetworkState ¶
NetworkState is network information about host needed for the rpc server and the runtime