Technical Guide | Polkadot Wave Card Chain: Building Pre-POC-3 on Substrate

You might ask, what is the difference between Polkadot and Substrate? Let us clarify the differences and similarities between these two main concepts.

Substrate is the framework for creating cryptocurrencies and other distributed systems using the latest research in blockchain technology.

As Jack Fransham said in the Substrate Intro article on the Parrate website:

It is important to understand that Parity Substrate does not belong to Polkadot at all. Although Polkadot is built using Substrate, and projects built with Substrate can be run locally on Polkadot, you can now build a new blockchain using Substrate. You don't have to wait for Polkadot, or even start to use proof of concept (POC) to start using the blockchain… you can think of it as an Express or other web application framework, but for building distributed or distributed System, such as cryptocurrency or message bus. Just as most web applications don't need to reimplement their own HTTP versions, we believe that every team that creates a new blockchain needs to implement all network and consensus code from scratch, which is a waste of effort.

Therefore, the POC-3 "BB" is the minimum Substrate reference implementation of the blockchain-based WASM smart contract.

As Gavin Wood said on Riot:

He also provided a plan for the POC-4 in December/January. It is said that BB Testnet will support parallel chains, which means Substrate is also ready to carry Polkadot.

So let's look at some of the changes that are in contrast to the POC-2 deployment.

You should first read the first chapter " Hello World Polkadot #1: Cost-Effective Deployment of Validator Nodes ", which gives you a comprehensive understanding. In this article, I will only describe incremental changes to the POC-2 installation.

Create a new image

First, I have to create a new docker image that runs the latest substrate poc-3 code on Ubuntu 16.04.5 to deploy it to my jelastic paas (hidora.com). This is a minimal docker image, the main run command is as follows:

You can find this image on Dockerhub on talfco / clb-substrate https://hub.docker.com/r/talfco/clb-substrate/

Deploy the Dockerfile to the test node installation and run it by providing the -name parameter

Like POC-2, the GUI (https://telemetry.polkadot.io/#/BBQ%20Birch) will show how your nodes are synchronized with the chain.

Create a new address store in your wallet

The next step is to create a POC-3 test network address and store it in your personal wallet application. In fact, there are two wallet applications available for PoC-3 that can be used to manage your PoC-3 address.

As a newcomer to blockchain, I am always confused with the theme of "wallet accounts" by visually mapping it to the traditional concept of other (centralized) account solutions. These accounts can be accessed through different browsers on multiple devices (or multiple browsers on the same device). The Wallet app and its account management features are completely different.

So, when we use these two base wallet/management applications for POC-3, let me share my personal findings (this may be clear to you).

For all intents and purposes, the wallet is essentially a user identity on the blockchain.

The figure below represents a digital wallet that includes the private and public keys of the Birch address.

The so-called bondy polkadot user interface (written by gavin wood) is minimal in its feature set, but it is an excellent (not too extensive) code base for working inside the repol-based polkadot client application.

POC-3 wallet application link: https://paritytech.github.io/substrate-ui/index.html

Source code: https://github.com/paritytech/substrate-ui

The second application is the Parity Substrate Portal application, which is built from different modular components and is more feature-rich. It is the front end I used in the previous article.

POC-3 Portal App link: https://polkadot.js.org/apps/next

Source code: https://github.com/polkadot-js/apps

Both applications are so-called encrypted wallet applications that store your public and private keys and software programs interfaced with polkadot so users can monitor their balances, DOT transfers and other operations.

In the management key, the above wallet application must be considered completely isolated in the relevant local device storage required by the browser to run and its storage sensitive key.

Both Wallet Apps are HTML5 single-page applications based on the React Javascript Framework.

For example, the Bondy Polkadot UI is initially loaded in 11 http, requesting the necessary javascript application (and some helper files), then switching the protocol to the WebSocket protocol and passing "wss://substrate-rpc.parity.io/" with The substrate test network communicates.

From a pure HTTP perspective, the HTTP protocol only needs to load static files (javascript and some CSS and image files) into the browser virtual machine.

Therefore, the Wallet App is located in the browser VM and controls its local storage objects. In our example, a textual description is used to preserve the private key, public key, and hosted address. For the address book function, store the text identifier that will be used to save the address as well as the address itself.

If you open a second Wallet application (ie Substrate Wallet Portal App) in your browser, you will realize that the application does not know any private/public keys.

This made me confused at the beginning, but now it should be clear by considering the rules that the wallet application is specific to:

A device that runs a browser type (chrome, firefox, etc.) and executes a specific single-page application (represented by the URL of the loaded resource).

Another example is that the BondyPolkadot app running Chrome and Firefox on the same device does not share any key configuration.

So how do you configure your address in the second wallet application? First of all, I think I have to use the recovery account feature, but the final solution is simpler:

Just use your private seed address to create an address in the second app.

By using the same seed, you only need to configure the application for this private address (easy to use). Therefore, you have configured addresses for both applications.

Final comment on this in-depth study:

The secretStore management in the app is provided by the oo7-substrate NPM, which is part of the Bond Framework https://github.com/paritytech/oo7. It may be a good start for a future study of the wallet application.

Create a new address and store it in your wallet

As a first step, you must create a new address on the BBQ-Birch Testnet.

Go to the BBQ Birch Bondy Polkadot App and create a new address with the Wallet feature. Https://paritytech.github.io/substrate-ui/index.html

As you can see, the first time you open the app, you will get a default address configured with the account name "default". Press "delete" to delete it so that you can set your own name.

So, by (1) generating a private seed, (2) defining the name and pressing the "create" button to create your own address. This will (3) generate a new address for you.

In order to extract the private seed, you must click on eye-icon(4), which will initially display the Validator Seed as a hexadecimal value (required when starting the Validator with the KEY parameter).

Click the key icon to get the key. You should store the key phrase offline and keep it secure, this is your safety net and you can always restore your address to the Substrate Wallet app.

Get BBQ/Birch

Through the last article, we can clearly understand that we need to get BBQ in the community.

After receiving some Birch tokens, you can also get a short address. You can check the status of the address by address lookup

A practical short address, as long as some of your Birch is associated with your address, it is enabled, it is a 4-character address.

You can use a short address to find it

Get ready for the Polkadot Portal App

Switch to the Substrate Portal App and open it in your browser. As you can see, there is no address account configured (remember the above discussion about wallet scope).

Just create an account with your "seed phrase" and it will create an account in this app. You will usually use the same account name (not to be confused) and a password must be provided.

In addition, you now have two Substrate Wallet Apps with your Substrate address.

So now it's time to restart your Validator node with your private Validator Seed (see above), run cmd by configuring your docker instance with the parameter '-validator – key <yourValidatorSeed> (see my previous article). After restarting, the log will show a BFT protocol error indicating that you have not been nominated for a full verification process.

If you will be using the Dockerfile above, be sure to set two environment variables in your Docker instance.

  • POLKADOT_KEY_POC3
  • POLKADOT_NAME_POC3

The Dockerfile uses the monitorValidator.sh script to configure the crontab file. Every minute, check if the Validator process is still running.

Otherwise, the Validator process will be restarted to reduce the cut time.

Final nomination

The final step is to abandon the verification and get enough Nominators to support you with their Birch to be a complete validator.

In the next article, I'll cover the various components that make up the Substrate framework and its runtime.

This article reprints the public number: Blockchain Research Laboratory

The content of Haina College will focus on: the blockchain technology, product community, economic model and other comprehensive knowledge system output, bringing you a different community learning experience. Welcome to contact the author: csschan1120