Blurt Blockchain TESTNET with Nexus

in blurt-101010 •  last year 

image


In my recent @beblurt post titled BeBlurt: News and Highlights , I shared my primary focus on establishing a Blurt Blockchain TESTNET. Despite facing some initial setup challenges, along with an exceptionally busy schedule, after days of working, learning, writing, testing... I'm glad to announce the opening of the Blurt Blockchain TESTNET as well as a TESTNET RPC node with Nexus! 🎉

The newly launched Blurt Blockchain TESTNET is a valuable resource for all application developers on the Blurt blockchain, offering a controlled testing environment for experimenting with new functionalities before deploying them to the main production chain.

For example, it can help developers integrate Nexus, the communities module of the Blurt Blockchain, more easily into their existing frontend. For some others, this could serve as a valuable resource to craft games on the Blurt blockchain or even develop specific dApps utilizing the Custom JSON Operations.

From my standpoint, the TESTNET will play a crucial role in enabling the implementation of the account creation module with an affiliate link (onboarding program), along with unveiling some exciting surprises that were previously held back due to the absence of a development environment like the TESTNET.

As a developer, you can now access the Blurt Blockchain TESTNET completely free of charge (of course I don't turn down donations to help pay the costs 🤣 by a vote on my witness or my proposal or a BeBlurt delegation or others) and harness its potential to refine and optimize your applications.


What is a TESTNET?

A TESTNET serves as a separate, parallel blockchain specifically designed for testing and experimentation. It allows developers to deploy and validate new features, applications, or dApps in a controlled environment without affecting the mainnet, the primary live blockchain. TESTNETs replicate the core functionality of the mainnet while utilizing test tokens, ensuring that any issues or bugs discovered during testing have no impact on real assets or transactions.


Blurt TESTNET - Guide for Developers


The TESTNET is based on the saboin/account-history-upgrades branch of the Blurt Gitlab repository. In each round, the number of witnesses has been reduced to 7, and for the validation of a hard fork, it has been lowered to 4 witnesses.


Accessing the TESTNET

  • RPC node with Nexus: https://testnet-rpc.beblurt.com
  • CHAIN_ID: "1df54a5cc86f7c7efee2402e1304df6eae24eb8766a63c0546c1b2511cf5eba6"
  • ADDRESS_PREFIX: "TST"
  • ASSET: "TESTS"

Blurt libraries

By default, all Blurt blockchain client libraries are configured to connect to the Blurt blockchain Mainnet. To communicate with the TESTNET, you need to initialize your client library with the specific Chain ID and Address Prefix for the TESTNET.

Here's an example using dBlurt library:

/** TESTNET */
const TESTNET_BLURT_ADDRESS_PREFIX = 'TST';
const TESTNET_BLURT_CHAIN_ID = '1df54a5cc86f7c7efee2402e1304df6eae24eb8766a63c0546c1b2511cf5eba6';
const TESTNET_NODES_RPC = ['https://testnet-rpc.beblurt.com'];

const client = new Client(TESTNET_NODES_RPC, { addressPrefix: TESTNET_BLURT_ADDRESS_PREFIX, chainId: TESTNET_BLURT_CHAIN_ID });
const chainProperties = await client.condenser.getChainProperties();
console.log(chainProperties);

Blurt Tools CMD

To ensure a smooth start on the TESTNET, I've developed an open-source Blurt Blockchain Operations in common interactive command line user interfaces (nodeJS/Inquirer). It's still very basic, but it should do the trick.

Gitlab Repository: https://gitlab.com/beblurt/blurt-tools-cmd

Let's take a brief overview of what this toolbox offers.

Getting started

To install & start it just do a:

$ git clone https://gitlab.com/beblurt/blurt-tools-cmd && cd blurt-tools-cmd
~/blurt-tools-cmd$ npm i
~/blurt-tools-cmd$ npm start

> [email protected] start
> tsc && node ./dist/

------------------------------------------
Toolbox for the Blurt Blockchain

? Change the config? (y/N)

Change the config?

Upon launching the toolbox, the first prompt will ask if you wish to modify its configuration and if your answer is "Yes" if you want "Reload the default config?" or use a specific configuration.

The toolbox is already pre-configured for both the main chain and the TESTNET and is open for specific configuration.

For which chain?

You can then choose to work either on the main Blurt chain or the TESTNET chain.

What do you want to do?

image

Create a TESTNET account

To create an account on the TESTNET (including 100,000 TESTS), you need to have an account on the main chain and be part of the TESTNET developers' list. To be added, simply request access in the "dev" channel of the official Blurt Discord server: https://discord.blurt.world/

The following accounts are already on the list: @saboin, @tekraze, @sagarkothari88, @eastmael, @khrom, @fervi, @techcoderx, @alejos7ven, @kamranrkploy, @casualfriday (and I might have inadvertently missed some, apologies).

For the questions "What is the BLURT account that will create this username?" and "What is the ACTIVE KEY of the CREATOR account?" please use your main chain account information.

The key's purpose is only to sign the message sent to the Backend for verification, you can verify this by examining the source code if you're curious. You can use your POSTING key it should work as well.

TESTNET Transfer

To perform account-to-account transfers on the TESTNET.

TESTNET Power UP

To execute a Power UP (amount in TESTS) on the TESTNET.

TESTNET Witness Vote

To vote for a TESTNET witness.

TESTNET Witness set properties

Set the properties for your TESTNET witness.


Make your own Nexus RPC Node - Ubuntu 22.04 LTS


How to create a Nexus RPC Node (Ubuntu 22.04 LTS version) for the Testnet?

Prerequisites

Before proceeding, configure Time Synchronization with NTP and increase the max open files limit

Time Synchronization with NTP

Turn off timesyncd (the default manager for time synchronization) and install NTP

testnet@rpc:~$ sudo timedatectl set-ntp no
testnet@rpc:~$ sudo apt install ntp
testnet@rpc:~$ sntp --version
sntp [email protected] Wed Feb 16 17:13:02 UTC 2022 (1)

Edit the /etc/ntp.conf file and replace the default *.ubuntu.pool.ntp.org by the nearest NTP pool servers from your location.

example with Thailand:

pool 0.th.pool.ntp.org iburst
pool 1.th.pool.ntp.org iburst
pool 2.th.pool.ntp.org iburst
pool 3.th.pool.ntp.org iburst

Restart the service & check

testnet@rpc:~$ sudo service ntp restart
testnet@rpc:~$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 0.th.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 1.th.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 2.th.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 3.th.pool.ntp.o .POOL.          16 p    -   64    0    0.000   +0.000   0.000
 ntp.ubuntu.com  .POOL.          16 p    -   64    0    0.000   +0.000   0.000

Increase the max open files limit

Edit the /etc/security/limits.conf file and add the following lines (replace ubuntu by your local user):

root            soft     nproc          999999
root            hard     nproc          999999
root            soft     nofile         999999
root            hard     nofile         999999
ubuntu          soft     nproc          999999
ubuntu          hard     nproc          999999
ubuntu          soft     nofile         999999
ubuntu          hard     nofile         999999

Edit the /etc/pam.d/common-session file and add the following line:

session required        pam_limits.so

Reboot the server for the change to take effect and check the open files limit:

testnet@rpc:~$ ulimit -n
999999

Build for TESTNET

Install the Required Packages

testnet@rpc:~$ sudo apt install build-essential automake cmake libssl-dev libtool libbz2-dev libsnappy-dev pkg-config doxygen perl libreadline-dev libncurses5-dev iotop iftop jq

Clone the Official Blurt Git Repository

Clone the official repository, switch to the @saboin branch (for the "account-history-upgrades") and update all submodules recursively along their tracking branches, then create build and bin directories:

testnet@rpc:~$ git clone https://gitlab.com/blurt/blurt.git && cd blurt/
testnet@rpc:~/blurt$ git fetch
testnet@rpc:~/blurt$ git switch saboin/account-history-upgrades
testnet@rpc:~/blurt$ git submodule update --init --recursive
testnet@rpc:~/blurt$ git submodule sync --recursive
testnet@rpc:~/blurt$ mkdir ~/build ~/bin && cd ~/build

Compilation

Before compiling, modify the file ~/blurt/libraries/protocol/include/blurt/protocol/config.hpp as follows:

For BLURT_CHAIN_ID (IS_TEST_NET section):

#define BLURT_CHAIN_ID                        (fc::sha256::hash("blurt_testnet"))

BLURT_CHAIN_ID

For WITNESSES & HARDFORK:

// TODO: Determine how to safely change this for HF5
// LIKELY it looks like BLURT_MAX_WITNESSES_HF5=45
// BLURT_MAX_VOTED_WITNESSES_HF5=35
// BLURT_MAX_RUNNER_WITNESSES_HF5=10
#define BLURT_MAX_WITNESSES                   7
#define BLURT_MAX_VOTED_WITNESSES_HF17        6
#define BLURT_MAX_RUNNER_WITNESSES_HF17       1

#define BLURT_HARDFORK_REQUIRED_WITNESSES     4 // 17 of the 21 dpos witnesses (20 elected and 1 virtual time) required for hardfork. This guarantees 75% participation on all subsequent rounds.

WITNESSES

Compile

For compilation, use the following command:

testnet@rpc:~/build$ cmake -DCMAKE_BUILD_TYPE=Debug -DLOW_MEMORY_NODE=ON -DCLEAR_VOTES=ON -DSKIP_BY_TX_ID=OFF -DBUILD_BLURT_TESTNET=ON -DENABLE_MIRA=OFF -DBLURT_STATIC_BUILD=ON ../blurt/
testnet@rpc:~/build$ make -j$(nproc)
testnet@rpc:~/build$ cp programs/blurtd/blurtd ../bin/
testnet@rpc:~/build$ cp programs/cli_wallet/cli_wallet ../bin && cd
Note (thank to @saboin for this tip): in case you will encounter an Error with the "make -j$(nproc)" command instead of "-j$(nproc)", use "-j3" or even go as low as "-j1" and use a swap file.

Settings

Check the version

testnet@rpc:~$ ~/bin/blurtd --version
blurt_blockchain_version: 0.9.0
blurt_git_revision:             4a07ba9d15ce0506d67927524ba5d7bfbf191ecc
fc_git_revision:                  4a07ba9d15ce0506d67927524ba5d7bfbf191ecc

------------------------------------------------------

            STARTING TEST NETWORK

------------------------------------------------------
initminer public key: TST6LLegbAgLAy28EHrffBVuANFWcFgmqRMW13wBmTExqFE9SCkg4
initminer private key: 5JNHfZYKGaomSFvd4NUdQ9qMcEAC43kujbfjueTHpVapX1Kzq2n
blockchain version: 0.9.0
------------------------------------------------------

Launch the blurtd program and close it immediately (CTRL+C) to create the config in a testnet directory.

testnet@rpc:~$ ~/bin/blurtd -d ~/testnet

Edit the ~/testnet/config.ini file and modify the parameters as follows:

# Plugin(s) to enable, may be specified multiple times
plugin = chain p2p json_rpc webserver witness block_api condenser_api database_api network_broadcast_api
# Get accounts/witness
plugin = account_by_key account_by_key_api
# Transaction status
plugin = transaction_status transaction_status_api
# Account history
plugin = account_history_rocksdb account_history_api
...

# The IP address and port of a remote peer to sync with.
p2p-seed-node = testnet-rpc.beblurt.com:1776

You can add your TESTNET witness too ;)

Start again the node with the command:

testnet@rpc:~$ ~/bin/blurtd -d ~/testnet

In case of error Could not find last irreversible block stop it and start again with adding option --replay-blockchain

testnet@rpc:~$ ~/bin/blurtd -d ~/testnet --replay-blockchain

image

Nexus

PostgreSQL

Nexus use PostgreSQL as database so you need to install it.

testnet@rpc:~$ sudo apt install postgresql postgresql-contrib
testnet@rpc:~$ sudo -i -u postgres psql
# Create required role for user
CREATE ROLE usernexus LOGIN PASSWORD 'passnexus';

# Set password if needed
ALTER ROLE usernexus WITH PASSWORD 'passnexus';

# Database used by Nexus
CREATE DATABASE nexus;

Configure

Edit the ~/.bashrc file

export PATH="/usr/local/bin:/home/<your ubuntu user>/.local/bin:$PATH"
export DATABASE_URL=postgresql://usernexus:[email protected]:5432/nexus
export HTTP_SERVER_PORT=8092
export STEEMD_URL=http://127.0.0.1:8091

Reload and check PATH

testnet@rpc:~$ source ~/.bashrc
testnet@rpc:~$ echo $PATH 

Python 3.8

As Ubuntu 22.04 LTS comes with Python 3.10 by default, you need to install Python 3.8 until Nexus gets updated to support the latest Python version as well as use an isolated Python environments to avoid issues on using different package versions on your server.

Install

testnet@rpc:~$ sudo add-apt-repository ppa:deadsnakes/ppa -y
testnet@rpc:~$ sudo apt-get update
testnet@rpc:~$ sudo apt install -y \
    python3.8 \
    python3.8-dev \
    python3.8-venv \

Installing virtual environment, Clone Git & Install Nexus

testnet@rpc:~$ python3.8 -m venv ~/virtualenv
testnet@rpc:~$ source ~/virtualenv/bin/activate
(virtualenv) testnet@rpc:~$  git clone https://gitlab.com/blurt/openblurt/nexus.git && cd nexus
(virtualenv) testnet@rpc:~/nexus$ pip install -e .[test]
(virtualenv) testnet@rpc:~$ deactivate

to exit the virtualenv use the command deactivate

Sync & Start server

Start the Nexus Sync (in screen or tmux session)

testnet@rpc:~$ ~/virtualenv/bin/hive sync

image

Start the Nexus server (in screen or tmux session)

testnet@rpc:~$ ~/virtualenv/bin/hive server

image

RPC-PROXY

easy to use RPC Proxy written in Python with support to websocket and http connections.

Prerequisites

We need to install Redis first

testnet@rpc:~$ sudo apt install redis-server
testnet@rpc:~$ sudo systemctl status redis

Installation

testnet@rpc:~$ source ~/virtualenv/bin/activate
(virtualenv) testnet@rpc:~$ pip install msgpack aiomcache
(virtualenv) testnet@rpc:~$ git clone https://github.com/ecency/rpc-proxy && cd rpc-proxy && pip install -e .

Start

Start the rpc-proxy in screen or tmux session

(virtualenv) testnet@rpc:~$ rpc_proxy --config ~/rpc-proxy-blurt.json

image

Your Nexus RPC Node is now up and running 🎉 Congrats!


Good development to all, dev 👍


References


Original background photo of this post by
Hack Capital
on Unsplash

animated gif created with ScreenToGif


Thank you for your continued support through a vote on my witness or a Delegation to the BeBlurt Delegation program. Together, let's continue to thrive within the Blurt blockchain ecosystem.

@nalexadre 9th Witness (Blocks producer) on Blurt

image
Join or Create a Blurt Community

image
BeBlurt (Blurt frontend): https://beblurt.com
 
BeBlurt Delegation program: manual curation + 85% reward back
 

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!
Sort Order:  
  ·  last year  ·  

That's amazing work you have done. We have been thinking of setting up for a long time but as you mention of busy schedule, just because of that haven't been able to.

But this will help me as I am working on my frontend as well other gamers.

I am currently exploring some discord games with cryptoshots, maybe in the future I will be the one to add some game on Blurt blockchain.

Thanks

Does nexus node return the same information as a regular node?


Posted from https://blurtlatam.intinte.org

  ·  last year  ·  

You can think of it as a super node, which combines all the functionalities of a normal node (responding to all regular methods available on a normal node) with extended features like community management (what you have on Steem, Hive, and BeBlurt too as the BeBlurt RPC node is already a Nexus node). Additionally, it includes a notification system (unlike Blurt, which relies on a third-party system, except for BeBlurt, which uses Nexus' system), and more... If you have some knowledge about Blurt architecture: this relies in part on the use of custom_json operations, which are analyzed by Nexus program.

Thanks, I use this bot, but there are often problems, I tried different nodes, but sometimes the bot does not detect all my votes. If problem persist I will try your node

https://github.com/fbslo/steem-voting-bots


Posted from https://blurtlatam.intinte.org

  ·  last year  ·  

Hi @mariuszkarowski, if you'd like to take a look and tell me what you think: https://gitlab.com/beblurt/blurt-voting-trail-bot

It looks great. One question.
Does this bot have protection against this situation:

curator 1 votes for post A with 100% voting power, then curator 2 votes for same post with 50% voting power

In this situation, first vote (100%) will be withdrawn and a 50% vote will be assigned. The user of the bot loses VP and does not receive a curation reward.

does bot have "already voted" check mechanism?


Posted from https://blurtlatam.intinte.org

  ·  last year  ·  

I didn't specify it, but if any of the accounts listed in the 'CURATORS' section has already voted on the post, the bot will skip it and display a message in the console to notify you. No new vote will be cast.

It's this part of the code

image

source: https://gitlab.com/beblurt/blurt-voting-trail-bot/-/blob/main/src/index.ts?ref_type=heads#L141

it would be nice if the bot could recognize main posts and comments, then we could vote on comments with less power


Posted from https://blurtlatam.intinte.org

  ·  last year  ·  

Great idea 👍 I'm a little bit sick since yesterday, I'll make the change tomorrow I think and I let you know.

  ·  last year  ·  

If I have some free time, I will create and publish on Gitlab an updated version of the "steem-voting-bots" using my dblurt client library and my Blurt RPC nodes checker to automatically switch between RPC nodes. I'll keep you informed.

Congratulations! 🏆

You have recieved a coconutty upvote! 🥥
Thank you for contributing to the Blurt Blockchain!
Keep up the great work!

Curated by @outofthematrix!

A little reminder: I am a top 20 Blurt witness, sooo please help me stay there!

Please consider taking a moment to vote for my witness, if you haven't already done so!
You can do this by logging into your wallet with your active key! 🗳️
It only takes a few seconds and doesn't cost a cent!
https://blurtwallet.com/~witnesses?highlight=outofthematrix

  ·  last year  ·  

This looks complicated to me but I believe in your capacity. Thank you for your contribution in this platform. I am one of your supporters. Good job @nalexandre!🎉👏

IMG_20230802_074937.jpg

Congratulations, your post has been curated by @r2cornell-curate. Also, find us on Discord

Manually curated by @abiga554

logo3 Discord.png

Felicitaciones, su publication ha sido votado por @r2cornell-curate. También, encuéntranos en Discord

  ·  last year  ·  

Congratulations 👏
Your post has been manually curated by @chibuzorwisdom.

You can support our community project by taking a moment to vote @blurtconnect-ng as blurt witness.

Click on the link below to vote.
https://blurtwallet.com/~witnesses?highlight=blurtconnect-ng

Screenshot_2023-06-28-18-31-39-72_40deb401b9ffe8e1df2f1cc5ba480b12.jpg

  ·  last year  ·  

Amazing! Thank you so much for including me in the dev list, I’ll use it soon!