Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Rust for Blockchain Application Development
  • Table Of Contents Toc
Rust for Blockchain Application Development

Rust for Blockchain Application Development

By : Akhil Sharma
3.8 (5)
close
close
Rust for Blockchain Application Development

Rust for Blockchain Application Development

3.8 (5)
By: Akhil Sharma

Overview of this book

Before Rust, blockchain developers didn’t have a systems programming language that was type-safe, fast, and, at the same time, had stable and easy memory management. Rust proved to be a boon for developers and works as the perfect solution for not only blockchain and protocol development but also dApp development. Rust for Blockchain Application Development focuses on demonstrating solutions that can help blockchain developers productize decentralized applications using Rust, which is a complex language with a steep learning curve. This book starts with basic Rust language concepts and then builds on these concepts to enable you to develop your own blockchain from scratch. As you progress, you’ll learn how to build dApps on popular chains like Solana and NEAR. You’ll also be guided through creating Ethereum dApps using Foundry (Rust). Finally, you’ll develop a custom blockchain using Substrate by Parity (Polkadot). The book provides a complete 360-degree view of Rust in the blockchain ecosystem. By the end of this Rust book, you’ll have a thorough understanding of how to apply your Rust knowledge to building dApps and blockchains from scratch.
Table of Contents (19 chapters)
close
close
1
Part 1:Blockchains and Rust
4
Part 2: Building the Blockchain
8
Part 3: Building Apps
12
Part 4: Polkadot and Substrate
15
Part 5: The Future of Blockchains

Creating the genesis block

The very first block in a blockchain is called the genesis block. While we haven’t written any code for the blockchain, we would like to create the first block and get things started. The genesis block doesn’t store a previous hash since no block comes before it.

In the block.rs file, we’ll begin by implementing functions specific to the Block type. To achieve this, we must create a code block, like so:

impl Block{
// Functions related to the Block type can be implemented here
...
}

The impl keyword in Rust is used to define a set of methods associated with a specific type – in this case, Block. This block acts as a container for functionality that is directly associated with the block structure, allowing us to define what operations can be performed with or on a block.

Move the new_block function that we created in the Block section, where we learned how to create a block, to inside the preceding code block and all...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Rust for Blockchain Application Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon