DeveloperBreeze

Working With Numbers In Blockchain. Development Tutorials, Guides & Insights

Unlock 1+ expert-curated working with numbers in blockchain. tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your working with numbers in blockchain. skills on DeveloperBreeze.

Working with `BigNumber` in ethers.js: A Guide for Version 6

Tutorial October 24, 2024

const num1 = BigNumber.from(10);
const num2 = BigNumber.from(5);

console.log(num1.add(num2).toString()); // "15"
console.log(num1.sub(num2).toString()); // "5"

BigNumber instances can be compared using various methods such as eq (equals), lt (less than), and gt (greater than).