-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Account mirrors | ||
|
||
There are two types of accounts in Unique Network: | ||
|
||
- Native substrate accounts. Generic substrate account looks like `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY` | ||
- Ethereum accounts, a 42-character hexadecimal string starting with `0x` | ||
|
||
Because of different formats, substrate and ethereum addresses cannot interact directly. For example, you cannot send tokens from Metamask to the substrate address; it requires the ethereum format. | ||
|
||
However, it is possible to mix these two worlds thanks to account mirroring. | ||
|
||
## Account mirrors | ||
|
||
Mirroring is a mechanism that allows you to get address representation in a different format—substrate for ethereum address and ethereum for substrate. | ||
|
||
You can play around with address converter in the [Reference section]('../../../../reference/tools.md'). | ||
|
||
For example: | ||
|
||
- Ethereum mirror for `5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY` is `0xd43593c715Fdd31c61141ABd04a99FD6822c8558` | ||
- Substrate mirror for `0x1B8EeEC6eD7e9C6B98291A8274c006e251902Ef3` is `5FkhL2YH6rZD2AspxMBoUfFnA4GwWVKHVTbL1kChhYMvSq7B` | ||
|
||
> It is very important to note that you can not get the original account from the mirror account. Because of the different sizes, this is a one-way mapping. | ||
Here is the primary use case for mirrors: | ||
|
||
1. If you want to send tokens from substrate account to ethereum account - send it to it's substrate mirror. | ||
|
||
2. The opposite operation works with one tradeoff. Tokens sent to the ethereum mirror of a substrate account will not directly top up the substrate account's balance. However, the substrate account can "withdraw" tokens from its ethereum mirror using `api.tx.evm.withdraw` method. | ||
|
||
## Code example | ||
|
||
To get an accounts mirror, use `Address` util from `@unique-nft/utils.` | ||
|
||
```ts | ||
import { Address } from "@unique-nft/utils"; | ||
|
||
const ethMirror = Address.mirror.substrateToEthereum('5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY'); | ||
// 0xd43593c715Fdd31c61141ABd04a99FD6822c8558 | ||
|
||
const subMirror = Address.mirror.ethereumToSubstrate('0x1B8EeEC6eD7e9C6B98291A8274c006e251902Ef3'); | ||
// 5FkhL2YH6rZD2AspxMBoUfFnA4GwWVKHVTbL1kChhYMvSq7B | ||
``` | ||
|
||
|
||
The following articles will teach you more advanced concepts that make the developer and user experience smoother. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
# EVM docs | ||
# Intro to Unique EVM | ||
|
||
Welcome to the Ethereum Virtual Machine (EVM) section. Here, we introduce how developers can utilize familiar Ethereum-based tools to interact with Unique Network's advanced NFT pallet. | ||
|
||
Tech demo: | ||
<TestMetamask/> | ||
Unique Network employs Substrate’s flexibility to deliver native NFT features, boosting scalability and customization in digital asset management. It also supports EVM compatibility, allowing Ethereum toolsets to manipulate NFTs. This enables the use of Solidity and other Ethereum standards for NFT interactions on Unique Network, creating a flexible development environment within the Polkadot ecosystem. | ||
|
||
This documentation will guide you through deploying and interacting with NFTs via the EVM layer, offering a comprehensive toolkit for both Substrate and Ethereum developers. | ||
|
||
## Connect to the EVM on Unique Network | ||
|
||
You can connect to Unique utilizing familiar tools such as MetaMask and Ethers.js. These tools allow developers to interact with and deploy smart contracts as they would on any Ethereum-compatible network. | ||
|
||
You can find connection settings in [reference](../../reference/index.md). |