Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Validating IOTA address
// The snippet is a part of the IOTA Developer Essentials project. You can reach it at
// Complete description and story behind the snippet is available at:
// Requirement: A checksum module of IOTA Javascript Library (!npm install @iota/checksum)
// Requirement: A validators module of IOTA Javascript Library (!npm install @iota/validators)
var iotalib = require('@iota/checksum');
var iotaValidators = require('@iota/validators');
//address including checksum
if (!iotaValidators.isAddress(InputAddr) || InputAddr.length!=90) {
console.log("Not valid input address given.");
} else {
console.log("Input address incl checksum:");
console.log("Is it valid addr based on checksum? %s", iotalib.isValidChecksum(InputAddr));
console.log("Input address excl checksum:");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment