Documentation ¶
Overview ¶
Package nano provides a number of useful types for Nano like Address and Balance. The actual implementation of the Nano protocol an be found in sub-packages.
Index ¶
- Constants
- Variables
- type Address
- type Balance
- func (b Balance) Add(n Balance) Balance
- func (b Balance) BigInt() *big.Int
- func (b Balance) Bytes(order binary.ByteOrder) []byte
- func (b Balance) Compare(n Balance) BalanceComp
- func (b Balance) Equal(b2 Balance) bool
- func (b Balance) MarshalBinary() ([]byte, error)
- func (b Balance) MarshalText() ([]byte, error)
- func (b Balance) String() string
- func (b Balance) Sub(n Balance) Balance
- func (b Balance) UnitString(unit string, precision int32) string
- func (b *Balance) UnmarshalBinary(data []byte) error
- func (b *Balance) UnmarshalText(text []byte) error
- type BalanceComp
Constants ¶
const ( // AddressLen represents the string length of a Nano address. AddressLen = 64 // AddressSize represents the binary size of a Nano address (a public key). AddressSize = ed25519.PublicKeySize // AddressPrefix is the prefix of Nano addresses. AddressPrefix = "ban_" // AddressEncodingAlphabet is Nano's custom alphabet for base32 encoding AddressEncodingAlphabet = "13456789abcdefghijkmnopqrstuwxyz" )
const ( // BalanceSize represents the size of a balance in bytes. BalanceSize = 16 BalanceMaxPrecision = 33 )
Variables ¶
var ( // AddressEncoding is a base32 encoding using NanoEncodingAlphabet as its // alphabet. AddressEncoding = base32.NewEncoding(AddressEncodingAlphabet) ErrAddressLen = errors.New("bad address length") ErrAddressPrefix = errors.New("bad address prefix") ErrAddressEncoding = errors.New("bad address encoding") ErrAddressChecksum = errors.New("bad address checksum") )
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address [AddressSize]byte
Address represents a Nano address.
func ParseAddress ¶
ParseAddress parses the given Nano address string to a public key.
func (Address) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Address) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type Balance ¶
func ParseBalance ¶
ParseBalance parses the given balance string.
func ParseBalanceInts ¶
func (Balance) Bytes ¶
Bytes returns the binary representation of this Balance with the given endianness.
func (Balance) Compare ¶
func (b Balance) Compare(n Balance) BalanceComp
func (Balance) MarshalBinary ¶
MarshalBinary implements the encoding.BinaryMarshaler interface.
func (Balance) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (Balance) String ¶
String implements the fmt.Stringer interface. It returns the balance in Mxrb with maximum precision.
func (Balance) UnitString ¶
UnitString returns a decimal representation of this uint128 converted to the given unit.
func (*Balance) UnmarshalBinary ¶
UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
func (*Balance) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type BalanceComp ¶
type BalanceComp byte
const ( BalanceCompEqual BalanceComp = iota BalanceCompBigger BalanceCompSmaller )
Directories ¶
Path | Synopsis |
---|---|
Package block provides implementations for Nano's block types.
|
Package block provides implementations for Nano's block types. |
Package crypto provides some helpful crypto functions (used internally).
|
Package crypto provides some helpful crypto functions (used internally). |
ed25519
Package ed25519 implements the Ed25519 signature algorithm.
|
Package ed25519 implements the Ed25519 signature algorithm. |
random
Package random provides some functions to securely generate random bytes and numbers.
|
Package random provides some functions to securely generate random bytes and numbers. |
internal
|
|
Package node provides a node implementation that can participate in the Nano network.
|
Package node provides a node implementation that can participate in the Nano network. |
proto
Package proto provides an implementation of the Nano network protocol.
|
Package proto provides an implementation of the Nano network protocol. |
Package store provides a storage implementation for the Nano block lattice.
|
Package store provides a storage implementation for the Nano block lattice. |
genesis
Package genesis provides the genesis constants for the live Nano network.
|
Package genesis provides the genesis constants for the live Nano network. |
Package wallet provides some helpful wallet functionality like seed generation and key derivation.
|
Package wallet provides some helpful wallet functionality like seed generation and key derivation. |