Open shinychan95 opened 2 years ago
type Block struct {
Timestamp int64
Data []byte
PrevBlockHash []byte
Hash []byte
}
type Blockchain struct {
blocks []*Block
}
func (b *Block) SetHash()
func NewBlock(data string, prevBlockHash []byte) *Block
func (bc *BlockChanin) AddBlock(data string)
type ProofOfWork struct {
block *Block
target *big.Int
}
type Block struct {
Timestamp int64
Data []byte
PrevBlockHash []byte
Hash []byte
Nonce int
}
func NewProofOfWork(b *Block) *ProofOfWork
func (pow *ProofOfWork) prepareData(nonce int) []byte
func (pow *ProofOfWork) Run() (int, []byte
func NewBlock(data string, prevBlockHash []byte) *Block
func (pow *ProofOfWork) Validate() bool
참고 블로그