This repository is home to a proof of concept (PoC) that demonstrates the interaction between a Raspberry Pi device and the peaq network through the use of Decentralized Identifiers (DIDs). Below are comprehensive steps to guide you in setting up your Raspberry Pi for this PoC.
- A Raspberry Pi device with Pi OS installed. If Pi OS is not installed, follow the official guide to install Pi OS on your device.
Install Node Version Manager (NVM):
NVM is a version manager for Node.js, designed to be installed per-user, and invoked per-shell. Execute the following command to install NVM:
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
To ensure NVM is available in your current session, source the bashrc file with the following command:
Verify NVM Installation:
Confirm that NVM has been installed correctly by checking its version with this command:
Now install Node.js version 18.12.1 using NVM with the following command:
nvm install 18.12.1
Verify Node.js Installation:
Confirm that Node.js has been installed correctly by checking its version with this command:
Nginx is a web server which can also be used as a reverse proxy, load balancer, and HTTP cache. Install nginx by following the instructions in this tutorial.
Verify Nginx Installation:
Confirm that Nginx has been installed correctly by checking its version with this command:
Clone this repository onto your Raspberry Pi and navigate to the project directory with the following commands:
git clone https://github.com/peaqnetwork/peaq-did-raspberry-pi-poc
Install all the necessary project dependencies using npm (Node Package Manager) with this command:
PM2 is a production process manager for Node.js applications with a built-in load balancer.
Install PM2 globally using the following command:
npm install pm2@latest -g
Start the application using PM2 with this command:
pm2 start index.js
Setup PM2 Startup Script:
To ensure your application starts on system boot, execute the following command to set up a PM2 startup script:
Save PM2 Configuration:
Save the current PM2 configuration with this command:
Check DID through PM2 Log:
Verify the DID generation by checking the PM2 log with this command:
constants.js: This file houses constant values which are used across various files in the project.
generate-did.js: This script is dedicated to generating Decentralized Identifiers (DIDs).
index.js: The entry point of the application where the main logic resides.
Other utility and configuration files: These files aid in the setup and operation of the PoC, ensuring smooth interaction with the peaq network.
We welcome contributions! Feel free to fork this repository, submit issues, or open pull requests if you discover any improvements or bug fixes. Your input is invaluable in refining this PoC and enhancing its functionality.
- Setup Instructions
- Install Node Version Manager (NVM):
- Source BashRC:
- Verify NVM Installation:
- Install Node.js:
- Verify Node.js Installation:
- Install Nginx:
- Verify Nginx Installation:
- Clone Repository:
- Install Dependencies:
- Install PM2:
- Start Application:
- Setup PM2 Startup Script:
- Save PM2 Configuration:
- Check DID through PM2 Log:
- Code Structure