Skip to content

A confused point about function "mine" #8

Open

Description

@jie170601

It's a good project for me who want to learn the block chain.But there's a confused point that I can't figure out,the function "mine" seems no meanings when we use the addBlock.It does not reflect the relationship between mining and block.Then I think the return value of "mine" should be nonce+solution,and assign the return value to the nonce of block.

mine(nonce: number) {
    ...
    return nonce+solution;
    ...
 }

addBlock(transaction: Transaction, senderPublicKey: string, signature: Buffer) {
    ...
    if (isValid) {
      const newBlock = new Block(this.lastBlock.hash, transaction);
      newBlock.nonce = this.mine(newBlock.nonce);
      this.chain.push(newBlock);
    }
    ....
}

Activity

  1. changed the title [-]a confused point about function "mine"[/-] [+]A confused point about function "mine"[/+] on Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions