Savjee / SavjeeCoin

A simple blockchain in Javascript. For educational purposes only.
MIT License
1.74k stars 752 forks source link

TypeError: Block is not a constructor #35

Closed michael0793 closed 1 year ago

michael0793 commented 3 years ago

I get this error any fix?

TypeError: Block is not a constructor at Blockchain.createGenesisBlock (C:\Users\PC\Desktop\BLOCKCHAIN\blockchain.js:10:16) at new Blockchain (C:\Users\PC\Desktop\BLOCKCHAIN\blockchain.js:5:28) at Object. (C:\Users\PC\Desktop\BLOCKCHAIN\blockchain.js:27:19) at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10) at Module.load (node:internal/modules/cjs/loader:973:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47 PS C:\Users\PC\Desktop\BLOCKCHAIN>

embedvr commented 3 years ago

the block isn't a constructor. add a constructor

zacharyburrice commented 2 years ago

How do I add a constructor?

blackswan-03 commented 2 years ago

Here's an example from the code:

class Transaction { constructor(fromAddress, toAddress, amount) { this.fromAddress = fromAddress; this.toAddress = toAddress; this.amount = amount; }