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

@iftt/icc-fpga-protocol

v1.1.13

Published

When creating new NodeJS modules, use this skeletal structure

Downloads

4

Readme

icc-fpga-protocol travis npm downloads JavaScript Style Guide

About

The IOTA Crypto Core FPGA protocol was design and created by Thomas Pototschnig. You can learn more about his work on his blog, the iota ecosystem, and all the pertaining git repos.

The original repo I used in this project to build the device and implement this protocol is here.

FPGA is an abbreviation for Field Programmable Gate Array and allows a user to program ASIC like devices. In other words, this device can find the appropriate nonce (do the Proof of Work) within an appropriate/realistic timeframe for a small IoT device to post transactions on the IOTA ledger.

Communication with the device is over USB via a serial port.

Thomas Pototschnig has created an even better (and smaller) version, which you can find here, and a blog about it here

Debug

If you need to debug this module use the string icc-fpga-protocol

DEBUG=icc-fpga-protocol node x

Install

# npm
npm install --save @iftt/icc-fpga-protocol

# yarn
yarn add @iftt/icc-fpga-protocol

How to use

Assuming you have the device plugged in and it is appropriately programmed first find the portLocation

# mac and linux
ls /dev/tty*

then creat the module

// ES6
import FpgaProtocol from '@iftt/icc-fpga-protocol'
// ES5
const FpgaProtocol = require('@iftt/icc-fpga-protocol').default

const fpgaProtocol = new FpgaProtocol('/dev/ttyUSB1') // using the default 115200 baud rate

fpga._onPortOpen = function () {
  console.log('the fpgaProtocol is ready.')
}
// ask the device to do POW for you:
fpgaProtocol.attachToTangle(trunkTransaction, branchTransaction, minWeightMagnitude, trytes, callback)

Using with the standard iota library or MAM

The standard format with the iota tangle is to push the attachToTangle forward like so:

// create IOTA instance
const IOTA = require('iota.lib.js')
const iota = new IOTA({ provider: 'https://testnet.iota.com:443' })
// create FpgaProtocol instance
const FpgaProtocol = require('iftt/icc-fpga-protocol').default
const fpgaProtocol = new FpgaProtocol('/dev/ttyUSB1')
// link the 'attachToTangle' function
iota.api.attachToTangle = (trunkTransaction, branchTransaction, minWeight, trytes, callback) => {
  fpgaProtocol.attachToTangle(trunkTransaction, branchTransaction, minWeightMagnitude, trytes, callback)
}

// .. do stuff

That's it! Your device will spit out the POW to the iota api and all is well with the world. Obviously, you need to manage the queue system yourself to ensure that multiple transactions aren't trying to use either the device or the provider while another transaction is trying to go through.

API

new FpgaProtocol (portLocation: string, baudRate?: number = 115200)

  • portLocation: string where to look for the device
  • [baudRate]: number defaults to 115200; the rate at which the device talks/listens

_onPortOpen (): void

  • null: void edit this function to know when the device is ready

attachToTangle (trunkTransaction: string, branchTransaction: string, minWeightMagnitude: number, trytes: [string], callback: Function): Promise

  • trunkTransaction: Hash (string)
  • branchTransaction: Hash (string)
  • minWeightMagnitude: number 9 for testnet; 14 for mainnet
  • trytes: [string]
  • callback: Function

Gen a random seed

# Linux
cat /dev/urandom |tr -dc A-Z9|head -c${1:-81}
# OS X
cat /dev/urandom |LC_ALL=C tr -dc 'A-Z9' | fold -w 81 | head -n 1

If you are using windows, ensure python is installed and run the examples file genRandomSeed.py OR if nodejs is installed just run the examples file keygen.js


ISC License (ISC)

Copyright 2019 Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") Copyright (c) 1995-2003 by Internet Software Consortium

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.