Skip to main content

Getting Started

Installation

yarn add @nevermined-io/sdk

Connecting to Nevermined

Under the hood Nevermined has a set of Smart Contracts that allows Asset Providers to tokenize them and specify different access conditions. This creates Service Execution Agreements. Assets could be anything from a JPEG to a music track, from a voting right to a data set.

There are multiple environments of Nevermined available, before connecting you need to decide to which of them you want to connect and download the artifacts of that environment. You can find a full list of the environments available in the Environments section.

This will download the artifacts for the latest contracts in arbitrum-goerli and store them in a folder called ./artifacts:

 wget -c https://artifacts.nevermined.network/421613/public/contracts_v3.5.2.tar.gz -O -| tar -xz --one-top-level=./artifacts

Next we need to chose the nevermined environment we want to connect to.

import { Config } from '@nevermined-io/sdk'

const config: NeverminedOptions = {
// The web3 endpoint of the blockchain network to connect to, could be an Infura endpoint, Quicknode, or any other web3 provider
web3ProviderUri: 'https://goerli-rollup.arbitrum.io/rpc',
// The url of the marketplace api if you connect to one. It could be your own service if you run a Marketplace API
marketplaceUri: 'https://marketplace-api.goerli.nevermined.app',
// The url to a Nevermined node. It could be your own if you run a Nevermined Node
neverminedNodeUri: 'https://node.goerli.nevermined.app',
// The public address of the above Node
neverminedNodeAddress: '0x5838B5512cF9f12FE9f2beccB20eb47211F9B0bc',
// The url to access the nevermined subgraphs required to query for on-chain events
graphHttpUri: 'https://api.thegraph.com/subgraphs/name/nevermined-io/public',
// Folder where are copied the ABIs of the Nevermined Smart Contracts
artifactsFolder: './artifacts',
}
web3ProviderUri is an rpc endpoint to connect to the blockchain. You can find public links

at chainlist

artifactsFolder is the location of the artifacts that we downloaded in the previous section.

The other environment config parameters will be discussed in further sections :::

With this in place we have everything we need to connect to nevermined:

import { Nevermined } from '@nevermined-io/sdk'

const nevermined = await Nevermined.getInstance(config)

console.log(await nevermined.utils.versions.get())
// {
// sdk: {
// name: 'Sdk-js',
// version: '2.0.0',
// commit: '9d31ebc27fe6c7c8a573abd283c632e5c70e687c',
// status: 'Working',
// network: 'arbitrum-goerli',
// keeperVersion: '3.5.2',
// }