ENG
RPC for Blurt Platform
- The RPC is used to connect and get information about the blockchain, this is its main purpose.
Frontend UI (User Interface) like the wallet and the capacitor connect to the RPCs to get information from the blockchain and also to issue transactions.
When you create an application for #Blurt or a Bot, you need to connect to an RPC to interact with the chain.
The more RPCs the blockchain can have, the more the blockchain can ensure its continuity in case of any failure, the same happens with the Witness nodes.
Installation and Configuration
We will start by installing all the necessary dependencies to have our server updated:
apt update
apt upgrade -y
apt install -y software-properties-common gnupg vnstat ifstat iftop atop ufw fail2ban systemd-timesyncd
Install Docker on our server :
curl -s https://get.docker.com | bash
We configure our Firewall to deny the connections that we do not want and activate the necessary ports for the correct operation of our RPC
ufw default deny
ufw allow ssh
ufw allow 1776
ufw allow http
ufw allow https
ufw enable
We execute this command
docker pull saboin/blurt-rpc-presync
We install the Docker container with the following command (If you omit something it will not work, it is only one command).
docker run -d --net=host -v blurtd:/blurtd --name blurtrpc saboin/blurt-rpc-presync /usr/bin/blurtd --data-dir /blurtd --webserver-http-endpoint 0.0.0.0:8091 --webserver-ws-endpoint 0.0.0.0:8090 --p2p-endpoint 0.0.0.0:1776
This will download a pre-synced image of the blockchain, in my case it took about 10 minutes. After downloading this image we must synchronize the blockchain, this is the process that takes the longest can be around two hours. To synchronize and see the logs we execute the following command.
docker logs blurtrpc -f
We must wait for the blockchain to synchronize, to know if we have reached this step the first thing we must know is that 8,755,370 blocks have already been executed, in addition we will be able to notice that the message handle_block appears as shown in the image.
The next thing to do is to install Caddy, we will do it by the following commands.
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/gpg.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-testing.list
sudo apt update
sudo apt install caddy
To validate that Caddy is active on our server we can use the following command and we will see something similar to the attached image
systemctl status caddy
If we are at this point we can say that we only have one step left, which is to modify the caddyfile file. If you have a domain you can use it, this to better remember the link to your RPC node otherwise you must use the IP address of your server. To modify the file we execute:
nano /etc/caddy/Caddyfile
We can delete the content of the file, or just comment everything out and add our code. Remember to modify the information Tu.server.com to your domain or public IP address.
Tu .server.com {
header Access-Control-Allow-Origin "*"
header Access-Control-Allow-Methods "POST, GET, OPTIONS"
header Access-Control-Allow-Headers "Content-Type"
reverse_proxy localhost:8091
}
Once we have modified our Caddy file, we restart the service and do some tests to determine that we have achieved our goals. we restart with:
systemctl reload caddy
The first test we can do is to verify from the console if our server is listening on port 8091, this should give us back the information from the JSON file
curl -s localhost:8091
If we go to the address of our domain or the IP address of the server we will see something similar
With this we have achieved our goal. This guide will continue to be revised and constantly updated so that other users can implement this kind of solutions for our #Blurt platform. I want to thank @saboin for helping me to improve the code used and especially for dedicating his time to find some details that prevented the correct functioning of the RPC node.
Vota por mi como Witness Link
ESP
RPC para la Plataforma Blurt
- La RPC sirve para conectarse y obtener información sobre la cadena de bloques, este es su principal objetivo.
Los Frontend UI (Interfaz de usuario) como el monedero y el condensador se conectan a los RPC para obtener información de la cadena de bloques y también para emitir operaciones.
Cuando creas una aplicación para #Blurt o un Bot, necesitas conectarte a una RPC para interactuar con la cadena.
Mientras más RPC pueda tener la cadena de bloques, la misma puede asegurar su continuidad en caso de algún fallo, al igual sucede con los nodos Testigos
Instalación y Configuración
Empezaremos por instalar todas las dependencias necesarias para tener nuestro servidor actualizado:
apt update
apt upgrade -y
apt install -y software-properties-common gnupg vnstat ifstat iftop atop ufw fail2ban systemd-timesyncd
Instalar Docker en nuestro servidor :
curl -s https://get.docker.com | bash
Configuramos nuestro Firewall para denegar las conexiones que no deseamos y activar los puertos necesarios para el correcto funcionamiento de nuestro RPC
ufw default deny
ufw allow ssh
ufw allow 1776
ufw allow http
ufw allow https
ufw enable
Ejecutamos este comando
docker pull saboin/blurt-rpc-presync
Instalamos el contenedor Docker con el siguiente comando (Si omites algo no funcionara, es un solo comando).
docker run -d --net=host -v blurtd:/blurtd --name blurtrpc saboin/blurt-rpc-presync /usr/bin/blurtd --data-dir /blurtd --webserver-http-endpoint 0.0.0.0:8091 --webserver-ws-endpoint 0.0.0.0:8090 --p2p-endpoint 0.0.0.0:1776
Esto descargará una imagen pre sincronizada de la cadena de bloques, en mi caso ha tardado como 10 minutos. Luego de descargar esta imagen debemos sincronizar la cadena de bloques, este es el proceso que más tarda pueden ser alrededor de dos horas. Para sincronizar y ver los Logs ejecutamos el siguiente comando.
docker logs blurtrpc -f
Debemos esperar que se sincronice la cadena de bloques, para saber si hemos alcanzado este paso lo primero que debemos saber es que ya se han ejecutado 8.755.370 bloques, adicional vamos a poder notar que aparece el mensaje handle_block como se muestra en la imagen.
Lo siguiente que debemos hacer es instalar Caddy, lo haremos mediante los siguientes comandos.
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/gpg.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/testing/debian.deb.txt' | sudo tee -a /etc/apt/sources.list.d/caddy-testing.list
sudo apt update
sudo apt install caddy
Para validar que Caddy está activo en nuestro servidor podemos usar el siguiente comando y veremos algo parecido a la imagen adjunta
systemctl status caddy
Si estamos en este punto ya podemos decir que solo nos falta un paso, el cual consiste en modificar el archivo caddyfile. Si posees un dominio puedes usarlo, esto para recordar mejor el enlace a tu nodo RPC de caso contrario debes usar la dirección IP de tu servidor. Para modificar el archivo ejecutamos:
nano /etc/caddy/Caddyfile
Podemos borrar el contenido del archivo, o tan solo comentar todo y agregar nuestro código. recuerden que deben modificar la información Tu.server.com por la de su dominio o su dirección IP publica
Tu .server.com {
header Access-Control-Allow-Origin "*"
header Access-Control-Allow-Methods "POST, GET, OPTIONS"
header Access-Control-Allow-Headers "Content-Type"
reverse_proxy localhost:8091
}
Una vez hemos modificado nuestro archivo Caddy, reiniciamos el servicio y hacemos algunas pruebas para determinar que hemos alcanzado nuestros objetivos. reiniciamos con:
systemctl reload caddy
La primera prueba que podemos hacer es verificar desde la consola si nuestro servidor está escuchando en el puerto 8091, esto nos debe devolver la información del archivo JSON
curl -s localhost:8091
Si vamos a la dirección de nuestro dominio o a la dirección IP del servidor veremos algo similar
Con esto hemos alcanzado nuestro objetivo. Esta guía seguirá en revisión y en proceso de actualización constante con el fin de que otros usuarios puedan implementar este tipo de soluciones para nuestra plataforma #Blurt. Quiero dar gracias a @saboin por ayudarme a mejorar el código utilizado y sobre todo por dedicar su tiempo para encontrar algunos detalles que impedían el correcto funcionamiento del nodo RPC.
Vota por mi como Witness Link
sir,
Since I have no idea about RPC, I would like to know more details about it from you
Can we as ordinary users setup this program and what benefits do you think we can get if we use this program?
A few days ago I also heard from my friend about an option called Witness Status. Are you talking about updating your today's program in the set?
It would be very helpful for me if you could open up a little. I would like to know the details of where to start if you set up your program.
Witness and RPC are same but differ in purpose.
Witness is a group of people who validate transactions on blurt blockchain, and make it secure along with making decisions.
RPC contains data and is used by application like blog and wallet. So if you want to create your own app using blurt, you need to run RPC.
For normal users, there is no need running both
Good afternoon, Sorry for the delay in responding. RPC nodes are used for:
The RPC is used to connect and get information about the blockchain, this is its main purpose.
Frontend UI (User Interface) like the wallet and the capacitor connect to the RPCs to get information from the blockchain and also to issue transactions.
When you create an application for #Blurt or a Bot, you need to connect to an RPC to interact with the chain.
The more RPCs the blockchain can have, the more the blockchain can ensure its continuity in case of any failure, the same happens with the Witness nodes.
Anyone can create one to bring stability to the Blurt platform, this does not generate any economic incentive but when you want to create applications it is necessary that they exist. The witness nodes do generate an economic incentive. It is a server where many transactions that we do on a daily basis are recorded.
Congratulations, your post has been curated by @dsc-r2cornell. You can use the tag #R2cornell. Also, find us on Discord
Felicitaciones, su publicación ha sido votada por @ dsc-r2cornell. Puedes usar el tag #R2cornell. También, nos puedes encontrar en Discord
This post benefited me a lot. I read about update of a r p c before this post but didn't understand. You have written very simply. So I completely understood. thank you so much.
Well, you have explained about RPC and it's installation in a easy way. I had already read a post this same topic written by tekraze. Both are very nice posts and are full of details.
I really like reading this content. Thank you sir
Thanks a lot my friend!