npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iotatransactioncutter

v0.1.2

Published

Zero value IOTA data transactions can only be 2187 Trytes long.

Downloads

5

Readme

iota-transaction-cutter

Zero value IOTA data transactions can only be 2187 Trytes long.

This library takes a list of transfer objects and cuts them up in such a way we can easily reconstruct the messages later.

It does this by cutting up the transaction message into different identical transactions (so tag etc stays the same). It then prefixes the transactions with 12 Trytes.

Message NR   Current Index   Message Count  Split   Remainder
99           999             99A            SPLT    AAAAAAAAAAAAA

This comes down to a potential 27 * 27 = 729 Splitted messages within a bundle. With each message having a potential 27 * 27 * 27 = 19683 Transactions in them. 19683 * 2175 = 42.810.525 Trytes per message.

This is just a means to split up an already encoded tryte message inside a transfer object. It could be placed inside one bundle but it is also possible to send them as a stream in a MAM channel or Flash channel.

NOTE: It currently only works with bundles that are created by this lib, that means it expects the order of created messages to be correct.

#Building

npm run-script-build

Building produces two files one for nodejs and one for web.

#Installation

 npm install iotatransactioncutter --save

#Usage

var cutter = require("iotatransactioncutter");
//Create messages that are too long.
var msg1 = "A".repeat(1000) + "B".repeat(1000) + "C".repeat(1000) + "D".repeat(1000) + "E".repeat(1000) + "F".repeat(1000)
var msg2 = "G".repeat(3000) + "H".repeat(500) + "I".repeat(100) + "J".repeat(3000) + "K".repeat(2000) + "L".repeat(985)
var msg3 = "M".repeat(1000) + "N".repeat(2000) + "O".repeat(1000) + "P".repeat(3000) + "Q".repeat(3000) + "R".repeat(3000)

//Mock transfer object.
var transactions = [
    { value: 0, message: msg1 },
    { value: 1, message: "" },
    { value: 0, message: msg2 },
    { value: 0, message: msg3 },

];
var cutUpTransctions = cutter.cutTransactionMessages(transactions);
var gluedTranscations = cutter.glueTransactionMessages(cutUpTransctions);
var transactionsEqual = true;

for (var i = 0; i < transactions.length; i++) {
    Object.keys(transactions[i]).forEach(key => {
        if (transactions[i][key] !== gluedTranscations[i][key]) {
            transactionsEqual = false;
        }
    })
}    
console.log("Does it equal?", transactionsEqual);