Documentation ¶
Index ¶
- Constants
- Variables
- func DateToStamp(timestamp uint64) time.Time
- func MaskString6P4(s string) string
- func MustUnpack58(data string) []byte
- func Pack58(data []byte) string
- func Unpack58(data string) ([]byte, error)
- func ValidToken(u uint16) bool
- func ValidTransaction(u uint16) bool
- func ValidWalletTag(u uint8) bool
- type Digest
- type PrivateKey
- type PublicKey
- type Signature
- type Token
- type Transaction
- type WalletTag
Constants ¶
const ( // PublicKeySize is public key length in bytes PublicKeySize = 32 // PrivateKeySize is private key length in bytes PrivateKeySize = 64 // DigestSize is digest length in bytes DigestSize = 32 // SignatureSize is signature length in bytes SignatureSize = 64 )
Variables ¶
var TokenToString = map[Token]string{ TokenMNT: "MNT", TokenGOLD: "GOLD", }
TokenToString definition
var TransactionToString = map[Transaction]string{ TransactionRegisterNode: "RegisterNodeTransaction", TransactionUnregisterNode: "UnregisterNodeTransaction", TransactionTransferAssets: "TransferAssetsTransaction", TransactionRegisterSystemWallet: "RegisterSystemWalletTransaction", TransactionUnregisterSystemWallet: "UnregisterSystemWalletTransaction", TransactionUserData: "UserDataTransaction", TransactionDistributionFee: "DistributionFeeTransaction", }
TransactionToString definition
var WalletTagToString = map[WalletTag]string{ WalletTagNode: "Node", WalletTagGenesisNode: "GenesisNode", WalletTagSupervisor: "SupervisorWallet", WalletTagOwner: "OwnerWallet", WalletTagEmission: "EmissionWallet", WalletTagData: "DataWallet", }
WalletTagToString definition
Functions ¶
func DateToStamp ¶ added in v1.1.0
DateToStamp (Sumus timestamp)
func MaskString6P4 ¶ added in v1.1.0
MaskString6P4 masks a string exposing first 6 and 4 last symbols, like: YeAHCqTJk4aFnHXGV4zaaf3dTqJkdjQzg8TJENmP3zxDMpa97 => YeAHCq***pa97
func MustUnpack58 ¶ added in v1.1.0
MustUnpack58 does the same as Unpack58, but panics on failure
Types ¶
type Digest ¶
type Digest [DigestSize]byte
Digest bytes
func BytesToDigest ¶ added in v1.1.0
BytesToDigest creates an instance from a bytes slice
func ParseDigest ¶ added in v1.1.0
ParseDigest parses an instance from Base58 string
func (Digest) MarshalJSON ¶ added in v1.0.3
MarshalJSON implements Json marshal
func (Digest) StringMask ¶ added in v1.1.0
StringMask packs the instance into 6+4 a masked Base58 string
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
PrivateKey bytes
func BytesToPrivateKey ¶ added in v1.1.0
func BytesToPrivateKey(b []byte) (PrivateKey, error)
BytesToPrivateKey creates an instance from a bytes slice
func ParsePrivateKey ¶ added in v1.1.0
func ParsePrivateKey(s string) (PrivateKey, error)
ParsePrivateKey parses an instance from Base58 string
func (PrivateKey) MarshalJSON ¶ added in v1.0.3
func (p PrivateKey) MarshalJSON() ([]byte, error)
MarshalJSON implements Json marshal
func (PrivateKey) String ¶ added in v1.0.3
func (p PrivateKey) String() string
String packs the instance into a Base58 string
func (PrivateKey) StringMask ¶ added in v1.1.0
func (p PrivateKey) StringMask() string
StringMask packs the instance into 6+4 a masked Base58 string
type PublicKey ¶
type PublicKey [PublicKeySize]byte
PublicKey bytes
func BytesToPublicKey ¶ added in v1.1.0
BytesToPublicKey creates an instance from a bytes slice
func ParsePublicKey ¶ added in v1.1.0
ParsePublicKey parses an instance from Base58 string
func (PublicKey) MarshalJSON ¶ added in v1.0.3
MarshalJSON implements Json marshal
func (PublicKey) StringMask ¶ added in v1.1.0
StringMask packs the instance into 6+4 a masked Base58 string
type Signature ¶
type Signature [SignatureSize]byte
Signature bytes
func BytesToSignature ¶ added in v1.1.0
BytesToSignature creates an instance from a bytes slice
func ParseSignature ¶ added in v1.1.0
ParseSignature parses an instance from Base58 string
func (Signature) MarshalJSON ¶ added in v1.0.3
MarshalJSON implements Json marshal
func (Signature) StringMask ¶ added in v1.1.0
StringMask packs the instance into 6+4 a masked Base58 string
type Transaction ¶
type Transaction uint16
Transaction in Sumus blockchain
const ( // TransactionRegisterNode registers a new node TransactionRegisterNode Transaction = 1 // TransactionUnregisterNode unregisters existing node TransactionUnregisterNode Transaction = 2 // TransactionTransferAssets sends token between wallets TransactionTransferAssets Transaction = 10 // TransactionRegisterSystemWallet registers system wallet TransactionRegisterSystemWallet Transaction = 3 // TransactionUnregisterSystemWallet unregisters system wallet TransactionUnregisterSystemWallet Transaction = 4 // TransactionUserData contains custom payload TransactionUserData Transaction = 7 // TransactionDistributionFee sends block fee to owner TransactionDistributionFee Transaction = 11 )
func ParseTransaction ¶
func ParseTransaction(s string) (Transaction, error)
ParseTransaction from string
type WalletTag ¶
type WalletTag uint8
WalletTag in Sumus blockchain
const ( // WalletTagNode is node wallet WalletTagNode WalletTag = iota + 1 // WalletTagGenesisNode is node wallet (TODO: clarify) WalletTagGenesisNode // WalletTagSupervisor is controller wallet who can tag other wallets WalletTagSupervisor // WalletTagOwner is a fee accumulator WalletTagOwner // WalletTagEmission emits token without a fee WalletTagEmission // WalletTagData can send UserData transactions without a fee WalletTagData )