open-index/open-npm huggingface dataset:
npm package: @leofcoin/chain
Description: Official javascript implementation
Latest version: 1.8.30

# @leofcoin/chain

> JS based chain

## Flags

- reachedOneZeroZero

<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons Licence" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.
npm package: @leofcoin/codec-format-interface
Description: TypeScript/JavaScript interface for defining and working with codec formats.
Latest version: 1.8.2

# codec-format-interface

TypeScript/JavaScript interface for defining and working with codec formats.

## Usage

```js
import FormatInterface from '@leofcoin/codec-format-interface'

class MyFormat extends FormatInterface {
  get proto() {
    return {
      key: 'value',
      hello: 'world'
    }
  }

  constructor(data) {
    super(data, { name: 'my-format', hashFormat: 'bs32' })
  }
}
```

## API

- **FormatInterface**: Base class for creating custom codec formats.
  - `constructor(data, options)`: Initialize with data and options.
  - `proto`: Getter for the protocol definition.
  - `toBs58()`, `toBs32()`, `hash()`: Encoding and hashing utilities.

## Build for Browser

### Rollup Example
```js
import resolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'

export default {
  input: 'src/index.ts',
  output: {
    dir: 'exports',
    format: 'es'
  },
  plugins: [
    resolve(),
    typescript()
  ]
}
```

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

MIT
npm package: @leofcoin/contracts
Description: The `Leofcoin` class extends the `Token` class from the `@leofcoin/standards/token.js` module. It represents a specific type of token with predefined properties.
Latest version: 0.1.16

# contracts

## Leofcoin Class

The `Leofcoin` class extends the `Token` class from the `@leofcoin/standards/token.js` module. It represents a specific type of token with predefined properties.

### Constructor

#### `constructor(state: TokenState)`

Creates an instance of the `Leofcoin` class.

##### Parameters

- `state` (TokenState): The initial state of the token.

##### Example

```typescript
import Leofcoin from './native-token'
import { TokenState } from '@leofcoin/standards/token.js'

const initialState: TokenState = {
  // Define the initial state properties here
}

const leofcoin = new Leofcoin(initialState)
```
npm package: @leofcoin/core
Description: [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) TODO: Put more badges here.
Latest version: 1.0.0

# core

[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
TODO: Put more badges here.

Leofcoin core (daemon, api and apiServer)

- 30 sec block times
- 30 sec timeout for miners (to give others a chance)

* note: blocktime/timeout could change in the future

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [Maintainers](#maintainers)
- [Contributing](#contributing)
- [License](#license)

## Install

### module
```sh
npm i --save @leafocin/core
```

### cli
```sh
npm i -g --save @leafocin/core
```

## Usage

### module
```js
import { core, api } from '@leofcoin/core'
```

### cli
```sh
leofcoin help
```

## NGINX


## Maintainers

[@vandeurenglenn](https://github.com/vandeurenglenn)

## Contributing

PRs accepted.

Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT © 2020 Vandeuren Glenn
npm package: @leofcoin/crypto
Description: a simple nodejs/web crypto api
Latest version: 0.2.37

# @leofcoin/crypto
> a simple nodejs/web crypto api
## install

## usage
```js
import {
  uint8ArrayToHex,
  arrayBufferToHex,
  hexToUint8Array,
  randombytes,
  createHash,
  encrypt,
  decrypt,
  generateAesKey,
  importAesKey,
  exportAesKey,
  encryptAes,
  decryptAes,
  generatePbkdf2,
  pbkdf2
} from '@leofcoin/crypto'
```

## checkout [breaking changes](./BREAKINGCHANGES.md)

## api

uint8ArrayToHex(uint8Array)

arrayBufferToHex(arrayBuffer)

hexToUint8Array(hex)

randombytes(length)

async createHash(data, algorithm)

async encrypt(string)

async decrypt({cipher, key, iv})

async generateAesKey(length)

async importAesKey(exported, format, length)

async exportAesKey(key, format)

async encryptAes(uint8Array, key, iv)

async decryptAes(uint8Array, key, iv)

async generatePbkdf2(password)

async pbkdf2(password, salt, iterations, length, hash)
npm package: @leofcoin/daemon
Latest version: 1.0.15

# <img src="leofcoin.png" width="48"></img> lfc-daemon


<p style="justify-content: center; align-items: center; width: 100%;display:flex;">

  <a href="https://github.com/RichardLitt/standard-readme">
    <img src="https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square">
  </a>
  
  <a href="https://npmjs.com/package/lfc-daemon">
    <img src="https://img.shields.io/npm/dt/@leofcoin/daemon?style=flat-square">
  </a>
</p>

Leofcoin daemon

TODO: Fill out long description.

## Table of Contents

- [Install](#install)
- [Usage](#usage)
- [API](#api)
- [Maintainers](#maintainers)
- [Contributing](#contributing)
- [License](#license)

## Install

```sh
npm install --save @leofcoin/daemon
```

## Usage

Spawn daemon from js
```js
import Daemon from '@leofcoin/daemon'

const daemon = new Daemon({
  // config
})
```

Spawn daemon from cli
```sh
leofcoin daemon
```

## API

## Maintainers

[@VandeurenGlenn](https://github.com/VandeurenGlenn)

## Contributing

PRs accepted.

Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT © 2020 Vandeuren Glenn
npm package: @leofcoin/dapnets
Description: ```sh npm i --save @leofcoin/dapnets ```
Author: Glenn Vandeuren
Latest version: 1.1.4

# dapnets

## install

```sh
npm i --save @leofcoin/dapnets
```

## usage
### browser

```js
import dapnets from '@leofcoin/dapnets/dist/dapnets.js';

const leofcoinNet = dapnets('leofcoin')

const weNet = dapnets('we')
```

### node

```js
import dapnets from '@leofcoin/dapnets';

const leofcoinNet = dapnets('leofcoin')

const weNet = dapnets('we')
```
npm package: @leofcoin/launch-chain
Description: > launch chain & peernet (reuses exposed transports when already running)
Latest version: 0.4.18

# lauch-chain

> launch chain & peernet (reuses exposed transports when already running)

## usage

```js
import launch from '@leofcoin/launch-chain'

const { chain, endpoints, mode } = await launch()
// chain is undefined when mode is remote
// endpoints contain urls to connect to the desired remote
// when mode is remote means an instance is already running
// when mode is direct means chain is directly available and no endpoint is needed to interact with it
```

## options

### default

```js
{
  network: 'leofcoin:peach',
  stars: ['wss://peach.leofcoin.org'],
  forceRemote: false, // when set to true only tries to connect to an external/local exposed node
  ws: {
    port: 4040,
    url: 'ws://localhost:4040'
  },
  http: {
    port: 8080,
    url: 'http://localhost:8080'
  }
}
```

### disabling options

```js
stars: [] // note that disabling stars results in no peer discovery
{
  ws: false,
  http: false
}
```

## build for browser

no prebuild are provided since the esm switch, everything is written with the browser in mind so some simple ignores are enough to build.

### rollup

```js
external: ['@koush/wrtc', '@leofcoin/endpoints/ws', '@leofcoin/endpoints/http']
```

### webpack

```js
externals: {
  '@koush/wrtc': false,
  '@leofcoin/endpoints/ws': false,
  '@leofcoin/endpoints/http': false
}
```
npm package: @leofcoin/mnemonic
Description: bip39 mnemonic
Latest version: 1.0.32

# @leofcoin/mnemonic
> bip39 mnemonic

## install
```sh
npm i -S @leofcoin/mnemonic
```

## usage
english (derfault wordlist)
```js
import Mnemonic from '@leofcoin/mnemonic'

const mnemonic = new Mnemonic()

mnemonic.generate()
```

custom wordlist
```js
import Mnemonic from '@leofcoin/mnemonic'
import words from './words.js'

const mnemonic = new Mnemonic(words)

mnemonic.generate()
```

wallet seed
```js
import Mnemonic from '@leofcoin/mnemonic'

const mnemonic = new Mnemonic()

const phrase = mnemonic.generate()
mnemonic.seedFromMnemonic(phrase)
```
npm package: @leofcoin/multi-wallet
Description: <version><codec><wallet>
Author: vandeurenglenn
Latest version: 3.1.8

# multi-wallet

[![Build Status](https://img.shields.io/travis/VandeurenGlenn/multi-wallet/master.svg?style=for-the-badge)](https://travis-ci.org/vandeurenglenn/multi-wallet)
[![npm](https://img.shields.io/npm/dt/multi-wallet.svg?style=for-the-badge)](https://www.npmjs.com/package/multi-wallet)
[![David](https://img.shields.io/david/vandeurenglenn/multi-wallet.svg?style=for-the-badge)](https://github.com/vandeurenglenn/multi-wallet)
[![npm](https://img.shields.io/npm/v/multi-wallet.svg?style=for-the-badge)](https://www.npmjs.com/package/multi-wallet)

> Identifiable wallet <version><codec><wallet>

## install
### npm
```sh
npm i multi-wallet --save
```
### yarn
```sh
yarn add multi-wallet
```

## usage
```js
import MultiWallet from 'multi-wallet';

const multi = new MultiWallet(<network>, <BIP32>).load(<bs58>);
const account = multi.account(0);
const external = account.external(0); // first external address

const internal = account.internal(0); // first internal address (used to receive change)

const signature = external.sign(<data>, <key>) // returns base58 encoded MultiSignature
const address = external.address // returns bs58check encoded address (without privateKey)

const multi2 = new MultiWallet(<network>, <BIP32>).fromAddress(address);


multi2.verify(signature, data); // returns boolean

// base58 encoded string
const exported = multi.export() // or multi.save() returns wif

// import from exported
multi.import(exported) // import wif

```
## use case
Future proof cryptocurrency wallet (wallets are versioned & each version should be supported as long as possible (with exceptions)).
In short:
- disables the need for a "fork" when changing wallet behaviour (no drop in computing power).
- nodes that aren't updated can (at least for some time) contribute to the network by handling other not updated node transactions.
- updated nodes can still handle older nodes their transactions (until some point in time or whenever an vulnerability is found.)
- flag vulnerable versions by sending a flag Message (flags are send to every node & accepted only when 3/4 off total nodes agree, this results into an lockdown off the flagged node, all other nodes will ignore it until the flagged one has updated to the needed version).


## API
TODO...

## LICENSE
Copyright (c) 2019 vandeurenglenn
npm package: @leofcoin/paper-wallet
Description: Paper wallet for leofcoin
Author: Glenn Vandeuren
Latest version: 0.1.4

# leofcoin-paper-wallet
> Leofcoin Paper Wallet Generator

## BROWSER SUPPORT
- [x] Google Chrome
- [x] Mozilla Firefox (58)*
- [ ] Microsoft Edge (generating wallet works, downloading doesn't)

****Firefox has a [bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1409992) wich prevent 
the qrcode to work as expected, this will be fixed in FF 58.***
## Install
Asuming you already have node and npm installed install live-server with
```sh
# NPM
npm install live-server --global

# Yarn
yarn global add live-server
```

## Development
### Build
```sh
npm run compile
```
### watch 
```sh
npm run watch
```
### Serve
```sh
npm run start
```
## ROADMAP
- [x] Support Leofcoin
- [ ] Support Bitcoin
- [ ] Support Litecoin
- [ ] Support other currencies (currency will be added when requested)

## License
CC-BY-NC-ND-4.0 © [Glenn Vandeuren](https://github.com/VandeurenGlenn)
npm package: @leofcoin/peernet-swarm
Description: Peernet peer searcher and connector
Author: vandeurenglenn
Latest version: 1.1.6

# peernet-swarm
> peernet peer discoverer & connector


## usage
### server
```js
import {Server} from '@leofcoin/peernet-swarm'

const network = 'leofcoin:peach'
const port = 44444

new Server(port, network)

```

### client
```js
import {Client} from '@leofcoin/peernet-swarm'

const stars = ['wss://peach.leofcoin.org']
const networkVersion = 'peach'
// wrtc object is added into glabalSpace
new Client(id, networkVersion, stars)

```

#### browser
```js
import {Client} from '@leofcoin/peernet-swarm/dist/client.browser.js'

// wrtc object is added into glabalSpace
new Client(id, networkVersion, stars)

```

## examples
events
```js
const client = new Client(id, networkVersion, stars)
// events exposed to pubsub
pubsub.subscribe('peer:data' data => console.log(data))
pubsub.subscribe('peer:joined', peer => console.log(peer))
pubsub.subscribe('peer:left', peer => console.log(peer))
pubsub.subscribe('peer:connected', peer => console.log(peer))
peernet.subscribe('peernet-shard', async message => console.log(message) // {id, data, size}
// const finished = await _handleMessage()
```

properties
```js
const client = new Client(id, network)
client.id
client.connection
client.connections // object {id: connection}

```
npm package: @leofcoin/project-deploy
Description: ```sh npm i -g @leofcoin/project-deploy ```
Latest version: 1.3.3

#project-deploy

## install
### cli usage
```sh
npm i -g @leofcoin/project-deploy
```

### module usage
```sh
npm i --save @leofcoin/project-deploy
```
## examples
### config
project-deploy.config.json
```json
{
  "deploy": {
    "contracts/TestContract.sol": ["0x4eCfe05bAe2535f13a92A16E60Be1b68BdEDEDb7"]
  },
  "autoFix": true,
  "license": "MIT",
  "networks": {
    "binance-smartchain-testnet": {
      "rpcUrl": "https://data-seed-prebsc-1-s1.binance.org:8545",
      "chainId": 97
    },
    "binance-smartchain": {
      "rpcUrl": "https://bsc-dataseed.binance.org",
      "chainId": 56
    },
    "goerli": {
      "rpcUrl": "https://goerli.prylabs.net",
      "chainId": "5"
    }
  }
}
```

### solc
When using another solc verion then the package uses, install the desired version yourself with
```
npm i solc@0.8.10
```

### .env
```
binance-smartchain-testnet_PRIVATE_KEY="...."
goerli_PRIVATE_KEY="...."
```

### secure-securenv
```
npx secure-env .env -s mySecretPassword
```

#### using config file in project folder and cli (with secure-env)
Checkout [secure-env](https://www.npmjs.com/package/secure-env) to learn more
```sh
project-deploy --network goerli --secret mySecretPassword
```

#### using config file in project folder and cli (without secure-env)
Fallsback to dotenv
```sh
project-deploy --network goerli
```


#### using config file in project and module deployment for more advanced setups

```js
import deploy from 'project-deploy.js';

const testContract = await deploy('contracts/TestContract.sol', ["0x4eCfe05bAe2535f13a92A16E60Be1b68BdEDEDb7"], 'goerli', 'mySecretPassword')

const anotherContract = await deploy('contracts/AnotherContract.sol', [testContract.address], 'goerli', 'mySecretPassword')
```
npm package: @leofcoin/standards
Description: Contract standards
Latest version: 0.3.6

# standards

[![Tests](https://github.com/leofcoin/standards/actions/workflows/test.yml/badge.svg)](https://github.com/leofcoin/standards/actions/workflows/test.yml)

> Contract standards

standards used in leofcoin chain kinda like erc20's but the native coin included

## install

```sh
npm i @leofcoin/standards
```

## usage

```js
import { Token } from '@leofcoin/standards'

class myCoolToken extends Token {
  constructor(state) {
    super('myCoolToken', 'MCT', 18, state)
  }
}
```
npm package: @leofcoin/storage
Description: [![CodeQL](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml)
Latest version: 3.5.38

# LeofcoinStorage 
[![CodeQL](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/leofcoin/storage/actions/workflows/codeql-analysis.yml)

>


## install
```sh
npm i @leofcoin/storage
```

## breaking changes
[checkout](./BREAKINGCHANGES.md)

## Usage

```js
import LeofcoinStorage from '@leofcoin/storage'

const storage = new LeofcoinStorage(name, root)
await storage.init()
// stores/returns a value as uint8Array

await storage.put('hello', 'world')
(await storage.get('hello')).toString() // world
await storage.get() // [{ key: 'hello', value: 'world'}]
await storage.has('hello') // true
await storage.size() // 4
await storage.delete('hello') // bye world
```

## API

### options

name: store name<br>
root: root directory<br>

```js
new LeofcoinStorage(name, root)
```

### methods

#### get
key: path/filename<br>
returns: Promise()&lt;uint8Array&gt;

```js
storage.get(key)

const all = storage.get()
console.log(all) // [{key,value}]
```

#### put
key: path/filename<br>
value: path/filename<br>
returns: Promise()

```js
storage.put(key, value)
```

#### has
key: path/filename<br>
returns: Promise()&lt;Boolean&gt;

```js
storage.has(key)
```

#### keys
returns: Promise()&lt;Array&gt;

```js
storage.keys()
```

#### values
returns: Promise()&lt;Array&gt;

```js
storage.values(limit)
```

## build for browser
rollup
```js
import resolve from '@rollup/plugin-node-resolve'
export default [{
  input: './node_modules/@leofcoin/src/storage.js',
  output: {
    file: 'dist/storage.js',
    format: 'es'
  }
}, {
  input: './node_modules/@leofcoin/src/browser-store.js',
  output: {
    file: 'dist/browser-store.js',
    format: 'es'
  },
  plugins: [
    resolve()
  ]
}]
```
npm package: @leofcoin/webnode
Description: > An Ipfs node running on the Leofcoin network
Latest version: 1.1.7

# web-node
> An Ipfs node running on the Leofcoin network

## install
```sh
npm i --save @leofcoin/web-node
```
## usage
```js
import webNode from '@leofcoin/web-node';

(async () =>  {
  await webNode();
  // node.get(<multihash>)
  
  // window.node
  // window.repo
  // window.room
})()
```

## todo
create branch for each network
npm package: @leofcoin/whereis
Description: The whereis service running on [whereis.leofcoin.org](https://whereis.leofcoin.org)
Latest version: 1.0.4

# whereis
 > The whereis service running on [whereis.leofcoin.org](https://whereis.leofcoin.org)

## install
```sh
npm install -g --save @leofcoin/whereis
```

## usage
```sh
leofcoinWhereis start
```