1. Install VS code at https://code.visualstudio.com/
2. Install NVM: Windows: https://github.com/coreybutler/nvm-windows Direct download link for PC: https://github.com/coreybutler/nvm-windows/releases/download/1.1.12/nvm-setup.exe
3. Open VScode, hit file, open folder, create a new folder and give the folder a name.
4. Enter a new terminal
5. Write nvm install 20.12.0
6. Write nvm use 20.12.0
What you need to start building with nodeJS (Mac)
1. Install VS code at https://code.visualstudio.com/
2. Create a new folder in VS code and open a new terminal
3. Install nvm using homebrew: (How To Guide) https://sukiphan.medium.com/how-to-install-nvm-node-version-manager-on-macos-d9fe432cc7db
4. Install NVM using Homebrew
5. Write nvm install 20.12.0
6. Write nvm use 20.12.0
1. Install the xrpl account helper by writing "npm install --save xrpl-accountlib"
2. Create a file called devwallet.js and add following code:
const lib = require("xrpl-accountlib"); console.log( "Generate: family seed (algorithm: ed25519)", lib.generate.familySeed({ algorithm: "ed25519" }) ); console.log();
3. Write node ./devwallet.js and hit enter.
4. Save your wallet and secret seed. The secret seed is sensitive information and must be stored securely, as people can steal your funds if they get their hands on it.
5. Remove the devwallet.js file, we don't want it in our project folder.
6. Import the secret seed to your Xaman wallet.
7. Activate the wallet by sending 2 XAH tokens and a little bit of extra so you can buy some evers for deploying your applications.
8. Add the Evernode trustline.
9. Purchase a small amount of EVR, 1 EVR should be enough.
You can download the Xaman wallet at the link below:
https://xumm.app/
This tutorial will show you how to install docker and how to sign up to the docker hub. Docker Hub is what you use when you want to upload your own docker images.
This tutorial will show you how to create a simple website in nodejs, deployable on Evernode.
1. Run npm init to initialize your project.
2. Install Express with npm i express.
3. Create a folder named public. This will hold your website files.
4. Inside public, create a file called index.html and add the text Hello World.
5. In the base directory (outside the public folder), create a file called index.js.
6. Open index.js and paste the server code. Note: the ports 36525, 36527, and 36529 are standard Evernode ports used for web listeners. The paths next to the optional env variables, KEY_PATH and CERT_PATH are where Evernode stores SSL certificates.
Server code:
const fs = require('fs');
const http = require('http');
const https = require('https');
const express = require('express');
const path = require('path');
const app = express();
app.use(express.static(path.join(__dirname, 'public')));
const PORTS = [36525, 36527, 36529]; // <- these are the standard evernode ports
const KEY_PATH = process.env.KEY_PATH || '/contract/cfg/tlskey.pem'; // <- this is the location for your instance ssl
const CERT_PATH = process.env.CERT_PATH || '/contract/cfg/tlscert.pem'; // <- this is the location for your instance ssl
let tlsOptions = null;
try {
if (fs.existsSync(KEY_PATH) && fs.existsSync(CERT_PATH)) {
tlsOptions = {
key: fs.readFileSync(KEY_PATH),
cert: fs.readFileSync(CERT_PATH),
};
console.log('TLS key and cert found — will start HTTPS servers.');
} else {
console.log('TLS key/cert not found — starting HTTP servers.');
}
} catch (err) {
console.error('Error reading TLS files, falling back to HTTP:', err && err.message);
tlsOptions = null;
}
const servers = PORTS.map(port => {
if (tlsOptions) {
const srv = https.createServer(tlsOptions, app).listen(port, '0.0.0.0', () => {
console.log(`HTTPS: https://localhost:${port}/`);
});
srv.on('error', e => console.error(`Port ${port} error:`, e.code || e.message));
return srv;
} else {
const srv = http.createServer(app).listen(port, '0.0.0.0', () => {
console.log(`HTTP: http://localhost:${port}/`);
});
srv.on('error', e => console.error(`Port ${port} error:`, e.code || e.message));
return srv;
}
});
7. In your terminal, make sure you’re in the same folder as index.js, then run node index.js. You’ve now started the webserver! Since it’s running locally, it will use http. On Evernode, it will use https.
8. Open your browser and go to http://localhost:36525 to view your website.
Pre-requisites:
Install NPM
Install Node.js
1. Log in to Docker using docker login and enter your DockerHub credentials.
2. In your project’s base folder, create two files: Dockerfile and start.sh.
3. Add the Dockerfile code:
FROM evernode/sashimono:hp.latest-ubt.20.04-njs.20
RUN apt update && \
apt install -y openssh-server openssl sudo bash nano curl && \
rm -rf /var/lib/apt/lists/*
#User Creation
RUN useradd -m -s /bin/bash everuser && \
#Warning, if you allow ssh connections, then do not forget to change your password from default.
echo "everuser:default" | chpasswd && \
usermod -aG sudo everuser && \
echo "everuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
RUN mkdir /var/run/sshd && \
echo "Port 22" >> /etc/ssh/sshd_config && \
echo "PermitRootLogin no" >> /etc/ssh/sshd_config && \
echo "ListenAddress 0.0.0.0" >> /etc/ssh/sshd_config
#End User Creation
#Adding the folders we use
RUN mkdir /home/everuser/public
#End adding folders
#Copying the files that we use, all files from folder name public will follow along and does not need to be specified
COPY index.js /home/everuser/index.js
COPY public /home/everuser/public
COPY node_modules /home/everuser/node_modules
COPY start.sh /start.sh
#End copying files
#Sometimes files need permissions to be ran. I am making start.sh executeable here
RUN chmod +x /start.sh
#End file permissions
WORKDIR /home/everuser
ENTRYPOINT ["/start.sh"]
4. Add the start.sh script:
#!/bin/bash
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
ssh-keygen -A
fi
sudo chown -R everuser:everuser /home/everuser
chown -R everuser:everuser /home/everuser
# start the nodejs server
/usr/bin/node /home/everuser/index.js &
# keep the shell alive
tail -f /dev/null
5. Build your Docker image with "docker build -t yourdockerhubusernname/webapp -f ./Dockerfile ."
6. Push the built image to DockerHub with "docker image push --all-tags yourdockerhubusernname/webapp"
7.A Install evdevkit with npm i evdevkit -g
7.B If you have problems installing evdevkit, then this will most likely be the solution:
Go to your startmenu, write powershell, rightclick on it and open it as admin, then write "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine" and hit enter. This will allow your computer to work with scripts, in this case the evernode development kit.
8. Generate an Evernode private key with evdevkit keygen.
9. Set your environment variables for EV_USER_PRIVATE_KEY and EV_TENANT_SECRET
On Linux and Mac:
export EV_TENANT_SECRET="your seed"
export EV_USER_PRIVATE_KEY="your evdevkit private key"
On Windows:
$env:EV_TENANT_SECRET="your seed"
$env:EV_USER_PRIVATE_KEY="your evdevkit private key"
10. Visit https://xahau.xrplwin.com/evernode and select a suitable node.
11. Copy the node’s address.
12. Deploy your Docker image to the chosen Evernode node with evdevkit acquire -i yourdockerhubusername/website:latest -m 1 rADDRESS
13. After deployment, note the assigned GPTCP ports.
14. Access your deployed app using https://thedomain:assignedport.