Savjee / SavjeeCoin

A simple blockchain in Javascript. For educational purposes only.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

reward transaction not signed?

ilcasinistareloaded opened this issue · comments

Hello, the transaction rewardTx is not signed, so Transaction.signature is not set for it; this is in minePendingTransactions in blockchain.js.
Is that deliberate? Incidentally in class Transaction there is no constructor signature.

Mining rewards aren't normal transactions, they create a new supply of coins. In this implementation, they're sent from a zero address to your wallet. And since you don't have the key for the zero address, you can't properly sign that transaction. But that should not be a problem. It would be up to the network to validate that you have given yourself the correct amount of coins as a reward for mining a block.

I'm not sure what you mean with your second question. The Transaction class has a method "signTransaction", which accepts a wallet key for signing. It then stores that signature in the object itself.

OK, that makes sense. I think this issue can be closed; it might be useful to copy and paste part of your reply in the code as a comment. Thanks for the clarification and great videos!