Setting Up Your Environment for Next.js
This guide explains how to install the necessary packages to start developing with OP_NET in a Next.js environment.
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.
You can also refer to the WalletConnect Documentation for information on connecting wallets to your Next.js application.