Documentation
¶
Index ¶
- func Compress(publKey ecdsa.PublicKey) string
- func GenPublicKey() string
- func GetAddress(publicKey string) string
- func Hash160(inputByte []byte) []byte
- func Hash256(inputByte []byte) []byte
- func IntToHex(num int64) []byte
- func ReverseBytes(data []byte)
- func Ripemd160Once(inputByte []byte) []byte
- func Serialize(obj any) []byte
- func Sha256Once(inputByte []byte) []byte
- type Block
- type Blockchain
- type BlockchainIterator
- type Miner
- type MinerPool
- func (mp *MinerPool) AddMiner(tokens, days int64)
- func (mp *MinerPool) Adjust(NewDiffNum uint)
- func (mp *MinerPool) Mine(b *Block) error
- func (mp *MinerPool) PrepareData(b *Block, nonce int64) []byte
- func (mp *MinerPool) ShowAllMiners()
- func (mp *MinerPool) Validate(b *Block) bool
- func (mp *MinerPool) Vote()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenPublicKey ¶
func GenPublicKey() string
func GetAddress ¶
func Ripemd160Once ¶
func Sha256Once ¶
Types ¶
type Block ¶
type Block struct {
Timestamp int64
PrevHash []byte
Hash []byte
Data []byte
Height int64
DiffNum uint
Nonce int64
Address string
Witnesses []string
}
func DeserializeBlock ¶
func NewGenesisBlock ¶
type Blockchain ¶
type Blockchain struct {
// contains filtered or unexported fields
}
func NewBlockchain ¶
func NewBlockchain(mp *MinerPool) *Blockchain
func (*Blockchain) AddBlock ¶
func (bc *Blockchain) AddBlock(data string)
func (*Blockchain) BlockChainIteration ¶
func (bc *Blockchain) BlockChainIteration()
func (*Blockchain) NewIterator ¶
func (bc *Blockchain) NewIterator() *BlockchainIterator
func (*Blockchain) ShowBlocksOfMiner ¶
func (bc *Blockchain) ShowBlocksOfMiner(address string)
type BlockchainIterator ¶
type BlockchainIterator struct {
// contains filtered or unexported fields
}
func (*BlockchainIterator) Next ¶
func (bci *BlockchainIterator) Next() *Block
type Miner ¶
func DeserializeMiner ¶
Click to show internal directories.
Click to hide internal directories.