DEV Community

Cover image for The Guide to Hacking Tetcore Nodes
Marlon Hanks
Marlon Hanks

Posted on • Updated on

The Guide to Hacking Tetcore Nodes

Tetcoin is the Currency for Change and is now built using the Tetcore Framework. For more information about Tetcore, visit the Tetcore Developer Hub at https://core.tetcoin.org or https://github.com/tetcore

Alt Text

Please be aware that even though Tetcoin started in 2014, outside factors led to the halt of its production in 2016. Development of the Tetcoin Family of Cryptocurrencies resumed in October of 2020. This group is made of the XDV, Payshares, Metrocoin, Czarcoin, Vapory, Lite, and Tetcoin blockchains. Metrocoin is currently being redesigned as a Tetcoin Parachain boostrapped off the Vapory Network.

The Tetcore Army of Two still has a lot of work to do. As a result, it is a known fact that over 10 Million Links in the Source Repositories need updating along with all Tetcoin Family Websites. Should you be a Web Developer, feel free to join us in getting that done. Speaking of Developers, the Tetcoin Team thanks each and every person who has contributed to its codebase!

This Article is not in all inclusive method to getting started with Tetcore. It will be assumed that the reader is already familiar with the Ethereum [https://ethereum.org/], Tron [https://tron.network/], and Polkadot [https://polkadot.network/] blockchains. It will also be asserted that the reader be familiar with the Javascript, Java, Go, C/C++, and Rust Languages. The instructions herein are provided for use on Linux Platforms, more specifically, Ubuntu 20.04 LTS. It is understood that each individual development environment may and will be potentially different than the original one used to forge Tetcore itself.

System Requirements

Building and using Tetcore is resource intensive. No support is currently available for Windows and Tetcoin has only been successfully built on Ubuntu. The Hardware needed includes at least one computer that has at least a Quad Core 64 Bit Intel based Processor, 16 GB of RAM, and 256 GB of free space. Tetcore itself occupies around 128 GB when built for complete testing. The above specifications are minimum requirements and it is recommended to exceed them.

With the above recommendations, it is expected that at least one work day of time is required to complete this exercise. On such a system, most components may take up to an hour each to build. It is expected that build times will vary and as a result, a solid time frame to complete this tutorial can not be provided.

Framework Variances

Tetcore is a framework enabling the rapid creation of blockchains built for any specific purpose. It is the first and only hard fork of Substrate [https://www.substrate.io/], a forkless platform for next generation blockchain innovation. Tetcore is NOT Substrate. Vapory may serve as a drop in replacement for Ethereum, however, Tetcore is a totally different beast than Substrate with code, concepts, and various fundamentals that strongly differ.

The actual interfaces such as the APIs and Frontends are similar. Substrate and Polkadot developers should easily be able to transition between the two platforms. For the sake of keeping it simple, coders should understand the following:

  • Tetcore has no Frames or Pallets, only Fabrics and Nobles
  • Bond doesn't exist in the Tetcoin World as it deals in Spycraft
  • Tetsy has no Ink in its pen, its a Pro
  • Medleys are not responsible for damage caused to Ledger Devices
  • The Tetsy Scale Codec is not an Oracle
  • Keep Vapory Types handy from the Tetsy Libraries
  • Fireworks configures clusters
  • The Tetcoin Skeleton is okay for Holidays
  • Tetsy Dapp Contracts exist as Ghosts
  • The Tetcoin Chainspec is not yet final with only four initial chainspecs
  • Nomitet was created without knowing Nomitet
  • Tetcoin JS is still missing its true self as CI is required and the Tetcore Army uses no CI yet
  • Tetcoin Launch has not been used on Mashina
  • Tetsy GHOST-based Recursive ANcestor Deriving Prefix Agreement is for Tetcore
  • Do not make a mess with the Tetcore Playground
  • The Tetcore Debug Kit has yet to crash Rust
  • Sokketo still overtakes Soket in the build and it is not yet identified why
  • There are two UINT-Crates, one 100x faster than the other with the same version thanks to Squirrel
  • Don't get an STD when playing the Funty Music
  • Chocolate Roccoco does not flavor Teccoco as something was lost in the translation.
  • Yamux be kidding on the API Sidecar

Simple enough, eh? That is not even the start to the differences between Tetcore and Substrate. One of the commits included around 1 Million changes to the original codebase and it is not feasible to use this guide to communicate each model evolution.

Creating a Development Sandbox

The only way to create a Tetcore Sandbox is create a Tetcore Sandbox. Simply start with Ubuntu 20.04 and open a terminal. Use the next instructions as guidelines and not rules:

sudo apt-get update
sudo apt-get -y install git pkg-config protobuf-compiler libprotobuf-dev libssl-dev wget build-essential
sudo apt install -y cmake clang libclang-dev curl libz-dev screen net-tools
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
curl -sSL https://git.io/g-install | sh -s
sudo apt install curl autoconf bison libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm6 libgdbm-dev libdb-dev
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
rbenv install 2.7.2
rbenv global 2.7.2
gem install bundler
sudo apt install nginx
sudo apt install mysql-server
sudo mysql_secure_installation
sudo apt install php-fpm php-mysql
sudo apt install php7.4-bcmath php7.4-bz2 php7.4-curl php7.4-dev php7.4-gd php7.4-imap php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-opcache php7.4-tidy php7.4-xml php7.4-snmp php7.4-readline php7.4-xsl php7.4-zip
Enter fullscreen mode Exit fullscreen mode

The above commands may not work on every Ubuntu Installation. Feel free to modify them to specifically work with your Flavor of Ubuntu or Alternate Linux Distro. The goal of the above commands is to foster an environment that has the following:

  • Python 2.7+
  • Node.js 10+
  • Cmake 3+
  • Clang 10+
  • GCC 9+
  • Go 1.15+
  • Nginx
  • PHP 7+
  • Ruby 2.7+
  • MySQl

In addition, PostgreSQL, Redis, and other dependencies may be required. Please refer to the Readme included with the specific Tetcore Library, Application, or Tool being used.

Installing Rust Nightly

Tetcore is built using Rust. Users with Rust Nightly already installed can simple use the following command to get a Tetcore Node installed on their system:

cargo install node-cli
Enter fullscreen mode Exit fullscreen mode

The above installed command line tool will vary slightly from the node-template executable created from the Tetcore Node Template. It is recommend to build to the Tetcore Node Template. The time has not yet been taken to identify the each difference and we have yet to discover the potential quirks. Using the Tetcore Node Template will save time as it uses around 600 less dependencies. For most environments, Tetcore will use about 1525 dependencies whereas the Tetcore Node Template will use about 857 to 965 dependencies.

Tetcore has already been successfully built on a version of Rust less than 1.53.0-nightly (07e0e2ec2 2021-03-24). That original version used to publish Tetcore was not recorded. To repeat, it is recommended to use Rust 1.53.0-nightly (07e0e2ec2 2021-03-24) as it is the latest version used to build Tetcoin.

If Rust is not yet present on the system, follow these simple steps:

Step One - Install Rust

curl https://sh.rustup.rs -sSf | sh
source ~/.cargo/env
Enter fullscreen mode Exit fullscreen mode

Step Two - Install Rust Nightly (2021-03-24)

rustup install nightly-2021-03-24
rustup target add wasm32-unknown-unknown --toolchain nightly-2021-03-24
Enter fullscreen mode Exit fullscreen mode

Build the Tetcore Node Template

Now it is time to learn how to get started using Tetcore to setup an independent test network with validators of your choosing. To do so, clone a copy of the Tetcore Node Template:

git clone https://github.com/tetcore/tetcore-node-template.git
Enter fullscreen mode Exit fullscreen mode

Next enter into the clone directory and build:

cargo build
Enter fullscreen mode Exit fullscreen mode

Now, go get some vodka, or another drink, dinner, or a movie. Go grocery shopping as for around the next hour, your dev box will most likely be occupied completing the previous step. Taking the time to actually read the Readme or Star the repository should be a good way to spend the time as well.

Building on Windows

Alt Text

Initiate Alice and Bob into Your Gang

That is not what we will be doing, but Alice and Bob will need to be brought online as validators. Alice and Bob are just two well known keypairs that may be used to start a Tetcore Parachain. For purposes of this tutorial, the Gang is a Set of Tetcore Validators.

Alice Goes First

Mother only once said "Ladies First" and that is true for Tetcore. Your Gang is made up of you - the hacker leader, Alice - the first strike, and Bob - the right hand man. Make a directory called 'tet' and copy the node-template executable to it:

cp ~/<clone directory>/target/debug/node-template ~/tet
cd ~/tet
Enter fullscreen mode Exit fullscreen mode

Fire up Alice:

./node-template \
  --base-path ./alice \
  --chain local \
  --alice \
  --port 30333 \
  --ws-port 9945 \
  --rpc-port 9933 \
  --node-key 0000000000000000000000000000000000000000000000000000000000000001 \
  --telemetry-url 'wss://telemetry.tetcoin.org/submit/ 0' \
  --validator
Enter fullscreen mode Exit fullscreen mode

Picture A - The output should look something like:

Alt Text

Picture B - The output should not look like:

Alt Text

If you are not getting a similar output as depicted in Photo A, please double check the command entered. If the command is correct, then check your environment. Else consider that a bug may be present and submit that issue to https://github.com/tetcore/tetcore-node-template/issues

What is important from the output that Alice provides is the Node Identity. In this case the string is:

Local node identity is: 12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp
Enter fullscreen mode Exit fullscreen mode

Bob will need that identifier

Bring Bob Aboard

/node-template \
  --base-path /tmp/bob \
  --chain local \
  --bob \
  --port 30334 \
  --ws-port 9946 \
  --rpc-port 9934 \
  --telemetry-url 'wss://telemetry.tetcoin.org/submit/ 0' \
  --validator \
  --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWEyoppNCUx8Yx66oV9fJnriXwCcXwDDUA2kj6vnc6iDEp
Enter fullscreen mode Exit fullscreen mode

Bob on Windows 10

Alt Text

Bob on Windows Terminal

Alt Text

Now head over to https://telemetry.tetcoin.org to view your Network:

Alt Text

With Bob as Windows Validator

Alt Text

Bob in a Windows Bash Shell (Cygwin)

Alt Text

Conclusion

Time is of the essence, and as such this tutorial is being cut short. There will be updates to it in time. So far we have covered the basic requirements on getting started hacking Tetcore Nodes. Until Next Time: Thanks for Reading!

Discussion (0)