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

mec

v0.3.0

Published

This package helps to create multi-layer chains upon Ethereum Network. Also it provides easy to use nodejs API to any of consortium network and helps to manage all of them at the same time

Downloads

27

Readme

Readme is out of date

nodejs-MEC

The official repository for mec npm package. The mec package is designed to quickly deploy a MEC client in a nodejs application and quickly integrate with any service from a decentralized MEC network

Use-case

Searching for specific blockchain sub-network:

const mec = require('mec')

// mec.layer.init(your_password), by default set to 1234
mec.layer.init("1234")

mec.layer.search("signup")

Response contains interface needed to start new sub-network connection:

{
  "name": "signup",
  "enode": "enode://b61f72cb88eed0ea9c2214492186a473774a8a9bb3…[email protected]:30303",
  "address": "0xeac784b35b697740a3dc17ec59247749cc298c37",
  "abi": [
    {
      "constant":true,
      "inputs":[0],
      "name":"abidata",
      "outputs":[1],
      "payable":false,
      "stateMutability":"view",
      "type":"function"
    }, 
    {},
    {}
  ]
}

Globaly available sub-networks

mec.layer.getInterface()

Response contains all available sub-networks interfaces:

{
  "abi": [3], 
  "address": "0xeac784b35b697740a3dc17ec59247749cc298c37",
  "enode": "enode://b61f72cb88eed0ea9c2214492186a473774a8a9bb318194ac38d3900062a11a0b48d1a4e8d36e04432c2e287e485f2f30a38cc9d0230a81d8fde59724ea313fa@212.20.41.42:30303",
  "name": "signup"
},
{
  "abi": [3],
  "address": "0x1234567890123456789012345678901234567890",
  "enode": "enode://.....",
  "name": "main"
}

About abi you can read at Ethereum ABI.

Starting new connection

mec.layer.start("signup")
// mec.layer.start(name_of_subnet_you_connecting)

Successfull response means that now you can interact with sub-network applications over http/ipc/API

INFO: Successfully connected to enode://b61f72cb88eed0ea9c2214492186a473774a8a9bb318194ac38d3900062a11a0b48…d36e04432c2e287e485f2f30a38cc9d0230a81d8fde59724ea313fa@212.20.41.42:30303
INFO: Your address at signup network: 0xeac784b35b697740a3dc17ec59247749cc298c37
INFO: Ready: true

Or your may create your own sub-network blockchain:

mec.newLayer("my")
// the name you set will be used to find you globaly

Successfull response means that now you can develop or anything else with your own sub-network blockchain.

  • at development newly created sub-networks can't be found outside your computer
INFO [03-04|13:09:18] Allocated cache and file handles         database="/home/bogdan/Desktop/MEC_APP/./Blockchain/my/geth//Blockchain" cache=16 handles=16
INFO [03-04|13:09:18] Successfully wrote genesis state         database=/Blockchain                                                        hash=5ce27c…c8984e
INFO [03-04|13:09:18] Allocated cache and file handles database="/home/bogdan/Desktop/MEC_APP/./Blockchain/my/geth/light/Blockchain" cache=16 handles=16
INFO [03-04|13:09:18] Successfully wrote genesis state         database=light/Blockchain                                                        hash=5ce27c…c8984e

Successfully created new chain folder
INFO:Successfully imported accounts to my
{ node: undefined,
 network: 'my',
 port: 8545,
 server: 'http://localhost:8545' }
INFO: Your address at signup network: '0x66e42229ec5e5a940b5324757d106e0435c5f631'
INFO: Ready: true

Instalation

npm install [email protected]

Add MEC to your project

const mec = require('mec')
mec.init("1234")

API reference

develop