1. Home
  2. Substrate

Substrate

How to build your first blockchain on Substrate?

Setting up your development environment is the first step in starting with Substrate. After this, developers can create a small network of validators by updating the runtime code for a node and then gradually scale it up.

When Ethereum was launched in July 2015, the world was introduced to the concept of smart contracts that hoped to revolutionize the blockchain space and allowed anyone from developers to enthusiasts to deploy decentralized applications (DApps) on the Ethereum mainnet. 

With various DApps currently in use across different blockchains like Ethereum, they offer many use cases including banking, gaming, finance, online shopping and social media, with an ever-expanding user base across the globe.

Having provided the infrastructure needed for developers to create innovative digital applications, Ethereum, however, has limitations such as limited scalability and high gas fees, factors that are now inhibiting developers from building specialized solutions that can rival popular centralized platforms like Twitter, Facebook and Netflix.

To overcome these challenges and explore the possibilities of blockchain technology, Ethereum co-founder and its first chief technology officer Gavin Wood left the Ethereum Foundation and founded Parity Technologies to build blockchain infrastructure that can help create the foundation of a decentralized web, or Web3 as it is known.

Related: Five major challenges in the blockchain industry

Armed with a vast industry experience and deep understanding of creating blockchains, he went ahead to build Substrate as an open-source and future-proof blockchain framework for developers to build on, enabling them to tweak their blockchain’s architecture in line with changing customer preferences.

Substrate-based blockchains can be integrated as parachains on networks such as Polkadot or Kusama and provide a high level of interoperability, helping to bring to market truly decentralized real-world solutions that are faster, cheaper and safer than ever before.

What is substrate blockchain and how does it work?

The vision of Web3 being a decentralized blockchain-based version of the internet depends on developers being able to create different blockchain applications that can interact with each other and with networks such as Ethereum and Bitcoin.

Typically, a blockchain framework is used by blockchain developers to create such applications and by using in-built templates, they can save a lot of development time at the expense of limited customization ability.

This is where Substrate, an open source blockchain framework for building customized blockchains, is enabling developers to quickly build blockchains based on field-tested code that is powering a large ecosystem of blockchain projects across the world.

Comprising a voluminous collection of tools and libraries, Substrate is the primary blockchain software development kit (SDK) that was used to build the Polkadot layer-0 protocol and can be used by developers to create any type of blockchain.

Related: What’s the difference between blockchain layers L0 and L1?

The primary block of any blockchain is the node and relies on a decentralized network of these nodes or computers that communicate with each other to maintain the current ledger with the latest transactions. Each node in a blockchain network serves as both the client and the server, requesting and responding to requests for data as per requirements.

What makes a Substrate node unique is the way in which these operational responsibilities are divided horizontally to provide a modular framework for building blockchains. Each Substrate node makes use of two main elements: an outer node that handles network activity and a runtime that determines transaction validity and is responsible for handling changes to the blockchain’s state transition function.

The outer node is responsible for communicating with other nodes, managing the transaction pool, peer discovery and responding to remote procedure calls (RPC) or browser requests using Substrate’s RPC Application programming interface (API). By querying the Substrate runtime or by providing it with information, the outer node uses specialized runtime APIs to handle this communication.

With the Substrate runtime handling everything that happens on-chain, it is the core component of the node for building blockchains and controls how transactions are included in blocks, how blocks are returned to the outer node or how the chain state is changed in response to transactions.

Using host functions to communicate with the outer node, the Substrate runtime enables runtime validity checking and multi-platform compatibility, providing validation proofs for relay chain consensus mechanisms and offering support for fork-less upgrades to the node architecture.

How does Substrate enable you to create a custom blockchain?

Substrate offers greater freedom, flexibility and more optimization abilities than building on top of a general-purpose smart-contract blockchain like Ethereum. Moreover, Substrate-based blockchains can exist as “solo chains” or integrate into Polkadot or Kusama to become parachains.

Developers may choose to first start with a Substrate node template, which is the basic unit in building a blockchain using Substrate and provides a lot of pre-built functionality with default implementations for aspects such as account management, consensus, privileged access and peer-to-peer (P2P) networking.

These Substrate node templates are maintained in the Substrate Developer Hub and developers can also access Substrate’s large, active and helpful builder community that is continuously contributing to the ecosystem.

For more complex projects, though, developers would want a higher degree of freedom to determine their blockchain’s logic and this is where Substrate’s Framework for Runtime Aggregation of Modularized Entities (FRAME) comes into play.

FRAME is one of the most powerful tools provided by Substrate and comprises a number of modules and support libraries to simplify runtime development. These modules are also known as Substrate pallets and represent customizable business logic for use cases such as staking, governance, consensus and other important activities that developers may want to include in the runtime.

Additionally, developers can use its system, support, and executive pallets to provide a vast range of services for the runtime environment. While one can build a Substrate-based blockchain without using FRAME, the different pallets and libraries enable developers to compose a custom runtime logic by using its predefined components as a starting point.

By combining pre-built and custom pallets to infinitely control the features and functionality provided by the Substrate blockchain, developers can achieve specific results with a high degree of flexibility and convenience.

How to create your first blockchain on substrate?

Whether you are a newbie developer or someone with prior experience in using a blockchain framework, Substrate offers tutorials that focus on providing hands-on experience and the Substrate Playground for those who would like to experiment without much guidance.

Substrate tutorials are suitable even for absolute beginners, covering all steps without going much into the coding details. Apart from these tutorials, Substrate provides a number of how-to guides on specific topics and additionally grants access to many open source projects that have been built using Substrate.

However, it is important to understand how to work with pallets on Substrate in order to customize each node’s logic so that it can be used in conjunction with smart contracts to incorporate even more functionality in the resultant blockchain.

Thus, Substrate offers all necessary support right from installation to successfully running your own custom blockchain. While it doesn’t have a native crypto-token, the Polkadot (DOT) token is most used considering the fact that it is compatible with other parachains in the Substrate and Polkadot ecosystem, reflecting its focus on interoperability and scalability.

Ordinals Explorer Ord.io Introduces Rune-Gated Chats

Polkadot (DOT) price rallies 100% and derivatives data points to more upside

Strong fundamentals on the development side and derivatives data suggest that the DOT price could extend its 100% rally over the short-term.

Polkadot (DOT) is a blockchain project designed to interconnect sub-chains called parallel chains or parachains. Each application-specific chain built within Polkadot uses the Substrate modular framework, and this is meant to ease the development process.

The project has been at the center of developers' and investors' attention for most of 2021, but the sharp market-wide correction on May 19 dealt a heavy blow to the DOT price, and the team has been relatively quiet for the past two months.

On July 22, Karura Swap, the first decentralized exchange (DEX) in the Polkadot ecosystem, was launched. The project was created by Acala, a decentralized finance (DeFi) project backed by Coinbase Ventures.

Polkadot (DOT) performance in USD at Coinbase. Source: TradingView

In the past 24 days, DOT rallied by 100% to reclaim the $20 support, even though the price is still 58% below the $50 high. Presently, investors seem unsure of the direction after the $22 level served as resistance.

What's the difference between Polkadot and Kusama?

Polkadot refers to the entire ecosystem of parachains that plug into a single base platform known as the relay chain. This baselayer provides security to the network and handles the consensus, finality and voting logic.

On the other hand, Kusama is an early and unrefined release of Polkadot that is designed to serve as a "canary" network to test governance, staking and sharding under real economic conditions.

Therefore, even if the recently-launched Karura Swap DEX is not running directly on the Polkadot blockchain, it proves its capabilities.

Derivatives data shed light on investor sentiment

Technical analysis charts may be projecting a bullish point-of-view for DOT but what is the derivatives data saying?

For example, if the futures contracts premium is nonexistent, it means that investors are not comfortable creating long positions using leverage. A reduction of regular spot exchange volume shows little interest in the price at current levels. This is especially worrisome after a rally like the one seen from DOT.

Polkadot (DOT) aggregated futures open interest. Source: Bybt

Analysis of the open interest on futures contracts measures the notional currently in play. Instead of measuring how many trades per day, it only takes into account open positions.

After peaking at $1.2 billion on April 17, this metric retraced to $340 million. Albeit much smaller, it currently holds the same levels seen in early February, when DOT was also trading at $20.

Related: Poly Network hacker returns nearly all funds, refuses $500K white hat bounty

Leverage use has been balanced

Longs (buyers) and shorts (sellers) are matched at all times in futures contracts, but their leverage varies. Eventual imbalances are caught by the funding rate indicator and derivatives exchanges will charge whichever side is using more leverage to balance their risk.

Polkadot (DOT) perpetual funding rate. Source: Coinalyze.net

As shown above, from mid-July to Aug. 1, the funding rate was mostly negative, indicating that shorts were the ones demanding more leverage. A negative 0.05% rate every 8-hours is equivalent to 1% per week. However, the situation reversed over the past two weeks after the indicator ranged between 0% and 0.04%, a level which is usually deemed neutral.

The open interest and funding rate show no sign of bullishness from a derivatives trading perspective. There are also no signs of excessive leverage or excitement after the recent rally, which is also positive.

With both indicators currently presenting a neutral stance, DOT's performance will likely depend on its ecosystem development.

The views and opinions expressed here are solely those of the author and do not necessarily reflect the views of Cointelegraph. Every investment and trading move involves risk. You should conduct your own research when making a decision.

Ordinals Explorer Ord.io Introduces Rune-Gated Chats

Polkadot moves towards sharding as Acala Network secures first Rococo parachain slot

Polkadot’s vision for a sharded parachain ecosystem is moving toward becoming a reality.

The Polkadot ecosystem continues to progress, with DeFi platform Acala Network becoming the first to win a parachain slot on the Rococo testnet.

Acala, the self-described decentralized finance hub for Polkadot, announced it had secured the slot on March 26.

Acala was launched in January 2020, with the DeFi consortium striving to create a cross-chain open finance infrastructure for the Polkadot ecosystem. In February, Acala launched an Ethereum Virtual Machine (EVM) based on Polkadot’s Substrate framework, facilitating interoperability with Ethereum-based assets.

The official parachain launch takes the platform a step further towards its goal of providing cross-chain interoperability on the rapidly expanding Polkadot ecosystem.

Polkadot’s multi-chain “parachain” ecosystem will use sharded sidechains to process transactions in parallel. Parachains are acquired in an auction process whereby projects try to outbid each other for the slot.

Polkadot launched Rococo as a parachain testnet in August 2020 to test it’s inter-shard communication protocols before projects progress to deploying on Polkadot’s sister-network Kusama, and eventually the Polkadot mainnet.

Acala also has plans to launch a dollar-pegged stablecoin designed for use across any Polkadot-based project.

A new Polkadot DAO Alliance has also been announced on March 26 to promote the development of decentralized governance in the Polkadot ecosystem.

The Alliance was launched by eleven genesis members, including leading Polkadot projects SubDAO, Plasm, Phala, Stafi, Bifrost, Darwina, Zenlink, and DeepDAO. The alliance also hopes to establish a development fund for Polkadot-based startups, with the announcement stating:

“The Alliance will establish a DAO Ecosystem Development Fund with several million dollars to offer financial support for early-stage projects of DAO and Web 3.0.”

The rapid growth of Polkadot has propelled its native DOT token up the crypto market cap charts in 2021 as it has gained 250% since the beginning of the year, and is currently trading at $32.70 at the time of writing.

Ordinals Explorer Ord.io Introduces Rune-Gated Chats

Compound to offer cross-chain borrowing via Gateway

Cross-chain collateral will soon be available with Compound Finance.

Decentralized finance lending protocol Compound has unveiled a new blockchain that will enable cross-chain collateral.

It is the latest move to mitigate expensive operations on the Ethereum network and enable more interoperability in the DeFi ecosystem.

The new Gateway chain, announced on Mar. 2, has been described as a cross-chain interest rate market that allows users to borrow assets that are native to one chain, such as Ethereum, with collateral from another chain, such as Polkadot or Celo. Compound Finance originally announced the platform in December 2020 when it was called ‘Compound Chain’.

Compound aims to alleviate current fragmentation in the DeFi industry across different blockchains with Gateway and has chosen the next-generation blockchain architecture, Substrate, to do so.

Substrate, which also powers the Polkadot network, is a modular framework that enables developers to create purpose-built high-throughput blockchains. Compound founder Robert Leshner explained the choice of blplatform in the blog post:

“We chose Substrate so that we could focus on building application code, instead of inventing consensus algorithms; it’s a modern framework built on a modern language, Rust.”

To complement Gateway, Compound is planning to build ‘Starports’ which would function as on, and off-ramps, to the new blockchain for users to borrow or deposit an asset as collateral. Leshner elaborated that Starports are the "glue" that connects a blockchain to Gateway, and they can be mixed and matched in various combinations for different networks.

Gateway will also have a native unit of value called CASH which will standardized value across various disparate assets and be used to pay transaction fees. CASH will also be earned by liquidity provision and network validators.

Gateway is currently running on Ethereum’s Ropsten network as a testnet, and audits will be carried out before the mainnet launch, though no date was specified for this.

Ordinals Explorer Ord.io Introduces Rune-Gated Chats