libumi

package module
v0.0.0-...-74c7726 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 10 Imported by: 0

README

Build Status Code Coverage Scrutinizer Code Quality goreportcard Codacy Badge codebeat badge Maintainability

libumi

Documentation

Overview

Package libumi ...

Index

Constants

View Source
const (
	Genesis uint8 = iota
	Basic
	CreateStructure
	UpdateStructure
	UpdateProfitAddress
	UpdateFeeAddress
	CreateTransitAddress
	DeleteTransitAddress
)

Types.

View Source
const AddressLength = 34

AddressLength ...

View Source
const HeaderLength = 167

HeaderLength ...

View Source
const TxLength = 150

TxLength ...

Variables

View Source
var (
	ErrInvalidLength        = errors.New("invalid length")
	ErrInvalidVersion       = errors.New("invalid version")
	ErrInvalidSender        = errors.New("invalid sender")
	ErrInvalidRecipient     = errors.New("invalid recipient")
	ErrInvalidPrefix        = errors.New("invalid prefix")
	ErrInvalidProfitPercent = errors.New("invalid profit percent")
	ErrInvalidFeePercent    = errors.New("invalid fee percent")
	ErrInvalidName          = errors.New("invalid name")
	ErrInvalidSignature     = errors.New("invalid signature")
	ErrInvalidPrevHash      = errors.New("invalid previous block hash")
	ErrInvalidMerkle        = errors.New("invalid merkle root")
	ErrInvalidTx            = errors.New("invalid transaction")
	ErrNonUniqueTx          = errors.New("non-unique transaction")
)

Errors.

View Source
var ErrInvalidAddress = errors.New("invalid address")

ErrInvalidAddress ...

Functions

This section is empty.

Types

type Address

type Address []byte

Address ...

func NewAddressFromBech32

func NewAddressFromBech32(s string) (adr Address, err error)

NewAddressFromBech32 ...

func (Address) Bech32

func (a Address) Bech32() string

Bech32 ...

func (Address) Prefix

func (a Address) Prefix() string

Prefix ...

func (Address) PublicKey

func (a Address) PublicKey() []byte

PublicKey ...

func (Address) Verify

func (a Address) Verify() error

Verify ...

func (Address) Version

func (a Address) Version() uint16

Version ...

type AddressBuilder

type AddressBuilder []byte

AddressBuilder ...

func NewAddressBuilder

func NewAddressBuilder() AddressBuilder

NewAddressBuilder ...

func (AddressBuilder) Build

func (a AddressBuilder) Build() Address

Build ...

func (AddressBuilder) SetPrefix

func (a AddressBuilder) SetPrefix(s string) AddressBuilder

SetPrefix ...

func (AddressBuilder) SetPublicKey

func (a AddressBuilder) SetPublicKey(b []byte) AddressBuilder

SetPublicKey ...

func (AddressBuilder) SetVersion

func (a AddressBuilder) SetVersion(v uint16) AddressBuilder

SetVersion ...

type Block

type Block []byte

Block ...

func (Block) Hash

func (b Block) Hash() []byte

Hash ...

func (Block) MerkleRootHash

func (b Block) MerkleRootHash() []byte

MerkleRootHash ...

func (Block) PreviousBlockHash

func (b Block) PreviousBlockHash() []byte

PreviousBlockHash ...

func (Block) PublicKey

func (b Block) PublicKey() []byte

PublicKey ...

func (Block) Timestamp

func (b Block) Timestamp() uint32

Timestamp ..

func (Block) Transaction

func (b Block) Transaction(idx uint16) Transaction

Transaction ...

func (Block) TxCount

func (b Block) TxCount() uint16

TxCount ...

func (Block) Verify

func (b Block) Verify() error

Verify ...

func (Block) Version

func (b Block) Version() uint8

Version ...

type BlockBuilder

type BlockBuilder []byte

BlockBuilder ...

func NewBlockBuilder

func NewBlockBuilder() BlockBuilder

NewBlockBuilder ...

func (*BlockBuilder) AppendTransaction

func (b *BlockBuilder) AppendTransaction(t []byte)

AppendTransaction ...

func (BlockBuilder) Build

func (b BlockBuilder) Build() Block

Build ...

func (BlockBuilder) SetMerkleRootHash

func (b BlockBuilder) SetMerkleRootHash(h []byte) BlockBuilder

SetMerkleRootHash ...

func (BlockBuilder) SetPreviousBlockHash

func (b BlockBuilder) SetPreviousBlockHash(h []byte) BlockBuilder

SetPreviousBlockHash ...

func (BlockBuilder) SetPublicKey

func (b BlockBuilder) SetPublicKey(pub []byte) BlockBuilder

SetPublicKey ...

func (BlockBuilder) SetSignature

func (b BlockBuilder) SetSignature(sig []byte) BlockBuilder

SetSignature ...

func (BlockBuilder) SetTimestamp

func (b BlockBuilder) SetTimestamp(t uint32) BlockBuilder

SetTimestamp ...

func (BlockBuilder) SetTxCount

func (b BlockBuilder) SetTxCount(n uint16) BlockBuilder

SetTxCount ...

func (BlockBuilder) SetVersion

func (b BlockBuilder) SetVersion(v uint8) BlockBuilder

SetVersion ...

func (BlockBuilder) Sign

func (b BlockBuilder) Sign(sec []byte) BlockBuilder

Sign ...

func (BlockBuilder) TxCount

func (b BlockBuilder) TxCount() uint16

TxCount ...

type Transaction

type Transaction []byte

Transaction ...

func (Transaction) FeePercent

func (t Transaction) FeePercent() uint16

FeePercent ...

func (Transaction) Hash

func (t Transaction) Hash() []byte

Hash ...

func (Transaction) Name

func (t Transaction) Name() string

Name ...

func (Transaction) Nonce

func (t Transaction) Nonce() uint64

Nonce ...

func (Transaction) Prefix

func (t Transaction) Prefix() string

Prefix ...

func (Transaction) ProfitPercent

func (t Transaction) ProfitPercent() uint16

ProfitPercent ...

func (Transaction) Recipient

func (t Transaction) Recipient() Address

Recipient ...

func (Transaction) Sender

func (t Transaction) Sender() Address

Sender ...

func (Transaction) Signature

func (t Transaction) Signature() []byte

Signature ...

func (Transaction) Value

func (t Transaction) Value() uint64

Value ...

func (Transaction) Verify

func (t Transaction) Verify() error

Verify ...

func (Transaction) Version

func (t Transaction) Version() uint8

Version ...

type TransactionBuilder

type TransactionBuilder []byte

TransactionBuilder ...

func NewTransactionBuilder

func NewTransactionBuilder() TransactionBuilder

NewTransactionBuilder ...

func (TransactionBuilder) Build

func (t TransactionBuilder) Build() Transaction

Build ...

func (TransactionBuilder) SetFeePercent

func (t TransactionBuilder) SetFeePercent(p uint16) TransactionBuilder

SetFeePercent ...

func (TransactionBuilder) SetName

SetName ...

func (TransactionBuilder) SetNonce

SetNonce ...

func (TransactionBuilder) SetPrefix

SetPrefix ...

func (TransactionBuilder) SetProfitPercent

func (t TransactionBuilder) SetProfitPercent(n uint16) TransactionBuilder

SetProfitPercent ...

func (TransactionBuilder) SetRecipient

func (t TransactionBuilder) SetRecipient(a Address) TransactionBuilder

SetRecipient ...

func (TransactionBuilder) SetSender

SetSender ...

func (TransactionBuilder) SetSignature

func (t TransactionBuilder) SetSignature(sig []byte) TransactionBuilder

SetSignature ...

func (TransactionBuilder) SetValue

SetValue ...

func (TransactionBuilder) SetVersion

SetVersion ...

func (TransactionBuilder) Sign

Sign ...

Jump to

Keyboard shortcuts

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