Documentation ¶
Index ¶
- Constants
- Variables
- func Mine()
- type Block
- type BlockHeader
- type Blockchain
- func (bc *Blockchain) ValidBlock(b Block) bool
- func (bc *Blockchain) ValidGenerationTxn(t Txn) bool
- func (bc *Blockchain) ValidPaymentTxn(t Txn) bool
- func (bc *Blockchain) ValidRegisterTxn(t Txn) bool
- func (bc *Blockchain) ValidRevokeTxn(t Txn) bool
- func (bc *Blockchain) ValidTxns(b Block) bool
- func (bc *Blockchain) ValidUpdateTxn(t Txn) bool
- func (bc *Blockchain) WriteBlock(b Block) error
- type GenerationTxn
- type Identity
- type Input
- type Output
- type SVP
- type Txn
- func NewGenerationTxn(to crypto.SHA256Sum) Txn
- func NewPaymentTxn(from crypto.CertcoinPublicKey, to crypto.SHA256Sum, value uint64) Txn
- func NewRegisterTxn(onlineSecret, offlineSecret crypto.CertcoinSecretKey, ...) Txn
- func NewRevokeTxn(onlineSecret, offlineSecret crypto.CertcoinSecretKey, ...) Txn
- func NewUpdateTxn(onlineSecret, offlineSecret crypto.CertcoinSecretKey, ...) Txn
- type TxnType
Constants ¶
View Source
const (
HASH_GENESIS_BLOCK = "hwm5tjMI9ZsvG2VwNKeMtJq7PDLDvPM/hLFQ2VYdE88="
)
View Source
const (
REGISTRATION_FEE = uint64(1000)
)
View Source
const (
REVOKE_FEE = uint64(100)
)
View Source
const (
UPDATE_FEE = uint64(100)
)
Variables ¶
View Source
var ( CURRENT_DIFFICULTY = uint64(16) CURRENT_BLOCK_REWARD = uint64(50000000) )
Functions ¶
Types ¶
type Block ¶
type Block struct { Header BlockHeader `json:"header"` Txns []Txn `json:"txns"` }
func GenesisBlock ¶
func GenesisBlock() Block
type BlockHeader ¶
type BlockHeader struct { SeqNum uint64 `json:"seq_num"` PrevHash crypto.SHA256Sum `json:"prev_hash"` TxnAcc asm.AsyncAcc `json:"txn_acc"` PKIAcc asm.AsyncAcc `json:"pki_acc"` Time time.Time `json:"time"` Difficulty uint64 `json:"difficulty"` Nonce uint64 `json:"nonce:"` }
func (BlockHeader) Hash ¶
func (b BlockHeader) Hash() crypto.SHA256Sum
func (BlockHeader) Json ¶
func (b BlockHeader) Json() []byte
func (BlockHeader) ValidPoW ¶
func (bh BlockHeader) ValidPoW() bool
type Blockchain ¶
func NewBlockchain ¶
func NewBlockchain() Blockchain
func (*Blockchain) ValidBlock ¶
func (bc *Blockchain) ValidBlock(b Block) bool
func (*Blockchain) ValidGenerationTxn ¶
func (bc *Blockchain) ValidGenerationTxn(t Txn) bool
func (*Blockchain) ValidPaymentTxn ¶
func (bc *Blockchain) ValidPaymentTxn(t Txn) bool
func (*Blockchain) ValidRegisterTxn ¶
func (bc *Blockchain) ValidRegisterTxn(t Txn) bool
func (*Blockchain) ValidRevokeTxn ¶
func (bc *Blockchain) ValidRevokeTxn(t Txn) bool
func (*Blockchain) ValidTxns ¶
func (bc *Blockchain) ValidTxns(b Block) bool
func (*Blockchain) ValidUpdateTxn ¶
func (bc *Blockchain) ValidUpdateTxn(t Txn) bool
func (*Blockchain) WriteBlock ¶
func (bc *Blockchain) WriteBlock(b Block) error
type GenerationTxn ¶
type Identity ¶
func NewIdentity ¶
type Input ¶
type Input struct { PrevHash crypto.SHA256Sum `json:"hash"` PublicKey crypto.CertcoinPublicKey `json:"public"` Signature crypto.CertcoinSignature `json:"sig"` }
type SVP ¶
type SVP struct { HeaderDBPath string LastHeader BlockHeader }
func (*SVP) ValidHeader ¶
func (s *SVP) ValidHeader(header BlockHeader) bool
func (*SVP) WriteHeader ¶
func (s *SVP) WriteHeader(header BlockHeader) error
type Txn ¶
type Txn struct { Type TxnType `json:"txn_type"` Inputs []Input `json:"inputs"` Outputs []Output `json:"outputs"` }
func NewGenerationTxn ¶
func NewPaymentTxn ¶
func NewRegisterTxn ¶
func NewRegisterTxn(onlineSecret, offlineSecret crypto.CertcoinSecretKey, source crypto.CertcoinPublicKey, identity Identity) Txn
func NewRevokeTxn ¶
func NewRevokeTxn(onlineSecret, offlineSecret crypto.CertcoinSecretKey, source crypto.CertcoinPublicKey, identity Identity) Txn
func NewUpdateTxn ¶
func NewUpdateTxn(onlineSecret, offlineSecret crypto.CertcoinSecretKey, source crypto.CertcoinPublicKey, identity Identity) Txn
func (Txn) ValidNumInputs ¶
func (Txn) ValidNumOutputs ¶
Click to show internal directories.
Click to hide internal directories.