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

edichain

v0.0.21

Published

Provides a basic integration for ipfs (storage/distribution) and ethereum blockchain (validation/authorization) based EDIfact message exchange.

Downloads

28

Readme

EDIchain

Provides a basic integration for ipfs (storage/distribution) and ethereum blockchain (validation/authorization) based EDI message exchange. All messages are transactions represented within the blockchain. Message data is always encrypted an is not part of the blockchain transaction. Instead a hash of the encrypted content is published into the blockchain. Message data/content is distributed via ipfs.

  • Encrypted P2P Data exchange that require transaction proof (consens of transactions)
  • High-End scalability due to P2P architecture for content distribution
  • Easy integration into existing backend systems (like EDIFact)
  • Try to do a kind of Plug and Play ... (Auto-Register, Auto-Config...)

Demo

There is a cloud demo available at http://139.59.212.222:8088/ - However this is an unprotected environment to quickly see what this package/module is about.

Installation

  npm install edichain --save
  
  cd node_modules/edichain
  
  npm start

Requirement

Requires ipfs daemon to be started.

ipfs daemon

Requires geth to be started and synced blockchain.

geth --rpc --unlock "0x12345678..." --rpcapi "eth,net,web3,personal" --rpcaddr "localhost"  --rpcport "8545" console  

Usage

As module

Basic

	var cb = function() {				
		// YOUR Code to interact 			
		
	}

	var config = {
		bootstrap_callback:cb	
	}
	
	var echain = new edichain.bootstrap(config);	
			

As JSON-RPC2 service

Namespace: edichain

Exposed Methods

Configuration Options

Known Limitations

  • Runtime should not exceed 1 day as geth account unlock is limited to 86400 seconds
  • Account create is not implemented. You might use MIST to create your Ethereum account

Examples

Sending Data to (registered) Ethereum Account

	edichain.sendData("0x9707F3C9ca3C554A6E6d31B71A3C03d7017063F4","Some Data you like to send to me :)");

What happens in the background:

  1. Check if recipient "0x97..." is registered
  2. Fetch public key of recipient via ipfs using hash provided by registrar contract in blockchain
  3. Encrypt Data and store it as ipfs object
  4. Send message with hash to stored object to recipient (using registrar)

Checking and updating inbox

	edichain.updateInbox(); // Checks Blockchain for updates
	
	// edichain.messages[] holds all messages received (inc. data)
	
	// Sample on how to use messages array
	
	setInterval(function() {
	var old_inbox_length=0;
		if(edichain.messages.length!=old_inbox_length) {
				var isEncrypted=true;
				for(var i=edichain.messages.length-1;i>old_inbox_length-1;i--) {
						if(!edichain.messages[i].data) isEncrypted=false; else {
								console.log(edichain.messages[i]);
						}
				}
				if(isEncrypted) old_inbox_length=edichain.messages.length;
		}
	},1000);

How messages get processed:

  1. Check with registrar for new messages
  2. Retrieve address of message contract
  3. Retrieve hash with data using IPFS
  4. Decrypt message and validate sender
  5. Update Messages array

Transaction Log

In EDI it is all about securing transactions. In this aspect all operations this script does are visible within the blockchain.

edichain.txlog.stream({ start: -1 }).on('log', function(log) {
    console.log(log);
});

Internally this script is using winston as logger and creates a tx.log file containing all transactions for auditing.

Contributing

  • https://gitter.im/zoernert/edichain
  • https://blog.stromhaltig.de/

Release History

  • 0.0.21 Added Transaction View
  • 0.0.11 Added JSON-RPC2 Interface as sample implementation
  • 0.0.10 Maintainance Release (Fix Issue #2)
  • 0.0.9 Encapsulated IPFS cloud WORM in order to allow providers as alternative
  • 0.0.5 Updated Logger, several fixes in message handling
  • 0.0.1 Initial release