Creation Metamask Compatible Chain for Blockchain Rust
In addition, you continue to work on your blockchain proportion on the basis of rusty, you, it is true, want to add a layer of components with all -haired metamask. In this state, we will direct you through the process of your coin with your metamask.
What is Metamosk?
Metamask-is dispersed for Metamask, the popular mate on the base of the browser, which allows the policies to hurry, set aside, add and manage cryptocurrencies. He introduces the safety to make it -aids with the deentalized adjusts (DAPPS) on the Ethereum blockchain without the need to install full -bodied dapping.
Why do you ask you to make your best with Metamask?
Before you subtress in the solution, let’s get fast, why is it important:
* Integration with the mostly mosquito : Calcies, mathemas, allows the policemakers to be crossed by the interworing Koshelk and the platform of the blockchain.
* EVM subderza in the Real Declee : Deliver your chapel with Metamask, you can include an EVM (Virtual Mashin Ethereum) into a real testing network that is important for the test.
PROVIDERS
Are you going to take care, beaten that:
- You have a basin in the tongue of the rusty program.
- Your project has already tuned the Kli CLI, Net, RPC API and EVM (if still did not make).
- You are familiar with the virtual Mashin Ethereum (EVM) and Webassembly (WASM).
Blood handling
Here is a platforming hand-making on the consumption of metamoski-instant steady for your blockchain rat:
SHAG 1: COLD YOUR FILE Cargo.toml
Take off your file cargo.toml
and lift the section of ‘
`Toml
[Availabicity]
Ethereum = “0.8,11”
`
This is an enlargement, conjoining with ethereum.
Stag 2: Add new plugin Metamask-Adapter
Submit the new directory for your plagins Metamask Adapter and add the file with the name cargo.toml
with the following content:
`Toml
[Availabicity]
Ethereum = “0.8,11”
`
Set up the new file with the name Metamask-adapters.toml
in Tom Same Catalog and insert the following code:
`Toml
metal packing;
#[CFG (Windows)]
pub mod Windows;
#[cfg (unix)]
Pub mod Unix;
`
This is a two plugin for the Windows and Unix operatives.
Shag 3: Submit Adapter Metamask
Submit the new file with the name Metamask.rs
in Tom Catalog, and your project. This will be the content of the adapter Metamask:
`Rust
Use STD :: FS;
Use STD :: PATH :: PATHBUF;
PUB STRUCT METAMASKADAPTER {
PUB KEY_PATH: String,
}
Impl Metamaskadapter {
PUB FN NEW (KEY_PATH: & Str) -> Self {
Self {key_path}
}
Pub Async FN Create_Chain (
& shave,
UCHOL WRITE: & Str,
Network_name: & Str,
Chain_id: U64,
) -> Result <(), String> {
// Create new adapter Metamask
Let mut file_path = Pathbuf :: from ("./ Metamask-adapters.toml");
FS :: CREATE_DIR_ALL (& file_path)?;
// Write adapter's configu
WRITE_TO_FIL (& Self.key_PATH, & Network_name)?;
Good (())
}
Pub Async FN Connect (
& shave,
UCHOL WRITE: & Str,
Network_name: & Str,
Chain_id: U64,
) -> Result <(), String> {
// Read the adapter's configuration from the file
Let Key_path = Read_file (& Self.key_path)?;
// Put up to Metamask with aid adapter
Connect_to_meta_mask (UCHOL, Network_name, Chain_id, & Key_path);
Good (())
}
}
This realization provides the basin structure for the creation and connection to the metamask.
Shag 4: Use Adapter Metamask to project rust
Consider your load.
Để lại một bình luận