Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Feat/sdk v2 #166

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 7 additions & 19 deletions docs/architecture/building-dapps.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,7 @@ Nevermined ships different [technical components](building-blocks.md) to make th

To facilitate the utilization of Nevermined and the orchestration of all the different components, we provide the following components:

* The [Nevermined SDK](../nevermined-sdk/intro)
* The [Nevermined React Components](../react-components/intro)


:::info Which one to use

If you are building a **React application** our recommendation is to use the [Nevermined React Components](../react-components/intro), but if not to use the [Nevermined SDK](../nevermined-sdk/intro).

:::
- The [Nevermined SDK](../nevermined-sdk/intro)

From a developer point of view, the integration of Nevermined is quite straight forward. The usage of the Catalog or the SDK with the usage of any of the existing [Nevermined public environments](../environments/) facilitate the easy development of Decentralized Applications leveraging the Nevermined features.

Expand All @@ -29,21 +21,17 @@ From a developer point of view, the integration of Nevermined is quite straight

Nevermined provides the following core features that can be used to build different scenarios or use cases:

* Access Control - It is a core and cross capability of Nevermined that can be found across all the existing features. It allows to asset creators/providers to define authorization rules that are enforced and validated in a blockchain.
* Data Sharing - In Nevermined a digital asset can be registered and provide an **access** service. That service allows the download of all the files attached to the asset, when the consumer fulfills all the conditions defined by the asset creator/provider.
* Remote Computation - It allows to define scenarios where an asset owner enable the execution of an algorithm on top of existing data in a privacy preserving manner.
* Tokenization - Allows digital assets tokenization via ERC-721 or ERC-1155 NFTs. It includes the modules to facilitate secondary markets and royalties enforcement.
* Search & Discovery - Exposes the flexibility of querying for digital asset metadata attributes and the events associated with their life-cycle.
* Provenance - Tracks on-chain all the relevant actions related with the digital assets.
- Access Control - It is a core and cross capability of Nevermined that can be found across all the existing features. It allows to asset creators/providers to define authorization rules that are enforced and validated in a blockchain.
- Data Sharing - In Nevermined a digital asset can be registered and provide an **access** service. That service allows the download of all the files attached to the asset, when the consumer fulfills all the conditions defined by the asset creator/provider.
- Remote Computation - It allows to define scenarios where an asset owner enable the execution of an algorithm on top of existing data in a privacy preserving manner.
- Tokenization - Allows digital assets tokenization via ERC-721 or ERC-1155 NFTs. It includes the modules to facilitate secondary markets and royalties enforcement.
- Search & Discovery - Exposes the flexibility of querying for digital asset metadata attributes and the events associated with their life-cycle.
- Provenance - Tracks on-chain all the relevant actions related with the digital assets.

## Integration

The existence of these features allow application developers to build use cases touching one or many of the above. The best way to do that is using any of the existing libraries provided.

### Nevermined React Components

The [Nevermined React Components](../react-components/intro) is also a **NPM** library of packaged Nevermined functionalities making easier to add web3 capabilities to any existing **React application**. The Catalog uses the SDK under the hood.

### Nevermined SDK

The [Nevermined SDK](../nevermined-sdk/intro) is a **NPM** library of packaged Nevermined functionalities allowing to use all the existing functionalities in any kind of **web or stand-alone** application.
39 changes: 25 additions & 14 deletions docs/environments/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,56 @@ description: Nevermined Environments
# Nevermined Public Environments

Nevermined is available in different networks/environments for users to make use of this
infrastructure without the complexity of deploying Smart Contracts or other components of
the stack.
infrastructure without the complexity of deploying Smart Contracts or other components of the stack.

Existing networks have different characteristics related to the underlying blockchain network being used and whether they are a production or a test environment.
Existing networks have different characteristics related to the underlying blockchain network being
used and whether they are a production or a test environment.

## Blockchain networks supported

Nevermined Smart Contracts are EVM compatible so they can be deployed on any EVM compatible blockchain. Currently we support deployments on:
Nevermined Smart Contracts are EVM compatible so they can be deployed on any EVM compatible
blockchain. Currently we support deployments on:

- **Ethereum**
- **Polygon**
- **Arbitrum**

:::info

We are planning to augment the list of supported networks. If you need to use Nevermined on any other network, please let us know [through Discord](https://discord.gg/GZju2qScKq).
We are planning to augment the list of supported networks. If you need to use Nevermined on any
other network, please let us know [through Discord](https://discord.gg/GZju2qScKq).

:::

## Production and Testing environments

For each blockchain network we support actively we have Production and Testing deployments. This can help you execute a typical development/testing process and further release into production independently of the blockchain network you use.
For each blockchain network we support actively we have Production and Testing deployments. This can
help you execute a typical development/testing process and further release into production
independently of the blockchain network you use.

## Versions

We use [Semantic versioning](https://semver.org/) for our Smart Contracts interfaces and Apis. We deploy and mantain multiple versions of the contracts and APIs in these environments for integration with different versions of the stack.
We use [Semantic versioning](https://semver.org/) for our Smart Contracts interfaces and Apis. We
deploy and mantain multiple versions of the contracts and APIs in these environments for integration
with different versions of the stack.

Generally we **upgrade** Smart Contracts when we implement **patches** and **minor** changes and deploy a new version of the Smart Contracts when we implement **mayor** changes.
Generally we **upgrade** Smart Contracts when we implement **patches** and **minor** changes and
deploy a new version of the Smart Contracts when we implement **mayor** changes.

This means multiple versions of Smart Contracts for the same network and environment, allowing you to integrate either depending on your development lifecycle.
This means multiple versions of Smart Contracts for the same network and environment, allowing you
to integrate either depending on your development lifecycle.

## About the tags

Tags are different contract deployments for the same network & version. Each tag is independent from the others. Generically we use two different tags:
Tags are different contract deployments for the same network & version. Each tag is independent from
the others. Generically we use two different tags:

- `public`: This tag/contracts instane is meant to be used for new integrations, public integrations, etc... It expected to have the latest versions and/or configurations. This is a _shared_ environment. _Probably you need to use these environments._
- `public`: This tag/contracts instane is meant to be used for new integrations, public
integrations, etc... It expected to have the latest versions and/or configurations. This is a
_shared_ environment. _Probably you need to use these environments._

- `common`: This tag/contracts instane is used by more "stable" applications. Each application has its own nevermined stack (`node` + `markeplace-api`).
- `common`: This tag/contracts instane is used by more "stable" applications. Each application has
its own nevermined stack (`node` + `markeplace-api`).

import DocCardList from '@site/src/components/docCard/docCardList';
import DocCardList from '@site/src/components/docCard/docCardList'

<DocCardList />
47 changes: 23 additions & 24 deletions docs/environments/network-fees.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ description: Network Fees

# Network Fees

Nevermined provides the infrastructure to content creators and users to negotiate around their digital assets in a secure a trustless manner. All the software required to make that happen is available under an Open Source License.

To continue to provide this service, the Nevermined Smart Contracts charge a **1 % fee** on all monetary transactions. This fee is included in the distribution of rewards, when an NFT is sold.
Nevermined provides the infrastructure to content creators and users to negotiate around their
digital assets in a secure a trustless manner. All the software required to make that happen is
available under an Open Source License.

To continue to provide this service, the Nevermined Smart Contracts charge a **1 % fee** on all
monetary transactions. This fee is included in the distribution of rewards, when an NFT is sold.

:::info

There is no minimum fee, so if the asset is traded for free, it's not necessary to factor in payment.
There is no minimum fee, so if the asset is traded for free, it's not necessary to factor in
payment.

:::

## How to setup the network fees?

To execute a transaction using the Nevermined Smart Contracts it is necessary to include a comission in the reward payment. This comission goes to the **Nevermined Fee Receiver**.
To execute a transaction using the Nevermined Smart Contracts it is necessary to include a comission
in the reward payment. This comission goes to the **Nevermined Fee Receiver**.

This typically can be done when a content creator defines how payments are distributed during asset registration.
This typically can be done when a content creator defines how payments are distributed during asset
registration.

```typescript
// The fee receiver in each network can be fetched from the Nevermined Config Smart Contract
Expand All @@ -30,31 +35,25 @@ const feeReceiver = await nevermined.keeper.nvmConfig.getFeeReceiver()
const networkFee = await nevermined.keeper.nvmConfig.getNetworkFee()

const assetPrice = new AssetPrice(
new Map([
[creatorAddress, feeReceiver],
[198, 2] // 99% of the payment goes to the `creatorAddress` and 1% to `feeReceiver`
])
new Map([
[creatorAddress, feeReceiver],
[198, 2], // 99% of the payment goes to the `creatorAddress` and 1% to `feeReceiver`
]),
)

// Also network fees can be added with the `addNetworkFees` method
const assetPriceWithFees = new AssetPrice(
johnDoeAddress,
BigNumber.from(5),
zeroAddress
).addNetworkFees(
nvmFeeReceiverProd,
BigNumber.from(networkFee)
)
johnDoeAddress,
BigNumber.from(5),
zeroAddress,
).addNetworkFees(nvmFeeReceiverProd, BigNumber.from(networkFee))

// We register a NFT-721 Asset using the payment distribution defined in the `assetRewards` variable
const nftAttributes = NFTAttributes.getNFT721Instance({
metadata,
price: assetPrice,
serviceTypes: ['nft-sales', 'nft-access'],
nftContractAddress: nftContract.address
metadata,
price: assetPrice,
serviceTypes: ['nft-sales', 'nft-access'],
nftContractAddress: nftContract.address,
})
ddo = await nevermined.nfts721.create(nftAttributes, creatorAddress)

```


84 changes: 47 additions & 37 deletions docs/environments/nvm-dev-envs.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,65 @@ description: Nevermined Testnet Environments

# Testnet environments

Testnet environments are public nevermined environments deployed on public EVM-compatible testnet networks. Typically we use Polygon Mumbai.
Use [Alchemy's Mumbai Faucet](https://mumbaifaucet.com/) or [Polygon's Mumbai faucet](https://faucet.polygon.technology/) for requesting MATIC.
Testnet environments are public nevermined environments deployed on public EVM-compatible testnet
networks. Typically we use Arbitrum Goerli. Arbitrum uses ETH to confirm transactions on the
Arbitrum network. To get test tokens for the Arbitrum testnet, you first need to use a
[faucet to obtain Goerli testnet ETH](https://goerlifaucet.com/). Then you can migrate those tokens
to the Arbitrum Goerli Testnet using the
[Arbitrum bridge](https://docs.arbitrum.io/getting-started-users).

## Network Fee

You need to pay a fee to use a Nevermined environment when a payment is being done through the Smart Contracts. This needs to be configured by the content publisher. You can find more information in the [Network Fees section](network-fees.mdx).
You need to pay a fee to use a Nevermined environment when a payment is being done through the Smart
Contracts. This needs to be configured by the content publisher. You can find more information in
the [Network Fees section](network-fees.mdx).

:::info
## Arbitrum - Goerli

The network fee in Nevermined testnets is **1%** and the receiver of that fee is the **0x309039F6A4e876bE0a3FCA8c1e32292358D7f07c** address.
### Public Arbitrum Goerli deployment (v3)

:::
This is a **public** network deployment (`TAG_NAME=public`) of the Nevermined Contracts v3 in the
Arbitrum Goerli test network. You can use this network if you want to integrate with Nevermined in a
Arbitrum Testnet.

The **addresses** of the Nevermined Contracts can be found here:
https://artifacts.nevermined.network/421613/public/contracts_v3.5.2.json

## Polygon - Mumbai

### Public Mumbai deployment (v3)

This is a **public** network deployment (`TAG_NAME=public`) of the Nevermined Contracts v3 in the Polygon Mumbai network. You can use this network if you want to integrate with Nevermined in a Polygon Testnet.

The **addresses** of the Nevermined Contracts can be found here: https://artifacts.nevermined.network/80001/public/contracts_v3.0.0.json

The **ABIs of the contracts** to connect via SDK can be download from here: https://artifacts.nevermined.network/80001/public/contracts_v3.0.0.tar.gz

| Environment | Network | Contracts Version | Tag | Component | URL | Comments |
|-------------|---------|-------------------|-----|-----------|-----|----------|
| [public-v3-mumbai](https://artifacts.nevermined.network/80001/public/contracts_v3.0.0.json) | Mumbai | 3.0.0 | public | Node | https://node.mumbai.public.nevermined.network | |
| public-v3-mumbai | Mumbai | - | public | Marketplace API | https://marketplace-api.mumbai.public.nevermined.network | |
The **ABIs of the contracts** to connect via SDK can be download from here:
https://artifacts.nevermined.network/421613/public/contracts_v3.5.2.tar.gz

All the contract events are exposed via [The Graph](https://thegraph.com/). You can find all the `Polygon Mumbai` Nevermined Subgraphs here (search by Nevermined):
```typescript
const config: NeverminedOptions = {
web3ProviderUri: 'https://goerli-rollup.arbitrum.io/rpc',
marketplaceUri: 'https://marketplace-api.goerli.nevermined.app',
neverminedNodeUri: 'https://node.goerli.nevermined.app',
neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc',
graphHttpUri: 'https://api.thegraph.com/subgraphs/name/nevermined-io/public',
artifactsFolder: './artifacts',
}
```

https://thegraph.com/hosted-service

For example for Nevermined Polygon Mumbai:

https://thegraph.com/hosted-service/subgraph/nevermined-io/publicmumbaiv2neverminedtoken


## Filecoin - Hyperspace
## Polygon - Mumbai

### Public Hyperspace deployment (v3)
### Public Polygon Mumbai deployment (v3)

This is a **public** network deployment (`TAG_NAME=public`) of the Nevermined Contracts v3 in the Filecoin Hyperspace network. You can use this network if you want to integrate with Nevermined in a Filecoin FVM Testnet.
This is a **public** network deployment (`TAG_NAME=public`) of the Nevermined Contracts v3 in the
Polygon Mumbai test network. You can use this network if you want to integrate with Nevermined in a
Polygon Testnet.

The **addresses** of the Nevermined Contracts can be found here: https://artifacts.nevermined.network/3141/public/contracts_v3.0.1.json
The **addresses** of the Nevermined Contracts can be found here:
https://artifacts.nevermined.network/80001/public/contracts_v3.5.3.json

The **ABIs of the contracts** to connect via SDK can be download from here: https://artifacts.nevermined.network/3141/public/contracts_v3.0.1.tar.gz
The **ABIs of the contracts** to connect via SDK can be download from here:
https://artifacts.nevermined.network/80001/public/contracts_v3.5.3.tar.gz

| Environment | Network | Contracts Version | Tag | Component | URL | Comments |
|-------------|---------|-------------------|-----|-----------|-----|----------|
| [public-v3-hyperspace](https://artifacts.nevermined.network/3141/public/contracts_v3.0.1.json) | Hyperspace | 3.0.1 | public | Node | - | |
| public-v3-hyperspace | Hyperspace | - | public | Marketplace API | - | |
```typescript
const config: NeverminedOptions = {
web3ProviderUri: 'https://rpc-mumbai.matic.today',
marketplaceUri: 'https://marketplace-api.mumbai.nevermined.app',
neverminedNodeUri: 'https://node.mumbai.nevermined.app/',
neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc',
graphHttpUri: 'https://api.thegraph.com/subgraphs/name/nevermined-io/public',
artifactsFolder: './artifacts',
}
```
Loading