# @proyecto-didi/didi-blockchain-manager

> Project to abstract the use of multiblockains in DIDI project

Latest version **3.0.0** (published 2022-06-08) · 0 weekly downloads

## Install

```sh
npm install @proyecto-didi/didi-blockchain-manager
pnpm add @proyecto-didi/didi-blockchain-manager
yarn add @proyecto-didi/didi-blockchain-manager
bun add @proyecto-didi/didi-blockchain-manager
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2022-06-08 |
| First published | 2020-10-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 96.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | atixlabs |
| Maintainers | farp, bitcoinar, movejasmith, tamatama |
| Keywords | didi, multiblockain |

## Links

- npm: https://www.npmjs.com/package/@proyecto-didi/didi-blockchain-manager
- Repository: https://github.com/ong-bitcoin-argentina/DIDI-SSI-Blockchain-manager
- Homepage: https://github.com/ong-bitcoin-argentina/DIDI-SSI-Blockchain-manager#readme
- Issues: https://github.com/ong-bitcoin-argentina/DIDI-SSI-Blockchain-manager/issues
- npm.io page: https://npm.io/package/@proyecto-didi/didi-blockchain-manager

## Dependencies (8)

- [web3](https://npm.io/package/web3.md) 1.4.0
- [did-jwt](https://npm.io/package/did-jwt.md) ^6.0.0
- [ethr-did](https://npm.io/package/ethr-did.md) 1.1.0
- [did-jwt-vc](https://npm.io/package/did-jwt-vc.md) ^2.1.9
- [did-resolver](https://npm.io/package/did-resolver.md) ^3.1.3
- [ethr-did-registry](https://npm.io/package/ethr-did-registry.md) 0.0.3
- [ethr-did-resolver](https://npm.io/package/ethr-did-resolver.md) 3.0.0
- [uport-credentials](https://npm.io/package/uport-credentials.md) 1.3.5

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2022-06-08
- 2.0.2 — 2021-11-05
- 2.0.1 — 2021-11-04
- 2.0.0-rc.3 — 2021-10-13
- 2.0.0-rc.2 — 2021-10-12
- 2.0.0-rc.1 — 2021-09-30
- 1.3.1 — 2021-09-10
- 1.3.0 — 2021-07-16
- 1.2.1 — 2021-07-15
- 1.2.0 — 2021-06-24
- 1.1.4 — 2021-01-05
- 1.1.5 — 2020-12-14
- 1.1.3 — 2020-12-10
- 1.1.2 — 2020-12-10
- 1.1.1 — 2020-11-11
- … 9 more at https://npm.io/package/@proyecto-didi/didi-blockchain-manager/versions

## README

# Blockchain manager

This library is intented to support multiblockchain configuration for the functionalities provided by uPort libraries ([here](https://github.com/uport-project/ethr-did-registry#contract-deployments)). 
Based on the received DID and its prefix, it will select the blockchain to connect and support the uPort functions.
Below there is a description of how to implement it.

<hr style="border:1px solid gray"> </hr>

## Class Name
**BlockchainManagerConfig**


### Parameters to instanciate the class

The class takes three parameters:
* **config**: An object containing: { gasPrice: number, providerConfig: { object: PROVIDER_CONFIG} }
* **gasSafetyValue**: A safety value to increment the gas to prevent the estimation getting short (type number)
* **gasPriceSafetyValue**: A safety value to increment the gas price for the same reason (type number)
    
**gasPrice**: It's the gas price. For testing purposes a value of 10000 can be safely used.

**providerConfig**: It's a JSON object containing the network configurations to use when receiving the DID.
The DIDs follow certain format and it should look like this:

    did:ethr:0x0d0fa2cd3813412e94597103dbf715c7afb8c038
    The above DID will route to the variable specified in mainnet

    did:ethr:lacchain:0x0d0fa2cd3813412e94597103dbf715c7afb8c038
    The above DID will route to the variable specified in lacchain

The **providerConfig** JSON must be similar to this: 

```
PROVIDER_CONFIG = {
  networks: [
    { 
      name: 'mainnet', 
      rpcUrl: BLOCKCHAIN_URL_MAIN, 
      registry: BLOCKCHAIN_CONTRACT_MAIN
    },
    {
      name: 'lacchain',
      rpcUrl: BLOCKCHAIN_URL_LAC,
      registry: BLOCKCHAIN_CONTRACT_LAC
    },
    {
      name: 'bfa',
      rpcUrl: BLOCKCHAIN_URL_BFA,
      registry: BLOCKCHAIN_CONTRACT_BFA
    },
    {
      name: 'rsk',
      rpcUrl: BLOCKCHAIN_URL_RSK,
      registry: BLOCKCHAIN_CONTRACT_RSK
    }
  ]
};
```
**NOTE 1:** It is important to put the prefix on the DID, equal to the one in the JSON name attribute in order to route right. (for mainnet, no prefix must be entered)

**NOTE 2:** All of these variables must be defined in the `.env` file in the root folder.


**Gas Increment** value to increase the gas in the transaction for safeguard. By default is 1.1 (10%). This value can be defined in 
the ENV file as *GAS_INCREMENT*

<hr style="border:1px solid gray"> </hr>

## [Library package](https://www.npmjs.com/package/@proyecto-didi/didi-blockchain-manager)

For more information about DIDI project, see the [documentation](https://docs.didi.org.ar/docs/developers/solucion/descripcion-tecnica/arquitectura-issuer)

---
_Source: https://npm.io/package/@proyecto-didi/didi-blockchain-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
