Skip to main content

Setting Up Your Environment for Node.js

This guide explains how to install the necessary packages to start developing with OP_NET in a Node.js environment.

Important Note

Use TypeScript Instead of JavaScript

OP_NET development requires strict type handling to avoid runtime errors. Using JavaScript may lead to unexpected issues due to its lack of type enforcement. TypeScript is strongly recommended as it provides:

  • Type safety for all OP_NET packages.
  • Better debugging and error handling during development.

If you must use JavaScript, ensure you carefully validate all inputs and outputs, but TypeScript remains the preferred option for stability and accuracy.

Node.js Version Compatibility

Ensure you are using Node.js v22.x. Older versions or newer releases may cause compatibility issues with OP_NET packages. Check your Node.js version using:

node -v

Installing Required Packages

Install it via npm:

npm install opnet @btc-vision/transaction @btc-vision/bitcoin

For more information on each package, refer to the following links: Prerequisites.


Next Steps

Once your environment is configured, proceed to Interacting with an OP_NET Node for further guidance.