Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Conversion: trytes and trits
// 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 converter module of IOTA Javascript Library (!npm install @iota/converter)
var Converter = require('@iota/converter') //loading helping converter module of iota.js library. More info:
var Trytes = "YZJEATEQ9JKLZ" //some data encoded in Trytes
console.log("Number of Trytes: %s" , Trytes.length)
var Trits = Converter.trits(Trytes) //converting Trytes to Trits
console.log("Number of trits: %s", Trits.length) //Number of trits is three times the number of trytes obviously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment