Documentation ¶
Index ¶
- Variables
- func ConfigExists(fs *fs.FileSystem) bool
- func NewAddress(data []byte) (string, error)
- type Block
- type Blockchain
- type Config
- type DB
- type NodeHost
- type StateStore
- func (sm *StateStore) HugAddLinks(ctx *txProcessCtx) error
- func (sm *StateStore) HugCreateIfNotExists(address string) error
- func (sm *StateStore) HugExists(address string) bool
- func (sm *StateStore) HugGetEtag(address string) (string, error)
- func (sm *StateStore) HugSetEtag(address string, etag string) error
- type Transaction
- func (tx *Transaction) Address() (string, error)
- func (tx *Transaction) Check() error
- func (tx *Transaction) CheckHash() error
- func (tx *Transaction) CheckLockIssuer() bool
- func (tx *Transaction) CheckLockValidator() bool
- func (tx *Transaction) HashTx()
- func (tx *Transaction) IsGenesisTx(conf *Config) bool
- func (tx *Transaction) IssuerAddress() (string, error)
- func (tx *Transaction) LockIssuer(privKey []byte, pubKey []byte) error
- func (tx *Transaction) LockValidator(privKey []byte, pubKey []byte) error
- func (tx *Transaction) ValidatorAddress() (string, error)
- type TransactionType
- type Transactions
- type TxProcessor
- type TxStore
- type Version
- type Wallet
Constants ¶
This section is empty.
Variables ¶
View Source
var GiveHugTransactionType = TransactionType("HUG")
View Source
var SpawnGenesisHugTransactionType = TransactionType("GHUG")
Functions ¶
func ConfigExists ¶
func ConfigExists(fs *fs.FileSystem) bool
func NewAddress ¶
Types ¶
type Block ¶
type Block struct { Version Version Hash []byte PrevHash []byte Timestamp int64 Transactions Transactions }
func NewGenesisBlock ¶
func NewGenesisBlock(config *Config, genesisTx *Transaction) *Block
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
func NewBlockchain ¶
func NewBlockchain(fs *fs.FileSystem, config *Config) *Blockchain
func (*Blockchain) CreateGenesisBlockIfNotExists ¶
func (bc *Blockchain) CreateGenesisBlockIfNotExists()
func (*Blockchain) ProcessTransaction ¶
func (bc *Blockchain) ProcessTransaction(tx *Transaction) error
func (*Blockchain) States ¶
func (bc *Blockchain) States() *StateStore
func (*Blockchain) Store ¶
func (bc *Blockchain) Store() *TxStore
type Config ¶
type Config struct { GenesisTx struct { Version string Timestamp int64 Hash string PubKey string Address string Lock string Data string } Paths struct { BlockDir string StatesDir string HugsDir string TxStagePath string } Blocks struct { Size int } }
func NewConfigFromFile ¶
func NewConfigFromFile(fs *fs.FileSystem) (*Config, error)
func NewConfigFromFileOrDefault ¶
func NewConfigFromFileOrDefault(fs *fs.FileSystem) (*Config, error)
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
func (*Config) WriteToFile ¶
func (c *Config) WriteToFile(fs *fs.FileSystem) error
type DB ¶
func (*DB) NewWritableTx ¶
type NodeHost ¶
type NodeHost struct {
// contains filtered or unexported fields
}
func NewNodeHost ¶
func NewNodeHost(fs *fs.FileSystem, config *Config) *NodeHost
func (*NodeHost) ProcessTransaction ¶
func (nh *NodeHost) ProcessTransaction(tx *Transaction) error
type StateStore ¶
type StateStore struct {
// contains filtered or unexported fields
}
func (*StateStore) HugAddLinks ¶
func (sm *StateStore) HugAddLinks(ctx *txProcessCtx) error
func (*StateStore) HugCreateIfNotExists ¶
func (sm *StateStore) HugCreateIfNotExists(address string) error
func (*StateStore) HugExists ¶
func (sm *StateStore) HugExists(address string) bool
func (*StateStore) HugGetEtag ¶
func (sm *StateStore) HugGetEtag(address string) (string, error)
func (*StateStore) HugSetEtag ¶
func (sm *StateStore) HugSetEtag(address string, etag string) error
type Transaction ¶
type Transaction struct { Version Version Type TransactionType Timestamp int64 Hash *utils.Base58JsonVal IssuerPubKey *utils.Base58JsonVal IssuerLock *utils.Base58JsonVal IssuerEtag string ValidatorPubKey *utils.Base58JsonVal ValidatorLock *utils.Base58JsonVal ValidatorEtag string Data *utils.Base58JsonVal }
func NewGenesisTransaction ¶
func NewGenesisTransaction(config *Config) *Transaction
func NewTransaction ¶
func NewTransaction(t TransactionType) *Transaction
func (*Transaction) Address ¶
func (tx *Transaction) Address() (string, error)
func (*Transaction) Check ¶
func (tx *Transaction) Check() error
func (*Transaction) CheckHash ¶
func (tx *Transaction) CheckHash() error
func (*Transaction) CheckLockIssuer ¶
func (tx *Transaction) CheckLockIssuer() bool
func (*Transaction) CheckLockValidator ¶
func (tx *Transaction) CheckLockValidator() bool
func (*Transaction) HashTx ¶
func (tx *Transaction) HashTx()
func (*Transaction) IsGenesisTx ¶
func (tx *Transaction) IsGenesisTx(conf *Config) bool
func (*Transaction) IssuerAddress ¶
func (tx *Transaction) IssuerAddress() (string, error)
func (*Transaction) LockIssuer ¶
func (tx *Transaction) LockIssuer(privKey []byte, pubKey []byte) error
func (*Transaction) LockValidator ¶
func (tx *Transaction) LockValidator(privKey []byte, pubKey []byte) error
func (*Transaction) ValidatorAddress ¶
func (tx *Transaction) ValidatorAddress() (string, error)
type TransactionType ¶
type TransactionType string
type Transactions ¶
type Transactions []*Transaction
type TxProcessor ¶
type TxProcessor struct {
// contains filtered or unexported fields
}
func NewTxProcessor ¶
func NewTxProcessor(fs *fs.FileSystem, config *Config) *TxProcessor
func (*TxProcessor) Process ¶
func (proc *TxProcessor) Process(tx *Transaction) error
type TxStore ¶
type TxStore struct {
// contains filtered or unexported fields
}
func (*TxStore) BlockCount ¶
func (*TxStore) CommitStagedTx ¶
func (*TxStore) StagedTxCount ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.