On this page

Installation

3.1 Prerequisites

Before proceeding with the installation process, ensure the following prerequisites are met:

  • Node.js Installed: Ensure that Node.js is installed on your system. You can download and install Node.js from the official website.
  • IPFS Installed: Install IPFS, the InterPlanetary File System, which is utilized as the storage solution for OrbitDB. Follow the installation instructions provided on the IPFS website.

3.2 Installation Steps

To install and set up the project, follow these steps:

Install Dependencies:

All the project dependencies are in Package.json file that is installed using the following command.

Untitled
npm install 
OR
npm i
1
Copied!

Set Up IPFS:

Start the IPFS daemon:

To start the IPFS daemon, use the following command:

Untitled
ipfs daemon
1
Copied!

This command initializes the IPFS daemon, which is responsible for managing local IPFS node operations, including content storage, retrieval, and network communication.

Running IPFS daemon with Tor proxy:

To run the IPFS daemon with network traffic routed through the Tor network, use the following command:

Untitled
torsocks ipfs daemon --enable-pubsub-experiment
1
Copied!
  • torsocks: This command is used to route network traffic through the Tor network. It ensures that all network requests made by IPFS are anonymized through Tor, enhancing privacy and security.

  • --enable-pubsub-experiment: This flag enables the experimental pubsub feature in the IPFS daemon. Pubsub allows for real-time communication and event notification between IPFS nodes, facilitating decentralized applications and services.

Ensure that IPFS is running and accessible:

Before running the IPFS daemon with Tor proxy, ensure that Tor is running on your system. You can start Tor using the following command:

Untitled
sudo tor
1
Copied!

This command starts the Tor service, which acts as a proxy for routing network traffic through the Tor network. It's necessary to have Tor running to facilitate the anonymization of IPFS traffic through the Tor network.

Database Creation:

  • Within the project directory, implement code to create OrbitDB databases.
  • Create three databases: for forex, cryptocurrency, and currency data.
  • Utilize IPFS as the keystore for OrbitDB to ensure decentralized and secure storage.

Currency Conversion Logic:

  • Implement the currency conversion logic in Node.js.
  • Utilize conditional checks to determine when to update forex and cryptocurrency rates.
  • Upon meeting the update conditions, fetch the latest rates from the Open Exchange Rates API.
  • Update the respective databases with the new rates and ensure data integrity.

Merging Data and Updating Currency Database:

  • Merge the updated forex and cryptocurrency rates with the existing currency data.
  • Store the merged data in the currency database managed by OrbitDB.
  • Ensure that the currency database reflects the most recent and accurate exchange rates.

API Development:

  • Develop an API using Node.js to expose currency conversion endpoints.
  • Implement routes to handle incoming conversion requests.
  • Query the currency database to retrieve the required exchange rates for conversions.
  • Respond to client requests with the converted currency values.

Testing:

  • Thoroughly test the API endpoints to ensure proper functionality and accuracy of currency conversions.
  • Perform unit tests, integration tests, and end-to-end tests to validate the system's behavior under various scenarios.

Deployment:

  • Deploy the Node.js server and associated components to a hosting environment.
  • Ensure that the deployed system is accessible and operational.

Following these steps will enable you to successfully install, configure, and deploy the currency converter API project, leveraging Node.js, IPFS, and OrbitDB for efficient currency data management and retrieval.