From f436dacb868bf1e3c4e793d76e34bd9504c62224 Mon Sep 17 00:00:00 2001 From: "mariacarmina.cretu" Date: Mon, 19 Jun 2023 14:59:13 +0000 Subject: [PATCH] GITBOOK-548: Obtaining API Keys for Blockchain Access --- SUMMARY.md | 1 + ...btaining-api-keys-for-blockchain-access.md | 21 +++++++++++++++++++ developers/ocean.js/configuration.md | 16 ++++---------- developers/ocean.py/remote-setup.md | 2 ++ infrastructure/deploying-aquarius.md | 2 +- infrastructure/deploying-marketplace.md | 6 ++++-- infrastructure/deploying-ocean-subgraph.md | 2 +- infrastructure/deploying-provider.md | 2 +- 8 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 developers/obtaining-api-keys-for-blockchain-access.md diff --git a/SUMMARY.md b/SUMMARY.md index 543bdbc8..68f15cbd 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -53,6 +53,7 @@ * [Retrieve datatoken/data NFT addresses & Chain ID](developers/retrieve-datatoken-address.md) * [Barge](developers/barge/README.md) * [Local Setup](developers/barge/local-setup-ganache.md) + * [Obtaining API Keys for Blockchain Access](developers/obtaining-api-keys-for-blockchain-access.md) * [Build a Marketplace](developers/build-a-marketplace/README.md) * [Forking Ocean Market](developers/build-a-marketplace/forking-ocean-market.md) * [Customising a Market](developers/build-a-marketplace/customising-your-market.md) diff --git a/developers/obtaining-api-keys-for-blockchain-access.md b/developers/obtaining-api-keys-for-blockchain-access.md new file mode 100644 index 00000000..ec5be9db --- /dev/null +++ b/developers/obtaining-api-keys-for-blockchain-access.md @@ -0,0 +1,21 @@ +--- +description: 🧑🏽‍💻 Remote Development Environment for Ocean Protocol +--- + +# Obtaining API Keys for Blockchain Access + +This article points out an alternative for configuring remote networks on Ocean Protocol components: the libraries, Provider, Aquarius, Subgraph, without using Barge services. + +### Obtaining API key for Ethereum node provider + +Ocean Protocol's smart contracts are deployed on EVM-compatible networks. Using an API key provided by a third-party Ethereum node provider allows you to interact with the Ocean Protocol's smart contracts on the supported networks without requiring you to host a local node. + +Choose any API provider of your choice. Some of the commonly used are: + +* [Infura](https://infura.io/) +* [Alchemy](https://www.alchemy.com/) +* [Moralis](https://moralis.io/) + +The supported networks are listed [here](../discover/networks/). + +Let's configure the remote setup for the mentioned components in the following sections. diff --git a/developers/ocean.js/configuration.md b/developers/ocean.js/configuration.md index 11092027..4b092fb5 100644 --- a/developers/ocean.js/configuration.md +++ b/developers/ocean.js/configuration.md @@ -1,22 +1,12 @@ # Configuration -### Obtaining API key for Ethereum node provider - -Ocean Protocol's smart contracts are deployed on EVM-compatible networks. Using an API key provided by a third-party Ethereum node provider allows you to interact with the Ocean Protocol's smart contracts on the supported networks without requiring you to host a local node. - -Choose any API provider of your choice. Some of the commonly used are: - -* [Infura](https://infura.io/) -* [Alchemy](https://www.alchemy.com/) -* [Moralis](https://moralis.io/) - -The supported networks are listed [here](../../discover/networks/). +For obtaining the API keys for blockchain access and set the correct environment variables, please consult [this section](http://localhost:5000/o/mTcjMqA4ylf55anucjH8/s/zQlpIJEeu8x5yl0OLuXn/) first and after proceed with the next steps. ### Create a directory Let's start with creating a working directory where we store the environment variable file, configuration files and the scripts. -``` +```bash mkdir my-ocean-project cd my-ocean-project ``` @@ -102,10 +92,12 @@ Let's install Oceanjs library into your current project by running: {% tabs %} {% tab title="Terminal" %} +{% code overflow="wrap" %} ```bash npm init npm i @oceanprotocol/lib@latest dotenv crypto-js ethers@5.7.4 @truffle/hdwallet-provider ``` +{% endcode %} {% endtab %} {% endtabs %} diff --git a/developers/ocean.py/remote-setup.md b/developers/ocean.py/remote-setup.md index 99088358..caa2ace4 100644 --- a/developers/ocean.py/remote-setup.md +++ b/developers/ocean.py/remote-setup.md @@ -83,6 +83,8 @@ For all users: to use EWC, add the following to network-config.yaml: #### 1.5 RPCs and Infura +In order to obtain API keys for blockchain access, follow up [this document](http://localhost:5000/o/mTcjMqA4ylf55anucjH8/s/zQlpIJEeu8x5yl0OLuXn/) for tips & tricks. + The config file's default RPCs point to Infura, which require you to have an Infura account with corresponding token `WEB3_INFURA_PROJECT_ID`. **If you do have an Infura account** diff --git a/infrastructure/deploying-aquarius.md b/infrastructure/deploying-aquarius.md index 9cc67988..399cff06 100644 --- a/infrastructure/deploying-aquarius.md +++ b/infrastructure/deploying-aquarius.md @@ -12,7 +12,7 @@ Aquarius consists of two parts:\ * A server for hosting Aquarius. See [this guide](setup-server.md) on creating a server. * Docker and Docker compose are installed. Click [here](https://docs.docker.com/engine/install/) to view guide on installing docker. -* [Obtain an API key](../ocean-libraries/configuration.md#obtaining-api-key-for-ethereum-node-provider) +* [Obtain an API key](http://localhost:5000/o/mTcjMqA4ylf55anucjH8/s/zQlpIJEeu8x5yl0OLuXn/) ### Create a working directory diff --git a/infrastructure/deploying-marketplace.md b/infrastructure/deploying-marketplace.md index e54382fd..b27b565c 100644 --- a/infrastructure/deploying-marketplace.md +++ b/infrastructure/deploying-marketplace.md @@ -3,6 +3,7 @@ ### Prerequisites * A server for hosting Ocean Marketplace. See [this guide](setup-server.md) on creating a server. +* Obtain API key for wanted blockchain. See [this guide](https://app.gitbook.com/o/mTcjMqA4ylf55anucjH8/s/BTXXhmDGzR0Xgj13fyfM/\~/changes/548/developers/obtaining-api-keys-for-blockchain-access) for this. ### Push your customized Ocean Market code to your Git repository @@ -19,12 +20,13 @@ cd my-marketplace If you already created the .env file as instructed in ...(link to customize the market chapter), you can skip this step, otherwise copy the below content into the \`.env\` file. -{% code title=".env" %} +{% code title=".env" overflow="wrap" %} ``` # Update this value if your Market should use custom Aquarius NEXT_PUBLIC_METADATACACHE_URI=https://v4.aquarius.oceanprotocol.com -#NEXT_PUBLIC_INFURA_PROJECT_ID="xxx" +# Provide INFURA project ID from the obtained API key for NEXT_PUBLIC_INFURA_PROJECT_ID +#NEXT_PUBLIC_INFURA_PROJECT_ID="xxx" #NEXT_PUBLIC_MARKET_FEE_ADDRESS="0xxx" #NEXT_PUBLIC_PUBLISHER_MARKET_ORDER_FEE="1" #NEXT_PUBLIC_CONSUME_MARKET_ORDER_FEE="1" diff --git a/infrastructure/deploying-ocean-subgraph.md b/infrastructure/deploying-ocean-subgraph.md index 533c623d..254d9f29 100644 --- a/infrastructure/deploying-ocean-subgraph.md +++ b/infrastructure/deploying-ocean-subgraph.md @@ -8,7 +8,7 @@ Ocean subgraph allows querying the datatoken, dataNFT, and all event information * A server for hosting Ocean subgraph. See [this guide](setup-server.md) on creating a server. * Docker and Docker compose are installed. Click [here](https://docs.docker.com/engine/install/) to view guide on installing docker. -* [Obtain an API key](../ocean-libraries/configuration.md#obtaining-api-key-for-ethereum-node-provider) +* [Obtain an API key](https://app.gitbook.com/o/mTcjMqA4ylf55anucjH8/s/BTXXhmDGzR0Xgj13fyfM/\~/changes/548/developers/obtaining-api-keys-for-blockchain-access) ### Create a working directory diff --git a/infrastructure/deploying-provider.md b/infrastructure/deploying-provider.md index 14cb8d58..e47a41d4 100644 --- a/infrastructure/deploying-provider.md +++ b/infrastructure/deploying-provider.md @@ -20,7 +20,7 @@ In this guide, we will deploy Provider for two chains: Goerli (Ethereum test net * A server for hosting Ocean Marketplace. See [this guide](setup-server.md) for how to create a server; * Docker Compose and Docker Engine are installed and configured on the server. See [this guide](setup-server.md#install-docker-engine-and-docker-compose) for how to install these products. -* The RPC URLs and API keys for each of the networks to which the Provider will be connected. See this guide for how to obtain the URL and the API key. +* The RPC URLs and API keys for each of the networks to which the Provider will be connected. See[ this guide](https://app.gitbook.com/o/mTcjMqA4ylf55anucjH8/s/BTXXhmDGzR0Xgj13fyfM/\~/changes/548/developers/obtaining-api-keys-for-blockchain-access) for how to obtain the URL and the API key. * The private key which will be used by Provider to encrypt/decrypt URLs. ### Steps