Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the necessary Rust packages for blockchain development?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "what are the necessary Rust packages for blockchain development". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the necessary Rust packages for blockchain development"?

Rust is a new generation of development language with great potential. This paper compiles nine mainstream Rust packages for the development of block chains such as Ethernet, Bitcoin, tendermint, eosio, polkadot, etc., which can be used for the rapid development of block chain applications.

1. Rust-bitcoin: bitcoin blockchain rust development kit

Rust-bitcoin is used to develop Bitcoin blockchain-related applications. It supports serialization / deserialization, parsing and executing bitcoin-related data structures and network messages. The features supported include:

Serialization / deserialization of Bitcoin Protocol messages

Serialization / deserialization of bitcoin blocks and transactions

Serialization / deserialization of Bitcoin scripts

Creation, serialization / deserialization and verification of private keys and addresses, complete support for built-in BIP32

The creation, operation, merging and finalization of PSBT

Pay-to-contract transactions that support Blockstream side chains

2. Rust-bitcoincore-rpc: bitcoin node JSON-RPC API client development kit

Rust-bitcoin does not include the JSON RPC API encapsulation of bitcoin nodes, and rust-bitcoincore-rpc fills this gap. For example:

Let rpc = Client::new (url, Auth::UserPass (user, pass)). Unwrap (); let _ blockchain_info = rpc.get_blockchain_info ()?; let best_block_hash = rpc.get_best_block_hash (); println! ("bestblock hash: {}", best_block_hash); let bestblockcount = rpc.get_block_count (); println! ("bestblock height: {}", bestblockcount) Let best_block_hash_by_height = rpc.get_block_hash (bestblockcount)?; println! ("bestblock hash by height: {}", best_block_hash_by_height); assert_eq! (best_block_hash_by_height, best_block_hash); let bitcoin_block: bitcoin::Block = rpc.get_by_id (& best_block_hash); println! ("bestblock hash by `get`: {}", bitcoin_block.header.prev_blockhash) Let bitcoin_tx: bitcoin::Transaction = rpc.get_by_id (& bitcoin_block.txdata [0] .txid ()); println! ("tx by `get`: {}", bitcoin_tx.txid ()); 3. Rust-web3: Yi Taifang Block chain rust Development Kit

Rust-web3 is an implementation of the rust version of the ethernet web3.js development kit. Specific features include:

Support for contract invocation, ABI coding

Support for batch requests

Support for HTTP/IPC/WebSocket transport

Many standard or non-standard data types are supported, such as:

U256 H256 address (H160)

Transaction, TransactionReceipt, RichBlock, Work, SyncStats of Parity

Support most of the standard ethernet RPC API:

Eth:eth_*: support

Eth Filters:eth_*: support

Eth Pubsub:eth_*: support

Net_*: support

Web3_*: support

Personal_*: support

Traces_*: does not support it now.

Support for Parity extension RPC API:

Read-only api:parity_*: support

Partial support of account api:parity_*:

Aggregate api:parity_*: support

Signer_*: support

Custom API: support

4. Ethereum-tx-sign: Etaifang offline signature rust development kit

Ethereum-tx-sign allows you to sign ethernet transactions offline in Rust code. For example:

/ / 1 mainnet, 3 ropstenconst ETH_CHAIN_ID: U32 = 3 Let tx = ethereum_tx_sign::RawTransaction {nonce: web3::types::U256::from (0), to: Some (web3::types::H160::zero ()), value: web3::types::U256::zero (), gas_price: web3::types::U256::from (10000), gas: web3::types::U256::from (21240), data: hex::decode ("7f7465737432000000000000000000000000000000000000000000000000000000600057"). Unwrap (),} Let mut data: [U8; 32] = Default::default (); data.copy_from_slice (& hex::decode ("2a3526dd05ad2ebba87673f711ef8c336115254ef8fcd38c4d8166db9a8120e4"). Unwrap (); let private_key = web3::types::H256 (data); let raw_rlp_bytes = tx.sign (& private_key, & ETH_CHAIN_ID); let result = "f885808227108252f894000000000000000000000000000000000000000080a\ 47f746573743200000000000000000000000000000000000000000000000000\ 00006000572aa0b4e0309bc4953b1ca0c7eb7c0d15cc812eb4417cbd759aa09\ 3d38cb72851a14ca036e4ee3f3dbb25d6f7b8bd4dac0b4b5c717708d20ae6ff\ 08b6f71cbf0b9ad2f4"; assert_eq! (result, hex::encode (raw_rlp_bytes)) 5. SputnikVM: ethernet virtual machine realized by pure rust

SputnikVM is an Ethernet virtual machine implemented entirely in rust. The main features include:

Standalone: can be loaded or integrated into an existing APP as a separate process

Generic: supports different ethernet block chains, such as ETC, ETH or private chains

Stateless: contains only one execution environment connected to a separate state store

Fast: the focus of implementation is on performance

SputnikVM requires rustc 1.33.0 (2aa4c46cf 2019-02-28) and does not support Rust 1.32.0 and earlier.

6. Tendermint-rs:tendermint Block chain rust Development Kit

Tendermint is a high-performance block chain consensus engine that supports Byzantine fault tolerance. Tendermint-rs is used to access the Tendermint block chain, requiring Rust 1.39 +.

7. Monero-rs:Monero Block chain rust Development Kit

Monero-rs is used to access the Monero block chain, supporting Monroe currency-related serialization / deserialization and parsing of data structures or network messages. Specific features include:

Support for serialization / deserialization of Monero blocks and transactions

Support for the creation, serialization / deserialization and verification of addresses and subaddresses

Support for creation, serialization / deserialization and verification of private and one-time keys

Most structures support Serde

8. Eosio-rust:EOSIO Block chain rust Development Kit

Eosio-rust is the Rust version of EOSIO SDK, which provides a set of API for using Rust to develop intelligent contracts and full-stack applications on the EOSIO block chain.

9. Substrate: mass murderer

The next-generation development framework, produced by Parity, which supports blockchain innovation, has been used in the development of Polkadot and is a sharp weapon for small and medium-sized enterprises to develop blockchain platforms with independent intellectual property rights.

At this point, I believe you have a deeper understanding of "what are the necessary Rust packages for blockchain development?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report