SavjeeCoin icon indicating copy to clipboard operation
SavjeeCoin copied to clipboard

TypeError: Block is not a constructor

Open michael0793 opened this issue 4 years ago • 3 comments

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>

michael0793 avatar Feb 09 '21 09:02 michael0793

the block isn't a constructor. add a constructor

embedvr avatar May 13 '21 04:05 embedvr

How do I add a constructor?

zacharyburrice avatar Apr 10 '22 19:04 zacharyburrice

Here's an example from the code:

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

blackswan-03 avatar Jul 22 '22 18:07 blackswan-03