1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00
docs/developers/ocean-cli/install.md
2023-10-11 22:22:40 +03:00

3.4 KiB

Installation and Configuration 🛠️

To get started with the Ocean CLI, follow these steps for a seamless setup:

Clone the Repository

Begin by cloning the repository. You can achieve this by executing the following command in your terminal:

$ git clone https://github.com/oceanprotocol/ocean-cli.git

Cloning the repository will create a local copy on your machine, allowing you to access and work with its contents.

Install NPM Dependencies

After successfully cloning the repository, you should install the necessary npm dependencies to ensure that the project functions correctly. This can be done with the following command:

npm install

Build the TypeScript code

To compile the TypeScript code and prepare the CLI for use, execute the following command:

npm run build

Now, let's configure the environment variables required for the CLI to function effectively. 🚀

Setting Environment Variables 🌐

To successfully configure the CLI tool, two essential steps must be undertaken: the setting of the account's private key and the definition of the desired RPC endpoint. These actions are pivotal in enabling the CLI tool to function effectively.

Private Key Configuration

The CLI tool requires the configuration of the account's 'private key'(by exporting env "PRIVATE_KEY") or a 'mnemonic'(by exporting env "MNEMONIC"). Both serve as the means by which the CLI tool establishes a connection to the associated wallet. It plays a crucial role in authenticating and authorizing operations performed by the tool. You must choose either one option or the other. The tool will not utilize both simultaneously.

export PRIVATE_KEY="XXXX"

or

export MNEMONIC="XXXX"

RPC Endpoint Specification

Additionally, it is imperative to specify the RPC endpoint that corresponds to the desired network for executing operations. The CLI tool relies on this user-provided RPC endpoint to connect to the network required for its functions. This connection to the network is vital as it enables the CLI tool to interact with the blockchain and execute operations seamlessly.

export RPC='XXXX'

Furthermore, there are additional environment variables that can be configured to enhance the flexibility and customization of the environment. These variables include options such as the metadataCache URL and Provider URL, which can be specified if you prefer to utilize a custom deployment of Aquarius or Provider in contrast to the default settings. Moreover, you have the option to provide a custom address file path if you wish to use customized smart contracts or deployments for your specific use case. Remember setting the next environment variables is optional.

export AQUARIUS_URL='XXXX'
export PROVIDER_URL='XXXX'
export ADDRESS_FILE='../path/to/your/address-file'

Usage

To explore the commands and option flags available in the Ocean CLI, simply run the following command:

npm run cli h
Available CLI commands & options

With the Ocean CLI successfully installed and configured, you're ready to dive into its capabilities and unlock the full potential of Ocean Protocol. If you encounter any issues during the setup process or have questions, feel free to seek assistance from the support team. 🌊