Solution: lb_blockchain

JavaScript·1 min read·May 1, 2025

Here is the commented solution for this project.

Create the script

Create a file named lb_blockchain.js.

$ touch lb_blockchain.js

Implement the Transaction class

The objective of this part is to implement the Transaction class that represents a transfer of assets between two users of the blockchain.

  1. Declare an error class named InvalidTransactionError that inherits from the built-in Error class.

    // File: lb_blockchain.jsclass InvalidTransactionError extends Error {}
  2. Declare a class named Transaction.

    // File: lb_blockchain.js