open-index/open-npm huggingface dataset:
npm package: @gxchain2/discv5
Description: Discovery V5
Author: ChainSafe Systems
Latest version: 0.6.4

# discv5

![ES Version](https://img.shields.io/badge/ES-2020-yellow)
![Node Version](https://img.shields.io/badge/node-12.x-green)

A TypeScript implementation of the [DiscV5](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md) protocol

## Libp2p compatibility

![Peer Discovery Compatible](https://github.com/libp2p/js-libp2p-interfaces/raw/master/src/peer-discovery/img/badge.png)

Included is a libp2p peer-discovery compatibility module.

#### Example

```typescript
import { Discv5Discovery, ENR } from "@chainsafe/discv5";
import Libp2p from "libp2p";
import PeerId from "peer-id";

const myPeerId: PeerId = ...;

const bootstrapEnrs: ENR[] = [...];

const libp2p = new Libp2p({
  peerId: myPeerId,
  modules: {
    peerDiscovery: [Discv5Discovery],
  },
  config: {
    discv5: {
      enr: ENR.createFromPeerId(myPeerInfo.id),
      bindAddr: "/ip4/0.0.0.0/udp/9000",
      bootstrapEnrs: bootstrapEnrs,
    },
  },
});

```

## License

Apache-2.0
npm package: @gxchain2/evmc
Description: Ethereum EVMC bindings for node.js
Author: Michael Wei
Latest version: 2.0.3

# ☔️🔗 EVMC bindings for node.js

This project includes node.js bindings for the [Ethereum VM Connector API](https://github.com/ethereum/evmc). It is capable of loading EVM implementations such as [aleth-interpreter](https://github.com/ethereum/aleth/tree/master/libaleth-interpreter), [evmjit](https://github.com/ethereum/evmjit) and [Hera](https://github.com/ewasm/hera) and enables interop with javascript code.

# Usage

Install evmc-js to your project using npm:
```
npm i evmc
```

You'll need to extend the provided EVMC class and implement the various abstract function calls. You'll also need to pass the path to the EVMC shared library you're targeting in the constructor. See the unit test for an example, but an abbreviated version of the class would look like:

```typescript
import {Evmc} from 'evmc';

class MyEVM extends Evmc {

async getAccountExists(account: bigint) {
    // check if account exists and return..
    return doesAccountExists(account);
}

// and so on for all the callbacks...
}
```
Callbacks can be asynchronous (i.e., return a `Promise`), or synchronous. See the [documentation](https://rainblock.github.io/evmc-js/) for full details on the API you need to implement.

When you're ready to execute, you instantiate a instance of your `Evmc` class and call the `execute` function using the message and code you with to execute, as below:

```typescript
const evm = new MyEVM(evmPath);
const result = await evm.execute(message, code));
```

Execution is asynchronous, but (for now), you should not call execute concurrently.
However, you may instantiate multiple EVMs and run them concurrently. Each EVM runs on its
own thread outside of the main event loop, so you can take full advantage of the parallelism
available on the machine.

# Roadmap

Currently, the C part of the binding could use a lot of cleanup and it does have a lot of repetitive code.

In addition, there are a lot of assertions which kill the Node process, which should probably throw an error back to javascript so the error can be handled gracefully.

Tracing is not yet supported, but could be easily added for EVMs with support.