Documentation
¶
Index ¶
- func CheckSum(payload []byte) []byte
- func HashPubKey(pubkey []byte) []byte
- func NewKeyPair() (*ecdsa.PrivateKey, []byte)
- type BlockModel
- type TXInput
- type TXOutput
- type TransactionModel
- func (tx *TransactionModel) GetTXID() []byte
- func (tx *TransactionModel) GetTrimmedTransaction() *TransactionModel
- func (tx *TransactionModel) IsCoinbase() bool
- func (tx *TransactionModel) LoadData(db *gorm.DB) error
- func (tx *TransactionModel) SetID()
- func (tx *TransactionModel) Sign(privKey *ecdsa.PrivateKey, prevTransactions map[string]*TransactionModel)
- func (tx *TransactionModel) Verify(prevTransactions map[string]*TransactionModel) bool
- type Wallet
- type Wallets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashPubKey ¶
func NewKeyPair ¶
func NewKeyPair() (*ecdsa.PrivateKey, []byte)
Types ¶
type BlockModel ¶
type BlockModel struct { gorm.Model Timestamp int64 Transactions []*TransactionModel `gorm:"foreignkey:BlockID"` Hash string `gorm:"type:varchar(32)"` Prev uint PrevHash string `gorm:"type:varchar(32)"` Iterations int }
func (*BlockModel) GetHash ¶
func (b *BlockModel) GetHash() []byte
func (*BlockModel) GetPrevHash ¶
func (b *BlockModel) GetPrevHash() []byte
func (*BlockModel) HashTransactions ¶
func (b *BlockModel) HashTransactions() []byte
func (*BlockModel) LoadTransactions ¶
func (b *BlockModel) LoadTransactions(db *gorm.DB) []*TransactionModel
func (*BlockModel) SetHash ¶
func (b *BlockModel) SetHash()
type TXInput ¶
type TXInput struct { TxID string `gorm:"primary_key"` OtxID string Vout int Signature string PubKey string }
func (*TXInput) CanUnlockOutput ¶
func (*TXInput) GetPubKeyHashed ¶
func (*TXInput) GetSignature ¶
type TXOutput ¶
func (*TXOutput) CanBeUnlocked ¶
type TransactionModel ¶
type TransactionModel struct { BlockID uint `gorm:"foreign_key"` Txid string `gorm:"primary_key"` Vin []TXInput `gorm:"foreignkey:TxID"` Vout []TXOutput `gorm:"foreignkey:TxID"` }
func (*TransactionModel) GetTXID ¶
func (tx *TransactionModel) GetTXID() []byte
func (*TransactionModel) GetTrimmedTransaction ¶
func (tx *TransactionModel) GetTrimmedTransaction() *TransactionModel
func (*TransactionModel) IsCoinbase ¶
func (tx *TransactionModel) IsCoinbase() bool
func (*TransactionModel) SetID ¶
func (tx *TransactionModel) SetID()
func (*TransactionModel) Sign ¶
func (tx *TransactionModel) Sign(privKey *ecdsa.PrivateKey, prevTransactions map[string]*TransactionModel)
func (*TransactionModel) Verify ¶
func (tx *TransactionModel) Verify(prevTransactions map[string]*TransactionModel) bool
type Wallet ¶
func (Wallet) GetAddress ¶
func (*Wallet) GetEcdsaPrivateKey ¶
func (w *Wallet) GetEcdsaPrivateKey() *ecdsa.PrivateKey
func (*Wallet) GetPubKeyHashed ¶
type Wallets ¶
func GetWallets ¶
Click to show internal directories.
Click to hide internal directories.