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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@enchainte/sdk

v1.2.0

Published

This SDK offers all the features available in the Enchainté Toolset: - Write messages - Get messages proof - Validate proof - Get messages details

Downloads

14

Readme

Enchainté SDK - Javascript

This SDK offers all the features available in the Enchainté Toolset:

  • Write messages
  • Get messages proof
  • Validate proof
  • Get messages details

Installation

The SDK can be installed with the NPM package manager:

$ npm install @enchainte/sdk

Usage

The following examples summarize how to access the different functionalities available:

Prepare data

In order to interact with the SDK, the data should be processed through the Hash module.

There are several ways to generate a Hash:

const { Message } = require('@enchainte/sdk');

// From an object
Message.from({
    data: 'Example Data'
})

// From a hash string (hex encoded 64-chars long string)
Message.fromHash('5ac706bdef87529b22c08646b74cb98baf310a46bd21ee420814b04c71fa42b1')

// From a hex encoded string
Message.fromHex('123456789abcdef')

// From a string
Message.fromString('Example Data')

// From a Uint8Array with a lenght of 32
Message.fromUint8Array(new Uint8Array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]))

Send messages

This example shows how to send data to Enchainté

const { EnchainteClient, Message } = require('@enchainte/sdk');

const apiKey = process.env.API_KEY;

const client = new EnchainteClient(apiKey);

const messages = [
    Message.fromString('Example Data 1')
];
client.sendMessages(messages)
    .then(receipt => {
        console.log(receipt);
    })
    .catch(error => {
        console.error(error);
    });

Get messages status

This example shows how to get all the details and status of messages:

const { EnchainteClient, Message } = require('@enchainte/sdk');

const apiKey = process.env.API_KEY;

const client = new EnchainteClient(apiKey);

const messages = [
    Message.fromString('Example Data 1'),
    Message.fromString('Example Data 2'),
    Message.fromString('Example Data 3')
];
client.getMessages(messages)
    .then(receipts => {
        console.log(receipts);
    })
    .catch(error => {
        console.error(error);
    });

Wait for messages to process

This example shows how to wait for a message to be processed by Enchainté after sending it.

const { EnchainteClient, Message } = require('@enchainte/sdk');

const apiKey = process.env.API_KEY;

const client = new EnchainteClient(apiKey);

const messages = [
    Message.fromString('Example Data 1')
];

const receipts = await client.sendMessages(messages)

await client.waitAnchor(receipts[0].anchor)

Get and validate messages proof

This example shows how to get a proof for an array of messages and validate it:

const { EnchainteClient, Message } = require('@enchainte/sdk');

const apiKey = process.env.API_KEY;

const client = new EnchainteClient(apiKey);

const messages = [
    Message.fromString('Example Data 1'),
    Message.fromString('Example Data 2'),
    Message.fromString('Example Data 3')
];

client.getProof(messages)
    .then(proof => {
        let timestamp = client.verifyProof(proof);
        console.log(timestamp);
    })
    .catch(error => {
        console.error(error);
    });

Full example

This snippet shows a complete data cycle including: write, wait for message confirmation and proof retrieval and validation.

const { EnchainteClient, Message } = require('@enchainte/sdk');

// Helper function to wait some time
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

// Helper function to get a random hex string
function randHex(len) {
    const maxlen = 8;
    const min = Math.pow(16, Math.min(len, maxlen) - 1);
    const max = Math.pow(16, Math.min(len, maxlen)) - 1;
    const n = Math.floor(Math.random() * (max - min + 1)) + min;
    let r = n.toString(16);
    while (r.length < len) {
        r = r + randHex(len - maxlen);
    }
    return r;
}

async function main() {
    const apiKey = process.env.API_KEY;
    const sdk = new EnchainteClient(apiKey);

    const messages = [Message.fromString(randHex(64))];

    const sendReceipt = await sdk.sendMessages(messages);
    console.log('Write message - Successful!');

    if (!sendReceipt) {
        expect(false)
        return;
    }

    await sdk.waitAnchor(sendReceipt[0].anchor);
    console.log('Message reached Blockchain!');

    // Retrieving message proof
    const proof = await sdk.getProof(messages);
    const timestamp = await sdk.verifyProof(proof);
    if (timestamp) {
        console.log(`Message is valid - Timestamp: ${timestamp}`)
    } else {
        console.log(`Message is invalid`)
    }
}

main()
    .then(() => console.log('Finished!'))
    .catch(console.error);