# About

## **WEMIX3.0 Library**

### **Preface**

WEMIX3.0 Library provides a transparent record keeping service and offers ease of access to such technical documentation compilation open to the community.

The importance of accurate documentation, information management, and reliability of records can be found through the Joseon Dynasty.&#x20;

This historical reference is to illustrate the key ingredients of a successful records archive in the new Web3 world and the figurative comparison it has with how all WEMIX3.0 technical documentations will be securely stored and unreserved to the public.

### **The Joseon Dynasty, the 518-year legacy**

The Joseon Dynasty is considered as the longest period of a single Dynasty in the world based on veritable records comprising 1,893 volumes of the annals.&#x20;

The propensity toward stability and peace on the Korean Peninsula during and even prior to the Joseon Dynasty is believed to have resulted from a variety of factors revolving around early ruling ideology structured specifically to maintain a long and healthy era.&#x20;

This unprecedented success can be traced back to the examination and analysis of its characteristics.

#### **Governance: Royal decree based on decentralized council**

Dynasty is essentially a ruling system with absolute power concentrated on the king or the monarch. The political system of Joseon Dynasty, however, was structured on dispersion of central power through the Three State Council(Chief State, Left State, and Right State) and the Six Ministries(Personnel, Taxation, Rites, Defense, Justice, and Works).

The three State Councils were the highest organ of government under the Joseon Dynasty and were entrusted to deliberate over major decisions, advising the king, and conveying royal decisions to the Six Ministries. Through this political system, the king commanded absolute loyalty from his officials and subjects, while the officials were also expected to serve in advisory capacity to ruling the nation. This approach of decentralized governance by the Joseon Dynasty is the reason for it being the world’s longest and resolute dynasty in history.

#### **Dissemination & Mass Adoption: Hangul, the Korean alphabet**

The power of the bureaucrats in the decentralized governance model of the Joseon Dynasty must be well balanced in order that the officials as well as the nobles of the class status system were prevented from misdeeds associated with greed through monopolization of information.

As a result, Hangul was created in 1443 by king Sejong the Great in an attempt to increase literacy of the lower class who were generally uneducated and illiterate of the Hanja(Classical Chinese) due to its difficulty. Hangul was invented so that the people could learn to read and write with ease to be given the same information as that of the higher class. The mass adoption of Hangul achieved a new level of fairness, freedom, and hope for the general public approximately 600 years prior to modern times. &#x20;

#### **Transparency & Immutability: The Veritable Records of the Joseon Dynasty**

During the Joseon Dynasty, professional Chronicler recorded and maintained detailed accounts of national affairs, the king’s reign, and activities of the state throughout the dynasty. It is shown that a Chronicler had recorded an event that the king had requested to be omitted while also recording the king’s request itself in the Annals. As no one, including the king, was allowed to read the records, Chroniclers were ensured of their independence and neutrality without being affected by any sort of external pressure.&#x20;

The original drafts recorded by the Chroniclers and the veritas records compiled after the king’s death were copied and secretly stored in history archives throughout the country to prevent them from being lost in war or natural disasters.

#### **One Vision: For the nation and its people**

The reason behind the unorthodox institutions sought by the Joseon Dynasty which include decentralization, mass adoption of information, and transparency of historical records in a monarchical era was because the vision and purpose of the dynasty was centered around the development of the nation and the stability in the lives of its people. This is how the Joseon Dynasty became the world’s longest-lasting and peaceful single dynasty.

### **WEMIX3.0 and WEMIX3.0 Library**

WEMIX3.0 is built to be a mega-ecosystem encompassing one public chain mainnet, one private chain, a stablecoin protocol, and three key platforms home to numerous DApps. To this end, the WEMIX3.0 Library functions as the archive where technical documentation and service philosophy of all services and platforms of the WEMIX3.0 mega-ecosystem are securely recorded and transparently disclosed to the public in order to facilitate the shared vision of WEMIX3.0 with NCPs and community members.

The management and operational policies of these technical documentation and service philosophy are based on the general values of blockchain and are incorporated by the WEMIX3.0 Library which include decentralization, dissemination of information, transparency, security, and community-friendly accessibility.

### **Postface**

WEMIX3.0 Library is designed to provide the community with the right tools and information required to understand the philosophy behind the mega-ecosystem and to enable them to participate in the growth of the community. Through WEMIX3.0 Library, community members and participants of the ecosystem can easily access what they need to create the world that they desire within the WEMIX3.0 mega-ecosystem.

The only limitation is your own imagination.

Welcome onboard WEMIX3.0, an experience-based, platform-driven & service-oriented mega-ecosystem.

&#x20;

WEMIX Foundation

##

![Gyeongbokgung, the main royal palace of the Joseon Dynasty](/files/VuLnLAmbTFk2dzDJeXeR)

## WEMIX3.0 도서관

### **시작하며**

WEMIX3.0의 기술문서를 보관하는 도서관 서비스를 제공하며, 정확한 정보를 쉽게 제공하고 이를 기록해 놓는 것이 커뮤니티에 얼마나 중요한지에 대해 예전 동아시아의 조선왕조의 이야기를 예를 들며 서문을 대신합니다.

### **조선왕조 518년\***

조선왕조는 중세시대인 13세기 이후 전세계 왕조 중 단일 왕조로서 가장 오래 유지되었던  왕조입니다. 여러 가지 평가가 있을 수 있겠지만 조선왕조가 이토록 세계적으로 전례를 찾아볼 수 없도록 길게 유지되었을 수 있었던 이유를 다음과 같은 특징에서 찾아볼 수 있습니다.

#### 지배구조: 탈중앙화된 신권정치

왕조는 기본적으로 왕에게 모든 권력이 집중되는 구조입니다. 그러나, 조선왕조는 3명의 정승을 비롯한 신하들이 왕에게 의견을 개진하고 결정을 견제하며 나라와 백성을 위한 선정을 베풀도록 도왔습니다. 왕 또한 이러한 신하들의 견제를 당연한 것으로 여기고 의견에 귀기울였습니다. 이와 같이, 왕조이지만 왕에게 권력이 집중되지 않은 탈중앙화된 조선왕조의 지배구조는 몇번의 전쟁과 혼란에도 세계적으로 가장 오랫동안 왕조를 유지할 수 있었습니다.

#### 정보의 대중화: 한글창제

임금 역시 지배구조에서 신하들과의 협의를 거친 조선왕조는 또한 신하들이자 신분제도상의 최상위에 위치한 양반들의 정보의 독점과 이에 따른 전횡을 방지하기 위한 노력을 많이 하였습니다. 이에 세종대왕은 조선의 모든 정보가 어려운 한자로 기록되어 교육의 기회를 갖지 못하는 백성이 공정하지 못한 환경에 놓인 것을 해결하기 위해 누구나 배우기 쉽고 말하는대로 그대로 표기할 수 있는 한글을 발명하였습니다. 한글을 세계에서 유래를 찾아보기 힘들 정도로 발명자가 밝혀져 있는 문자이며, 한글을 통해 지배계층에 의해 독점되던 정보와 지식이 일반 백성에게까지 전파되었습니다.

#### 투명성: 조선왕조실록

조선왕조는 왕의 치세에 대해 사관(Chronicler)이 24시간 왕의 옆에서 기록했습니다. 심지어 방금 일어난 일을 기록하지 말아달라고 왕이 요청했다는 사실까지 기록할 정도로 조선왕조는 사관이 어떠한 외부적 압력에도 영향을 받지 않고 역사를 기록하게 했으며, 현재 왕은 자신의 역사 기록을 볼 수 없도록 하였습니다.

또한, 사관에 의해 기록된 원본인 사초와 왕의 사후에 편찬된 실록은 전쟁이나 재해 등으로 소실되는 것을 방지하기 위해 전국 각지에 사고를 만들어 복사본을 분산해서 보관하였고, 이 사고의 위치는 철저히 비밀이었습니다.

#### 하나의 목적: 왕조를 중심으로 한 조선의 번영

이렇게 탈중앙과 정보의 대중화, 역사의 투명성 등 왕조시대에 용납하기 힘든 여러 제도들을 왕조가 받아들였던 이유는 단 한 가지, 왕조의 목적이 권력의 유지보다는 국가의 발전과 민생의 안정에 중심이 있었기 때문입니다. 때로는, 왕과 신하의 대립, 신하와 신하의 갈등, 정부와 백성의 충돌이 있었음에도 전례를 찾아볼 수 없는 500여년 동안의 단일 왕조인 조선왕조는 위에서 말한 하나의 비전과 철학을 가졌기 때문입니다.

### **WEMIX3.0과 위믹스 도서관**

WEMIX3.0의 위믹스 커뮤니티의 번영을 위해 하나의 메인넷이자 퍼블릭체인, 하나의 프라이빗체인, 스테이블코인 프로토콜 및 3개의 플랫폼과 수많은 디앱이 공존하는 거대 생태계를 지향합니다. 이를 위해, 위믹스 도서관에서는 위믹스3.0 내의 주요 기술백서와 서비스 철학을 투명하게 공개하고 전파함으로, 재단으로 시작된 생태계가 수많은 NCP와 커뮤니티 구성원이 비전을 공감하고 함께 성장시키는데 도움이 되고자 합니다.&#x20;

이러한 기술문서와 서비스 철학은 앞에서 말한 블록체인의 가치와 닮아있는 조선왕조의 지향 가치인 탈중앙화, 정보의 대중화와 투명성에 입각한 정확한 거래의 기록, 분산을 통한 보안을 포함하여 안정적인 기술, 커뮤니티 친화적인 운영과 정책을 포함합니다.

### **맺음말**

WEMIX3.0 도서관은 커뮤니티 구성원이 생태계의 기술적 기반과 서비스 철학에 대해 정확한 정보를 파악하고, 쉽게 커뮤니티에 참여할 수 있도록 조성되었습니다. 이를 통해, WEMIX3.0 구성원들은 자신들이 만들고자 하는 세상을 쉽고 빠르며 정확하게 구현하게 도와주는 것에 그 목적이 있습니다.

유일한 한계는 당신 자신의 상상력입니다.

플랫폼 주도의 서비스 지향 거대 생태계인 WEMIX3.0에 오신 것을 환영합니다.

&#x20;

위믹스재단

――――――――――――

\*조선왕조의 기간은 여러 기준에 따라 다를 수 있지만, 태조 이성계의 조선 건국 이후 고종의 대한제국 창제건원까지의 기간입니다.

## WEMIX Docs

{% content-ref url="/spaces/Hf9f4FuSvei1yoMuW1wT" %}
[WEMIX3.0 (ENG)](https://docs.wemix.com/en/)
{% endcontent-ref %}

{% content-ref url="/spaces/iXnTk8WgxaTaNidAuUYQ" %}
[WEMIX3.0 (KOR)](https://docs.wemix.com/ko/)
{% endcontent-ref %}

## WEMIX Stake

{% content-ref url="/spaces/9Bl5EtEX8OIJgOa9aUHY" %}
[Broken mention](broken://spaces/9Bl5EtEX8OIJgOa9aUHY)
{% endcontent-ref %}

{% content-ref url="/spaces/tPeeTJPHq2GYh5crHwN4" %}
[Broken mention](broken://spaces/tPeeTJPHq2GYh5crHwN4)
{% endcontent-ref %}

## NILE

{% content-ref url="/spaces/qlGy1XJXC3snSpxBiv12" %}
[NILE (ENG)](https://docs.wemix.com/nile-en/)
{% endcontent-ref %}


# Introduction

## WEMIX3.0 Summary <a href="#wemix3.0-overview" id="wemix3.0-overview"></a>

WEMADE looks at the world in a slightly different light. As times change, we look the market and analyze it, and create a plan that can be put into action. And then, actually doing it and producing results, ultimately leading to other followers following WEMADE's path.

Throughout the WEMIX1.0 & 2.0 era, our efforts to create a balanced ecosystem have enabled us to gain extensive knowledge, data and experience. And these are all the more important things that WEMADE is once again playing a role in transforming the industry and market.

WEMIX3.0 is a true blockchain ecosystem designed to support the upcoming dApp, games, DAO, DeFi, NFT, and more.

* EVM-compatible Public Chain
* Stake-based Proof of Authority(SPoA) Consensus
* 40 Highly Qualified Node Council Partners(Authorities)
* Max 4,000 TPS Throughput
* PMR(Permanent Minting Reward): 0.5 WEMIX per Block&#x20;

## WEMIX3.0 Ecosystem <a href="#wemix3.0-ecosystem" id="wemix3.0-ecosystem"></a>

The WEMIX3.0 Mainnet is based on Ethereum Virtual Machine (EVM) in the Stake-based Proof of Authority (SPoA) consensus algorithm. The new Mainnet provides the best security based on decentralized On-Chain Governance through 40 Node Council Partners (NCPs), while ensuring fast TPS at the same time.

WEMIX$, with USDC as collateral, is an important good in the dApp ecosystem and serves to relieve the unpredictable price volatility of tokens and the resulting anxiety. WEMIX$ provides currency stability, which makes various dApps more stable in the ecosystem. By relieving the anxiety of the price volatility, WEMIX3.0 takes the ideal form of an open platform. &#x20;

At the heart of WEMIX3.0, there are three important services. We support WEMIX PLAY(a blockchain gaming platform), NILE(a DAO service based on the Neith protocol), and decentralized financial services.

## Indemnification Provision <a href="#disclaimer" id="disclaimer"></a>

WEMIX3.0 blockchain is forked from Ethereum and refers to various Ethereum open source project technologies. The executed smart contract is implemented in Ethereum-based solidity language, and has a grammar similar to JavaScript as a Turing completeness form of computer language. Therefore, it is possible to program with a high degree of freedom without restrictions on implementation.

The technology stack of WEMIX3.0 blockchain was developed using traditional Ethereum and supports EVM and library equivalent to Ethereum. WEMIX's improvement proposal fully accommodated the Ethereum improvement proposal (EIP) according to the configuration of the WEMIX ecosystem, and was adopted through some migrations. This makes it easier for members of the WEMIX3.0 ecosystem to participate in the WEMIX3.0 blockchain by forming an Ethereum-like ecosystem.

Claims, contents, algorithms, roadmaps, etc. presented in this document are the result of this project effort. As a result, the person using the Software is deemed to have been bound and agreed to comply with all licenses applied thereto.


# Blockchain Basics

This section covers the concept of blockchain.

* [What is Blockchain?](/en/introduction/blockchain-basics/what-is-blockchain)
* [Consensus Algorithm](/en/introduction/blockchain-basics/consensus-algorithm)
* [Transactions](/en/introduction/blockchain-basics/transactions)
* [Gas](/en/introduction/blockchain-basics/gas)
* [Account](/en/introduction/blockchain-basics/account)

## Glossary

<figure><img src="/files/X23bJqQzgeYkP6PdoZ8o" alt=""><figcaption></figcaption></figure>


# What is Blockchain?

## What is Blockchain?

Blockchain is a distributed ledgers that can mathematically guarantee the consistency of data without a third party and cannot be forged or altered. It consists of distributed database technology, and makes decisions based on consensus algorithms using multiple participant votes. In addition, blocks composed of hash values are chained together, making it almost impossible to forge or falsify data.

{% hint style="success" %}

#### Basic Mechanism for Blockchain

Transaction logging → Agreement(Block creation) → Chain connection with previous blocks → Ledger sharing
{% endhint %}

## Key features of a Blockchain

### Decentralization

* As a basic characteristic of blockchain, there is no centralized group and there is no 'third-party trust agency'.
* Blockchain does not have a central administrator because it stores and attests data by many participants.
* Transactions between individuals are possible through an electronic contract called 'Smart Contract' instead of a central administrator.

### Expandability

* Opened sources allow any network participant to build, connect, or expand.
* It is easy to expand between systems that require data sharing through the network, and you can also consider expanding to existing systems through APIs.

### Transparency

* All transaction records linked to the blockchain are publicly accessible.&#x20;
* All transactions bring out into the open and It is possible to reduce security, supervision, and regulatory costs.

### Integrity

* Once the data is embedded in a block and connected to a chain, it is virtually impossible to change the data.
* This is because the blocks connected to the blockchain have a specific relationship with the previous block cryptographically, so you have to change all the blocks before the block you want to change.

## Key elements of a Blockchain

### Distributed ledger technology

A distributed ledger is a database in which all the transactions that occurs in a blockchain is shared and stored. In the existing database, data could be registered, modified, and deleted, but once recorded transactions cannot be deleted in the blockchain.

### Smart Contracts

Smart Contract is a technology that allows contracts to be made only by code without a third party agency. In the existing Bitcoin, it only operated with UTXO (Unspent Transaction Outputs), so it was only possible to make simple transactions, but it was not possible to make a contract. However, with the advent of smart contracts, the blockchain ecosystem could be expanded as various codes were created based on contracts as well as transactions.

### PKI

Public Key Infrastructure (PKI) is usually considered a high-level identity authentication system. However, the centralized nature of the Certificate Authority often leads to problems with data ownership and reliability. As a result, many people have no choice but to trust the certification authority.

No certification authority exists in the blockchain. The private key is kept by the user and the public key is stored in the blockchain to sign with the private key owned by the user when trading, and the blockchain determines whether the signature is valid.


# Consensus Algorithm

## Consensus Algorithm Type

Consensus algorithms are algorithms for participants to make unified decisions through decision-making. In the blockchain, consensus algorithms are also called consensus models, consensus methods, consensus mechanisms, and consensus protocols, and there is no central agency to mediate decision-making. This stems from the conviction that blockchain data will not be forged or altered because all participants have the same data at the same time. If someone else malicious attempts to falsify the data, you have to change the information about the previous block at a huge price. Consensus algorithms provide algorithms that allow multiple nodes to mutually validate data and generate correct blocks based on consensus.

### PoW (Proof of Work)&#x20;

PoW (Proof of Work) is a representative consensus algorithm used in Bitcoin as a proof of work method. In order for the miner to be rewarded, the block must be created through mining. Block generation is judged based on hash power, and hash power is a criterion for determining how much computing power can solve problems in a short time. Block creation obtains permission to create blocks by nodes that provide the highest hash power.

### PoS (Proof of Stake)

PoS (Proof of Stake) is a proof-of-equity approach that allows nodes with large stakes to create blocks. Authorization to create blocks in proportion to equity, not PoW's work. In the case of PoW, compensation is paid at the time the block is created, while PoS is compensated with interest on the equity. The proof-of-equity scheme also penalizes the creation of incorrect blocks to prevent malicious intentional block generation. Anyone can participate in the blockchain network, as long as they have a coin equivalent to their stake, so that more nodes can participate in the consensus process in a decentralized environment.

### DPoS (Delegated Proof of Stake)

DPoS (Delegated Proof of Stake) is a delegated equity demonstration method in which nodes with stakes determine the block creator through voting. In other words, all nodes do not have block creation rights, but they elect a parent node through a vote to delegate authority. It has fast performance and scalability because a small number of agreed parent nodes create blocks.


# Transactions

## What is Transactions?

In a blockchain, if the block is an account book, a transaction can be viewed as a transaction history recorded in the account book. Transactions are records of all transactions that occur on the blockchain. Transactions include transaction times, transmission and reception addresses, transaction assets, and fee information.

## Principles of Transactions

When a transaction occurs, the transaction does not occur immediately. Blockchain requires verifier approval.

<figure><img src="/files/hRt7WErjgo1WKp4XOuD7" alt=""><figcaption></figcaption></figure>

Suppose Bob sends 50 WEMIX (including fees) to Alice. Bob sends a transaction to Alice stating that he will send 50 WEMIX. Verify that Bob's address has quantities that can be transferred. If there is no transferable quantity, the transaction fails, but if there is a transferable quantity, the block constructor waits until the block is created. If the transaction sent by Bob was successfully recorded when the block was created, perform that transaction. Out of 100 WEMIX at Bob's address, 50 WEMIX will be sent to Alice's wallet address.


# Gas

## What is Gas?

'Gas' is a unit of measurement for performing transactions or executing smart contracts in a blockchain network. Every action performed in a blockchain network costs gas. The gas cost depends on the complexity of the contract and the speed at which it is carried out. If you want to perform a transaction quickly, you can pay more gas than the base gas cost, and if you like to do it slowly, you can pay only the base gas cost.&#x20;

Gas costs are important because transactions submitted to the network help to pay appropriate fees. By requiring a transaction to pay for each action it performs (or by allowing a contract to be performed), the network performs many intensive tasks that are of no value to anyone, so that it does not get bogged down.

## Gwei

The unit of gas cost is Gwei. It is calculated as 1 WEMIX = 1 billion Gwei. When a transaction occurs, the higher gas cost, the first recorded in the block, and the block creator will receive a fee as a reward. In a blockchain, the minimum unit is calculated as wei, 1 WEMIX = 10^18wei. Since wei has many digits, it is expressed in Gwei units.

<figure><img src="/files/mlUvcxvasjZZIIkKIvTa" alt=""><figcaption><p>Ethereum Basic Gas Fee</p></figcaption></figure>

<figure><img src="/files/NLngDRlIJxnIyfTENWFw" alt=""><figcaption><p>WEMIX Gas Fee Setting</p></figcaption></figure>

## Base Fee

Base Fee is the minimum amount to be paid as a basic fee. These costs are not fixed, and if there were a lot of transactions in the previous block, the minimum payment would be higher, and if there were less transactions, the cost would be lower. Base Fee was previously paid as compensation to the block creator, but has been incinerated after EIP-1559 reflection.

## Gas Limit

Limits are set to limit gas costs. If the gas cost is insufficient to perform the transaction, the transaction will fail. Therefore, it is desirable to pay an appropriate amount of gas cost. If the gas cost exceeds the limit, the excess fee after the block creation will be returned.


# Account

WEMIX3.0 blockchain has External Owned Accounts (EOA) and Contact Accounts (CA).

## EOA

EOA is simply a user account. A private key is generated through a wallet, and a public key is generated through a private key using the ECDSA algorithm. The EOA is authorized by the private key that the user has.

## CA

CA is authorized by the contract code. Therefore, the CA does not have a private key. An electronic signature is required to generate a transaction and is signed with a private key. EOA has a private key, so it can generate transactions, but CA cannot create transactions on its own. The CA can only perform internal transactions at the request of another account.


# Design

This chapter contains important technical instructions to the WEMIX3.0 Blockchain.

* [Architecture](/en/design/architecture)
* [Consensus](/en/design/consensus)
* [Governance](/en/design/governance)
* [Minting](/en/design/minting)
* [EIP1559](/en/design/eip1559)
* [Fee Delegation](/en/design/fee-delegation)
* [Roadmap](/en/design/roadmap)


# Architecture

## WEMIX3.0 Client Network

WEMIX Blockchain Client is an implementation of WEMIX3.0 that keeps network data safe and accurate by validating every transaction in each block. In Phase 1, WEMIX3.0 was created by forking Go-ethereum Version 1.10.16 based on the Go language, and applied the London Hard Fork. In Phase 2, WEMIX3.0 is reflected up to Version 1.10.18 and the code will continue to be updated.&#x20;

![WEMIX3.0 Client Architecture Stack](https://lh5.googleusercontent.com/b2N2tBXyib72Kk9VSzaPvZ_-GYcbFP6zwGTvtNUhZyXhdENcb6tolBl06vwqPd1hzsVRYxUz45V-YiEcQngmsmWrFxB1Zq9WbFHauS_mLlowwTQTfDqUuqA9KOh1r-2ZYPjqBQ)

WEMIX3.0 Client has a layering system as shown in the figure above and achieved high-performance real-time performance by modifying Governance, Consensus, and Network Protocol elements in go-Ethereum.

## WEMIX3.0 Network Structure

The WEMIX blockchain network consists of three types of logical networks: BP, BN, and EN. These networks make up the Block Producer Network (BPN), Bridge Node Network (BNN), and End Node Network (ENN), respectively. The figure below shows the overall topology of the WEMIX mainnet. An End Node Network (ENN) can be viewed as a perimeter network directly connected to a Bridge Node Network (BNN).

![WEMIX3.0 Network Structure](https://lh6.googleusercontent.com/3dLIKYHhaiGGAU5vCdzaG7rvbbclt8QigVpVMA79YZW-il4DyieDTPxcb7GC1De7ak1Ox6l0kYDIDeeOhx1hUwAuQYr5p_Ba_1oolsMtox80F4kjHQGFi1xCA9FfIBmQReNecA)

### Block Producer Network(BPN)

Since BPN applies RAFT on the network, each BP must strictly meet the hardware and network resource requirements to perform the RAFT consensus mechanism with adequate performance. To support high-performance real-time service, BP's technical operations are all handled by 40 reliable NCPs.

### Bridge Node Network(BNN)

The BNN network primarily has the function of physically protecting the BPN network from direct external attacks. Its primary function is to verify the valid transaction propagated from the ENN and send it to the consensus node. Conversely, it is to confirm the block reproduced from the BPN and propagate it to the ENN. Also, some of the Bridge Nodes that exist in BNN provide the functions of Boot Nodes. All new nodes except BP nodes must download all block data generated so far from neighboring nodes connected to the P2P network in order to participate in the blockchain network. Boot Node is a service node that is always online and provides a Bootstrapping service that connects these new nodes participating in the network to the P2P network by unconditionally performing P2P Hand Shaking. WEMIX conducts the corresponding operation of the network.

### End Node Network(ENN)

The outermost subnetwork, ENN, is an endpoint of the WEMIX network and consists of blockchain End Nodes that directly handle user services. Anyone can install and operate blockchain nodes.


# Consensus

A consensus mechanism(algorithm) is a method of reaching consensus among trustless parties. Blockchain technology is used to determine whether a block is valid. A blockchain network's performance depends on the chosen consensus mechanism's performance and significantly impacts the usability of blockchain applications. This document will look at how WEMIX implemented a high-performance consensus process.

## RAFT(Reliable And Fault Tolerant) Algorithm

RAFT is a consensus method that ensures consistency of datastores on all nodes in the cluster by selected leader. Nodes participating in RAFT are either a Leader or a Follower; anyone can become a Candidate during a leader selection. A Leader must create and share data that needs to be synchronized with followers. A Leader announces the leader's existence by periodically sending a heartbeat message to all followers. Each follower randomly selects a timeout value for the leader's heartbeat, and if a heartbeat receives during the timeout period, the timeout resets again. On the other hand, if they do not receive a heartbeat during the timeout, the follower changes the status to a candidate and participates in the leader selection. Conflicts occur if multiple nodes simultaneously participate in a leader selection, so the timeout is determined according to random backoff logic.

## WEMIX3.0 Consensus Mechanism

### SPoA(Stake base Proof of Authority)

The WEMIX Blockchain is a public blockchain that aims for high-performance real-time service, and block generation is possible only by authorized members in advance. Therefore, the basic consensus algorithm follows PoA. However, WEMIX forces to stake more than a specific amount to give a physical penalty for the malfunction of the elected authority on-chain. This WEMIX blockchain consensus method is defined as SPoA.

### Authority

Authority participating in the consensus algorithm of the WEMIX Blockchain implies a consortium that performs the same role as the miner of the consensus mechanism PoW, such as Bitcoin/Ethereum. WEMIX Blockchain, the process of being included in or deleted from the Authority, is determined by voting the existing authority members.

1. Clear identity
2. Legally effective contract with WEMIX Foundation offline
3. Disclosure of basic personal information
4. Staked WEMIX to the system registry contract

After staking is confirmed, any of the existing authority members propose a member add proposal to the governance contract. If more than 50% of the current authority members approve, they will be registered as a new Authority members.

When the Authority receives the transactions created by users, it verifies the transaction details and temporarily stores the transactions that have passed the verification in the Mempool. When an Authority member is elected as a miner, it creates a block header including hash information of the previous block. This process is done automatically by software, and there is no need for the authority member to monitor the network status continuously. However, the authority member should be responsible for managing the firewall and private key of the account so that the computer generating the block is not used maliciously.

Voting, which can be processed in the On-chain Governance contract, is currently supported in the form of dApp by voting for or against and will support various votes in the future. In Phase 1, voting weight is proportional to the amount of staked WEMIX and in Phase 2, the same voting weight is applied regardless of the amount of staked WEMIX.  If malicious behavior is detected, the party can be forcibly disqualified from the Authority's voting, and the staked WEMIX is confiscated and may not receive block generation compensation.

The reason for the staking and reward system is to create a justification for all participating authority members to operate under the agreed protocol and to maintain the soundness of the WEMIX blockchain network autonomously.

### Miner Selection

Taking Bitcoin's PoW as an example, a miner that generates a block header hash that satisfies the difficulty calculated by the protocol can generate and propagate blocks. Since there is no independent authority for block creation, blocks are created by mutual competition. For this reason, resources are inevitably wasted for block generation competition. Work that satisfies the difficulty condition must be proven, so the block generation time is given a physical constraint (BTC 10 min avg. ETH/15 sec). As a result, PoW has a scalability trilemma, and the introduction of PoS or sharding has been proposed and researched as a realistic solution to solve this problem. However, so far, no public blockchain has operated as PoS in a fully distributed manner.

The WEMIX Blockchain determined that providing the desired service in the public domain was impossible using methods such as PoW or PoS. Initially, consensus such as DPoS, PoA, and PBFT was considered methods, but the WEMIX Blockchain devised SPoA. This new Consortium consensus mechanism borrowed the advantages of DPoS and PoA as the most suitable consensus algorithm. SPoA is introducing the concept of staking to prevent inappropriate actions of the authority members who have formed the Authority and participated through transparent identity information and legal contracts.

The WEMIX Blockchain uses etcd, the implementation of RAFT as a miner selection algorithm to select a miner who creates blocks. Etcd is an open-source distributed key-value repository used to store and manage sensitive information needed by distributed systems. Miner stores lockable tokens in the etcd distributed system and generates blocks. The reason for not using efficient miner selection, such as Round Robin, is to prevent the branching of consensus node networks in distributed systems. Etcd is an efficient way to provide immediate finality of many (40+) authorities with clear responsibilities and authority.

### Reward Distribution

Existing consensus algorithms often concentrate block rewards and transaction fees within the block producer, the entity responsible for block creation. This presents a challenge in non-competitive systems like Delegated Proof-of-Stake (DPoS) and Proof-of-Authority (PoA), where fair distribution of block creation authority is paramount. Frequent leader changes to achieve equal opportunity can hinder performance due to increased communication overhead for Block Producers (BPs) processing transactions.

To address these challenges, WEMIX3.0 introduces a Stake-based Proof-of-Authority (SPoA) consensus mechanism. This mechanism distributes rewards proportionally to the amount of WEMIX staked by each authority member, regardless of who creates the block. By doing so, it incentivizes continuous participation from all BPs while maintaining network security. Block producers must include transparent reward distribution details within the block header. Any violation of the predetermined rules, documented within the governance contract, will prevent other authorities from propagating the block.

To achieve fair and sustainable reward distribution, WEMIX3.0 employs a dual structure for tokenomics, focusing on both block rewards and performance shares. Initially, rewards are distributed through block minting, ensuring that all participating members receive a portion of the block rewards. Over time, the system will transition towards an increasing allocation of performance shares tied directly to transaction fees. This shift is guided by a block minting halving mechanism that gradually reduces the minting rate until the maximum supply of 590 million WEMIX tokens is reached, at which point block minting will cease entirely.

<figure><img src="/files/B7Q2JkLJcVh6d4CAz0Tp" alt=""><figcaption></figcaption></figure>

<table data-header-hidden><thead><tr><th width="146"></th><th></th><th></th><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td>Number of halving</td><td>0</td><td>1</td><td>2</td><td>3</td><td>⋯</td><td>16</td></tr><tr><td>Minting</td><td>1</td><td>0.5</td><td>0.25</td><td>0.125</td><td>⋯</td><td>0.000015</td></tr><tr><td>Transaction fees</td><td>α</td><td>α</td><td>α</td><td>α</td><td>⋯</td><td>α</td></tr><tr><td>Block reward</td><td>1+α</td><td>0.5+α</td><td>0.25+α</td><td>0.125+α</td><td>⋯</td><td>0.000015+α</td></tr></tbody></table>

As block minting rewards decrease, the reduction will be offset by an increasing share of transaction fees allocated as performance shares. This strategic shift ensures a balanced and fair distribution of rewards among all participants, promoting long-term network growth and sustainability. The meticulously crafted dual reward structure serves to fulfill WEMIX3.0's aspirations of becoming a leading commercial entity while offering a rational and sustainable reward system. WEMIX3.0 may implement a policy to burn part or all of transaction fees.&#x20;

All accounts that receive rewards (one per member) are registered by voting, except for the governance coin base account, which distributes the first system contracts to the governance contract. The authority member generating the block updates the balance state of the accounts, and the calculation result is reflected in the root hash value of Patricia Trie.

<figure><img src="/files/64S7KtzFqwMauU0cIy5r" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/iSfJN8VhUCQlzNnfRbrC" alt=""><figcaption></figcaption></figure>

### Block Generation

The governance contract determines the interval between block creation of the WEMIX Blockchain. BP has the logic of generating blocks at a set time (1 sec. of the initial set value) to ensure activity and block finality, regardless of transactions in the mempool. The block creation interval is the value of a variable that can be changed by permission voting.

### Block Verification

When a block generated by a miner is propagated to a network through p2p, each full node (including an authority member) receiving the block must self-verify and determine the validity. Authority nodes verify whether the block is generated by a member selected as the miner, the reward is customarily distributed, and transaction details are reflected in the state of the entire system. After the verification, the authority nodes spread the blocks to the neighboring nodes.

The non-authority full node that receives this propagation checks whether the signature of the member included in the header is correct and verifies the transaction details. When it is determined that the transaction recorded in the block is generated according to the rule, it stores the block on the local disk and propagates it to neighboring nodes.

When verifying the propagated block, there are two things that all full nodes must verify first before proceeding with the above process: Miner\_Limit and Max\_Consecutive\_Blocks.

Miner\_Limit is defined as follows. When a specific member is determined as a Miner in RAFT, an epoch that can create a block is given, and the purpose of this epoch is to prevent it from being given continuously. All blocks are valid only when the following Miner\_Limit is satisfied.

Miner\_Limit = floor(SIGNER\_COUNT / 2) + 1 (Number of consecutive epochs out of which a miner may only occupy one)

Max\_Consecutive\_Blocks is the maximum number of consecutive blocks the same Miner can create in an epoch. This value is a variable introduced to limit the height of a diverged block when a hacker attacks the network. In WEMIX3.0, Max\_Consecutive\_Blocks is 1.

The above two values are a method for ensuring block finality and are designed to minimize the damage a malicious authority member can cause to the network.


# Governance

## DAO(Decentralized Autonomous Organization)

### On-Chain Governance

#### **Staking**

WEMIX Staking is one of the prerequisites to becoming an authority member. The Staking method is possible by sending WEMIX while calling a predefined function to the governance contract known at the system level. Staking can only be done through Governance dApp, and the minimum amount of Staking can be changed by Voting. Voting power has the same weight regardless of the amount of locked WEMIX Staking. The result of Voting determines whether the WEMIX Staking is locked or unlocked. Once locked, WEMIX can be unlocked and retrieved by Voting after the default locking period has passed. If you relinquish your authority as an Authority before the locking period ends, or if you forfeit your authority due to the detection of malicious acts, your locked WEMIX will be forfeited to the Eco Fund. In Phase 1, all participating authorities had the minimum/maximum of 1,500,000 WEMIX, and all authorities have the same voting power. In Phase 2, the Staking minimum remains at 1,500,000 WEMIX, but the Staking maximum constraint is removed. In other words, NCPs can increase the Reward with additional WEMIX staking.&#x20;

#### **Voting**

The WEMIX Blockchain(governance contract) stores system variables that can be changed by voting and have functions related to the participation, withdrawal, and replacement of authority members. In Phase 1, each Authority had Voting Power in proportion to the amount of Staking, and in Phase 2, all Authority have the same Voting Power regardless the Staking amount. Each voting will be passed if it win more than 50% of the votes in favor of the total Staking WEMIX during the Voting Duration(1-7 days).

Only the Authority member can apply for the following voting. Voting duration can be determined within the minimum/maximum value range at the time of application and is designated as the minimum value when not specified. Voting starts and ends when a member votes for the first time in the application list and runs for the maximum voting duration. Even within the voting duration, if more than 50% of opinions are raised, voting ends, and follow-up work is carried out. Only one vote is conducted at a time; As a result, if voting is already underway, new voting cannot be initiated.

The Voting types supported by the current version are as follows. Voting results are reflected based on block number, and voting results completed in block number `n` are valid from block number `n+1`.

* Authority member(add): When the voting for adding an authority member passes by a majority vote, the staking amount of the member is locked and included in the authority member.
* Authority member(withdrawal): Voting for processing the authority member's withdrawal (penalty), unlocking only the specified amount when applying, and sending the rest to the Eco Fund.
* Authority member replacement(address change): When passing through voting to replace an existing authority member or change node information, if it is the same address, change the node information; if it is a different address, lock the new member's staking amount, and unlock the existing member's staking amount.\
  However, if you change your own node information (including voting address) in your staking account, the corresponding information will be changed immediately without voting.
* Governance Contract Address(change): Change the address when passing through voting to upgrade the existing Governance Contract.
* Voting Duration(Minimum): The default is one day for voting to change the minimum voting period value. When passing, the minimum voting period is changed.
* Voting Duration(Maximum): The default value is seven days for voting to change the maximum voting period value. When passing, the maximum voting period value is changed.
* Authority member staking(Minimum value): Change the minimum staking WEMIX quantity value when passing through voting, which changes the minimum number of staking WEMIX quantity when participating as a member.
* Authority member staking(Maximum value): Change the maximum staking WEMIX quantity value when passing through voting, which changes the maximum number of staking WEMIX quantity when participating as a member.
* Block generation time: The default is 1 second for voting to process changes to the block creation time. When passing, the block creation time is changed.
* Block reward distribution method: Voting to determine the transaction fee and the distribution rate of the newly created WEMIX, the default is 50% block producer, 0% staking compensation, 25% ecosystem, and 25% maintenance. The distribution rate, ecosystem, and maintenance distribution address are changed when passing.
* MaxPriorityFeePerGas: Voting to handle changes in MaxPriorityFeePerGas. Once passed, the MaxPriorityFeePerGas will change.
* Gas Limit & baseFee: Voting to handle changes in Gas Limit, range of baseFee and the increase rate of baseFee.

{% hint style="info" %}
If you delete the Authority member and then proceed with adding the same node again, you must delete the {data\_directory}/etcd directory and restart gwemix.
{% endhint %}

### **Off-Chain Governance**

If the foundation needs a hard fork, such as a "change of protocol", and explicit agreement of the council is required, the NCP agreement process is carried out using an Off-Chain service such as <https://snapshot.org/>. Although the service is Off-Chain governance, the foundation can change the blockchain protocol based on the agreement of the explicit council because it receives more than half of the council's signature and performs voting.


# Minting

This is the description of Permanent Minting Reward (PMR).

WEMIX, the native coin of the WEMIX mega-ecosystem, serves as the primary medium of exchange and payment within the WEMIX3.0 mainnet. With the introduction of the 'Brioche' hard fork, WEMIX tokenomics have undergone significant transformations, creating a sustainable and value-driven ecosystem. The hard fork permanently reduced and capped the maximum supply at 590 million WEMIX to preserve the token’s value and stability.

The 'block minting halving' mechanism, introduced by the Brioche hard fork, is designed to gradually reduce the minting rate of WEMIX per block called 'Permanent Minting Reward (PMR)’ over time. Initially, WEMIX was minted at a rate of 1 WEMIX per block, amounting to 86,400 WEMIX per day or 31,536,000 WEMIX per year. The first halving reduced the annual minting amount to about 15 million WEMIX. This systematic reduction continues in 63,115,200-block cycles, progressively decreasing the number of tokens minted and fostering a more stable and advanced tokenomic structure.

In addition to the reduced maximum supply and the new minting mechanism, the allocation of WEMIX has been updated to support the ecosystem's growth and development. The foundation's holdings are now categorized for various essential functions, with a significant portion of the remaining tokens burned. This strategic move effectively manages the token supply, removes the perception of a dominance structure, and fosters a more inclusive ecosystem, promoting greater participation and ownership.

WEMIX is based on the ERC-20 standard (Ethereum Request for Comment-20), ensuring transferability and compatibility via bridging to other EVM chains. This foundational technology underpins the robust and versatile nature of the WEMIX ecosystem.


# EIP1559

This section describes the application of the EIP1559 transaction pricing mechanism in WEMIX3.0.

Ethereum historically priced transaction fees using a simple auction mechanism, where users send transactions with bids("gas prices") and miners choose transactions with the highest offers to generate the block.

Although this mechanism may work in some systems, such as Bitcoin or Ethereum, where limited resources are acquired only through auctions, this leads to several sources of inefficiency, such as a mismatch between the volatility of transaction fee levels and the social cost of transactions and needless delays for users.

EIP1559 is a dynamic transaction pricing mechanism applied in Ethereum London Hard-fork. This mechanism resolves network congestion algorithmically by burning a part of the block's transaction fee and adjusting the maximum gas usage of a block up and down by a 1/1024 scale.

WEMIX3.0 uses SPoA, a consensus algorithm capable of high-capacity, high-speed processing. It can support up to 3.5 times the block size of Ethereum(default block gas limit: 105,000,000) and 1/12 times the block generation time of Ethereum(default time: 1 second). In a way, unlike Ethereum, it may be a reasonable option for WEMIX3.0 to use a fixed gas price policy determined by the Governance.

However, fixing the gas price in the policy causes a problem. It may also affect the gas price for controlling DDoS attacks on the network according to the price volatility of the native coin WEMIX. Of course, it is possible to change the fixed gas price by on-chain Governance, but it cannot be dealt with promptly and involves the risk of impairing the safety of the network.

Therefore, in WEMIX3.0, we applied the EIP1559 protocol with the following conditions to protect the network from DDoS attacks and excessive transactions generated by the bots.

In WEMIX3.0, the `BaseFee` and the `CurrentGasTarget` are calculated per block by the following equations:

![BaseFee and CurrentGasTarget](https://lh5.googleusercontent.com/2tIDcFT4AOfJNjB4DSIcPw45iMQvs3wYLWBLOMH4syPyj2JJJrjEJOUaOKrdD3pFESa1gLmCbQLkYpQy2BwVk7JUZudjgYnJnQm2KH3eqb-6JuVSsknwLIJjJzO6AWBQaSSGk17lIRoGJyyLu1M)

The `baseFeeMaxChangeRate`(default: 55%) in the above formula is fixed but can be adjusted through the Governance.

Also, to prevent the `BaseFee` from becoming infinite and all WEMIX being used as transaction fees, the maximum value of BaseFee, `maxBaseFee`(default: 50,000Gwei), has been set. This value can also be adjusted through Governance.

![Range of BaseFee](https://lh6.googleusercontent.com/GWC0MxTHa6RhVFH_QlzcCVlLxagVsk_C-x3alDiWBdGDHy2KZCffgowZHsdBOju-Zoz2TN5ryTph9jLn0VGrjYA8dLuSpRrXs_unWuSTyHAJG-GUsbBLJJ2NRuyebBl6jRYKXXwK3eE5A8_G2uo)

In the formula below, `gasTargetPercentage`(default: 30%) and `PreviousGasLimit`(default: 105,000,000) are subject to change by governance voting but are always the same unless changed by Governance.

![GasTarget](https://lh3.googleusercontent.com/WWXd7x4zOq05_1Tmql9ChU-cLBNjBNJbJSf91B1wvQ6ar3Tye9cQfdh_nFGWTtw1UiP9yQcK5sQFgW52ovsxz2b7nsrlyxN3gDZwIBFthGdbAy_fL2R9ZSQBh0y_PFLWjILMRcymlEoJGM17YVQ)

WEMIX3.0 users can generate transactions using the fixed gas price `maxPriorityFeePerGas`(default: 100Gwei) value and the variable gas price `BaseFee`(default: 1Gwei) value recorded in the latest block. This algorithm is compatible with all wallets that support EIP1559.


# Eco Fund

This chapter includes explanations about the Eco Fund allocated as 25% of the PMR(Permanent Minting Reward) generated within the WEMIX3.0 blockchain, as well as various programs aimed at stimulating ecosystem activation and network expansion.

## PoET

The PoET Program, a PMR distribution program designed to incentivize builders and users who contribute to the growth of the WEMIX3.0 ecosystem and network, has been in operation since September 1, 2023.

During its operation, the PoET Program played a significant role in fostering the growth of the WEMIX ecosystem thanks to the active participation of builders and users. However, in an effort to explore more strategic directions to further revitalize the ecosystem and undertake necessary restructuring, the PoET Program will be terminated on April 19, 2024.

### **Key Points Following PoET Program Termination**

* Distribution of PoET rewards will cease after the PoET Program termination.
* Existing accumulated PoET rewards can still be claimed and withdrawn through the claim function after April 19, 2024.

### Policy updates

<table><thead><tr><th width="201.66666666666666">Date</th><th width="261">Content</th><th>Notes</th></tr></thead><tbody><tr><td>September 1, 2023</td><td>Program launched</td><td>-</td></tr><tr><td>September 18, 2023</td><td>PoET Distribution Policy updated</td><td>-</td></tr><tr><td>March 7, 2024</td><td>Distribution levels and builder/user allocation ratio updated</td><td>-</td></tr><tr><td>April 19, 2024</td><td>Program terminated</td><td>-</td></tr></tbody></table>


# Fee Delegation

This chapter is about Fee Delegation applied to WEMIX3.0.

Fee Delegation is a mechanism applied to Applepie HF in WEMIX3.0. This is a feature that FeePayer pays a fee for the transaction that Sender wants to execute instead of Sender.

Fee Delegation Transaction is accomplished by sending the existing Transaction signed by the Sender, including the FeePayer information, by adding the FeePayer signed signature information.

<figure><img src="/files/ib0aOZJ1PBjC2oqNZUMl" alt=""><figcaption><p>Fee Delegation</p></figcaption></figure>

#### Fee Delegation Transaction

{% code overflow="wrap" %}

```
DynamicFeeTxType Transaction(with signature of Sender) + FeePayer address + signature of FeePayer
```

{% endcode %}

Fee Delegation Transaction only supports  DynamicFeeTxType among existing Transaction and does not support LegacyTxType or AccessListTxType.

<figure><img src="/files/3vKdmhFiJRPaM5bu9XuU" alt=""><figcaption></figcaption></figure>

Important changes to implementation of Fee Delegation Transaction are as follows, and please refer to the open source for further information.

#### Fee Delegation Transaction Type (transaction.go)

```go
const (
  LegacyTxType = iota
  AccessListTxType
  DynamicFeeTxType
  FeeDelegateDynamicFeeTxType = 22 //fee delegation
)
```

#### Fee Delegation Transaction Structure(transaction.go)

```go
type FeeDelegateDynamicFeeTx struct {
  SenderTx DynamicFeeTx
  FeePayer *common.Address rlp:"nil"

  // Signature values
  FV *big.Int json:"fv" gencodec:"required" // feePayer V
  FR *big.Int json:"fr" gencodec:"required" // feePayer R
  FS *big.Int json:"fs" gencodec:"required" // feePayer S
}
```

#### Fee Delegation Transaction Hash Function for Signature(transaction\_signing.go)

```go
func (s feeDelegateSigner) Hash(tx *Transaction) common.Hash {
  senderV, senderR, senderS := tx.RawSignatureValues()
  return prefixedRlpHash(
    tx.Type(),
    []interface{}{
      []interface{}{
        s.chainId,
        tx.Nonce(),
        tx.GasTipCap(),
        tx.GasFeeCap(),
        tx.Gas(),
        tx.To(),
        tx.Value(),
        tx.Data(),
        tx.AccessList(),
        senderV,
        senderR,
        senderS,
      },
      tx.FeePayer(),
    })
}
```

{% hint style="danger" %}
**Caution**

Fee Delegation Transaction pays fees according to the fee settings (gas, maxFeePerGas, maxPriorityFeePerGas) of DynamicFeeTxType Transaction generated by the Sender. Therefore, FeePayer must have a procedure to verify that the transaction fee is appropriate.
{% endhint %}

{% hint style="danger" %}
**Caution**

It is important to note that the nonce of the transaction requested by the user is greater than the nonce of the transaction requested by the current sender, because Fee Delegation Transaction signed by FeePayer may not be used immediately, depending on the nonce of the sender.
{% endhint %}


# Roadmap

Decentralized Technology, Democratized Governance

WEMIX3.0 mainnet, developed on a decentralized architecture, will introduce a multi-phase democratized governance where the community is empowered to impact the 40 authority node governance structure through the introduction of a delegated staking module.

This is the fundamental principle of the mainnet's roadmap, a means to illustrate true democratization through adoption of meritocracy based on contribution to the ecosystem.

### Phase 01

Node Council Partners, also known as WONDERS, are 40 selected members who operate secured validating nodes for the WEMIX3.0 Mainnet.

40 WONDERS are constituted by Technology Sponsors that contribute to the secure operation and innovation of WEMIX3.0, and Ecosystem Sponsors that contribute to the establishment of the experience cycle created through the on-chain/off-chain ecosystem via WEMIX3.0.

Each NCP must stake 1.5M WEMIX, and the PMR (Permanent Minting Reward) is distributed automatically to NCP (40%), Stakers (10%), Eco fund (25%) and Maintenance (25%).

WEMIX Grand Staking will become available to the community which will yield the 10% Staking Reward allocated through the PMR. However, staking participants for the WEMIX Grand Staking may not withdraw from the staking pool prior to the implementation of Phase 2.

### Phase 02 <mark style="background-color:purple;">(Current)</mark>

Upon Phase 2 launch, 1.5M fixed WEMIX Staking per validator node is abolished and shifted to competitive staking to encourage active ecosystem contiributions from NCPs.

The 10% PMR paid to WEMIX Grand Staking participants is abolished. As the NCP reward increases from 40% to 50%, the initial PMR distribution ratio changes.

In doing so, WEMIX holders may then delegate their stake volume to one of the 40 validator nodes, effectively increasing the chosen node's total staked shares above the median; generating increased reward rate for the node and community members that are participating in the delegation.

### Phase 03

Validator node operation by 40 selected authority partners known as, WONDERS, will be discontinued and the governance module will shift into an open & autonomous node participation system where anyone can become the validators of WEMIX3.0 based on staking volume.

Based on the total WEMIX staking volume per node, top 40 nodes will be periodically selected to validate transactions, transforming from an SPoA model into a PoS model.

A slashing policy will be implemented to enforce fair operation of validator nodes, especially in the event of willful collusion against the interests of the ecosystem but also possible result of a misconfiguration of the node. Slashing will penalize the node by removing a portion of its existing stake and is irreversible.

Democratized governance is completed at this stage, and the mainnet will be upgraded to WEMIX4.0. The schedule is yet to be determined.


# Quick Start

For software applications to interact with the WEMIX3.0 Blockchain(either by reading blockchain data or sending transactions to the network), they must connect to a WEMIX3.0 node.&#x20;

To connect to the WEMIX3.0 Blockchain Network, start the WEMIX3.0 Node(i.e., `gwemix`) and complete block sync from the neighboring node.

After block sync is complete, users can create a new. And if you receive `TWEMIX`(Testnet WEMIX) for testing through Test Coin Faucet, you are ready for development.

* [Start Node](/en/quick-start/start-node)
* [Connect Node](/en/quick-start/connect-node)
* [Account ](/en/quick-start/account)
* [Testnet Faucet](/en/quick-start/testnet-faucet)


# Start Node

Anyone can download the pre-built WEMIX3.0 node binary in the Docker environment and run it directly on the Linux machine they manage. However, all users do not need to operate a node; for example, dApp developers can access the WEMIX3.0 blockchain using the Open API RPC server, which provides 24 hours service.

* [Using binaries](/en/quick-start/start-node/use-binary)
* [Connecting to a public RPC server](/en/quick-start/start-node/use-public-api-server-rpc)

{% hint style="info" %}
**Build**

Please refer to the [Install Guide](/en/install-and-operation/end-node/install-guide) for developers building directly without using the binary provided by WEMIX.
{% endhint %}

{% hint style="info" %}
**Spec**

[Hardware specifications](/en/install-and-operation/block-producer-node/system-requirements) of the Linux machine on which the WEMIX3.0 binary node will run.
{% endhint %}


# Use Binary

The WEMIX3.0 blockchain Binary Node can be [downloaded](/en/install-and-operation/download) from the site.&#x20;

Using the WEMIX3.0 network&#x20;

Run the following command: The default RPC port for `gwemix` is 8588, and the P2P port is 8589. Like geth, `--datadir` can specify the folder in which `chaindata` is stored, and if this value is omitted, `~/.wemix` becomes the data directory.

{% tabs %}
{% tab title="Mainnet" %}
*gwemix --syncmode full --datadir {data\_folder} --http --http.addr 0.0.0.0*
{% endtab %}

{% tab title="Testnet" %}
*gwemix --wemix-testnet --syncmode full --datadir {data\_folder} --http --http.addr 0.0.0.0*
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Command line option**

Use the [command line option](/en/quick-start/start-node/use-binary/command-line-option). It is possible to run gwemix by specifying the settings.&#x20;
{% endhint %}


# Command-line Option

```
NAME:
   gwemix - the go-wemix command line interface

   Copyright 2013-2022 The go-ethereum / go-metadium / go-wemix Authors

USAGE:
   gwemix [options] [command] [command options] [arguments...]

VERSION:
   0.9.8-stable-afed9ee5

COMMANDS:
   account                            Manage accounts
   attach                             Start an interactive JavaScript environment (connect to node)
   console                            Start an interactive JavaScript environment
   db                                 Low level database operations
   dump                               Dump a specific block from storage
   dumpconfig                         Show configuration values
   dumpgenesis                        Dumps genesis block JSON configuration to stdout
   export                             Export blockchain into file
   export-preimages                   Export the preimage database into an RLP stream
   import                             Import a blockchain file
   import-preimages                   Import the preimage database from an RLP stream
   init                               Bootstrap and initialize a new genesis block
   js                                 Execute the specified JavaScript files
   license                            Display license information
   makecache                          Generate ethash verification cache (for testing)
   makedag                            Generate ethash mining DAG (for testing)
   removedb                           Remove blockchain and state databases
   show-deprecated-flags              Show flags that have been deprecated
   snapshot                           A set of commands based on the snapshot
   version                            Print version numbers
   version-check                      Checks (online) whether the current version suffers from any known security vulnerabilities
   wallet                             Manage Ethereum presale wallets
   wemix                              Wemix helper commands
   help, h                            Shows a list of commands or help for one command

ETHEREUM OPTIONS:
  --config value                      TOML configuration file
  --datadir value                     Data directory for the databases and keystore (default: "/home/nxt/.wemix")
  --datadir.ancient value             Data directory for ancient chain segments (default = inside chaindata)
  --datadir.minfreedisk value         Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)
  --keystore value                    Directory for the keystore (default = inside the datadir)
  --usb                               Enable monitoring and management of USB hardware wallets
  --pcscdpath value                   Path to the smartcard daemon (pcscd) socket file (default: "/run/pcscd/pcscd.comm")
  --networkid value                   Explicitly set network id (integer, 1111=WemixMainnet , 1112=WemixTestnet)(For testnets: use --wemix-testnet --ropsten, --rinkeby, --goerli instead) (default: 1111)
  --mainnet                           Ethereum mainnet
  --wemix-testnet                     Wemix test network: pre-configured wemix test network
  --goerli                            Görli network: pre-configured proof-of-authority test network
  --rinkeby                           Rinkeby network: pre-configured proof-of-authority test network
  --ropsten                           Ropsten network: pre-configured proof-of-work test network
  --sepolia                           Sepolia network: pre-configured proof-of-work test network
  --syncmode value                    Blockchain sync mode ("snap", "full" or "light") (default: snap)
  --exitwhensynced                    Exits after block synchronisation completes
  --gcmode value                      Blockchain garbage collection mode ("full", "archive") (default: "full")
  --txlookuplimit value               Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (default: 2350000)
  --ethstats value                    Reporting URL of a ethstats service (nodename:secret@host:port)
  --identity value                    Custom node name
  --lightkdf                          Reduce key-derivation RAM & CPU usage at some expense of KDF strength
  --whitelist value                   Comma separated block number-to-hash mappings to enforce (<number>=<hash>)

LIGHT CLIENT OPTIONS:
  --light.serve value                 Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100) (default: 0)
  --light.ingress value               Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.egress value                Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.maxpeers value              Maximum number of light clients to serve, or light servers to attach to (default: 100)
  --ulc.servers value                 List of trusted ultra-light servers
  --ulc.fraction value                Minimum % of trusted ultra-light servers required to announce a new head (default: 75)
  --ulc.onlyannounce                  Ultra light server sends announcements only
  --light.nopruning                   Disable ancient light chain data pruning
  --light.nosyncserve                 Enables serving light clients before syncing

DEVELOPER CHAIN OPTIONS:
  --dev                               Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
  --dev.period value                  Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)
  --dev.gaslimit value                Initial block gas limit (default: 11500000)

ETHASH OPTIONS:
  --ethash.cachedir value             Directory to store the ethash verification caches (default = inside the datadir)
  --ethash.cachesinmem value          Number of recent ethash caches to keep in memory (16MB each) (default: 2)
  --ethash.cachesondisk value         Number of recent ethash caches to keep on disk (16MB each) (default: 3)
  --ethash.cacheslockmmap             Lock memory maps of recent ethash caches
  --ethash.dagdir value               Directory to store the ethash mining DAGs (default: "/home/nxt/.ethash")
  --ethash.dagsinmem value            Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1)
  --ethash.dagsondisk value           Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2)
  --ethash.dagslockmmap               Lock memory maps for recent ethash mining DAGs

TRANSACTION POOL OPTIONS:
  --txpool.locals value               Comma separated accounts to treat as locals (no flush, priority inclusion)
  --txpool.nolocals                   Disables price exemptions for locally submitted transactions
  --txpool.journal value              Disk journal for local transaction to survive node restarts (default: "transactions.rlp")
  --txpool.rejournal value            Time interval to regenerate the local transaction journal (default: 1h0m0s)
  --txpool.pricelimit value           Minimum gas price limit to enforce for acceptance into the pool (default: 1)
  --txpool.pricebump value            Price bump percentage to replace an already existing transaction (default: 10)
  --txpool.accountslots value         Minimum number of executable transaction slots guaranteed per account (default: 100000)
  --txpool.globalslots value          Maximum number of executable transaction slots for all accounts (default: 500000)
  --txpool.accountqueue value         Maximum number of non-executable transaction slots permitted per account (default: 100000)
  --txpool.globalqueue value          Maximum number of non-executable transaction slots for all accounts (default: 500000)
  --txpool.lifetime value             Maximum amount of time non-executable transaction are queued (default: 3h0m0s)

PERFORMANCE TUNING OPTIONS:
  --cache value                       Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode) (default: 1024)
  --cache.database value              Percentage of cache memory allowance to use for database io (default: 50)
  --cache.trie value                  Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode) (default: 15)
  --cache.trie.journal value          Disk journal directory for trie cache to survive node restarts (default: "triecache")
  --cache.trie.rejournal value        Time interval to regenerate the trie cache journal (default: 1h0m0s)
  --cache.gc value                    Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25)
  --cache.snapshot value              Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode) (default: 10)
  --cache.noprefetch                  Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)
  --cache.preimages                   Enable recording the SHA3/keccak preimages of trie keys

ACCOUNT OPTIONS:
  --unlock value                      Comma separated list of accounts to unlock
  --password value                    Password file to use for non-interactive password input
  --signer value                      External signer (url or path to ipc file)
  --allow-insecure-unlock             Allow insecure account unlocking when account-related RPCs are exposed by http

API AND CONSOLE OPTIONS:
  --ipcdisable                        Disable the IPC-RPC server
  --ipcpath value                     Filename for IPC socket/pipe within the datadir (explicit paths escape it)
  --http                              Enable the HTTP-RPC server
  --http.addr value                   HTTP-RPC server listening interface (default: "localhost")
  --http.port value                   HTTP-RPC server listening port (default: 8588)
  --http.api value                    API's offered over the HTTP-RPC interface
  --http.rpcprefix value              HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --http.corsdomain value             Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --http.vhosts value                 Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --ws                                Enable the WS-RPC server
  --ws.addr value                     WS-RPC server listening interface (default: "localhost")
  --ws.port value                     WS-RPC server listening port (default: 8598)
  --ws.api value                      API's offered over the WS-RPC interface
  --ws.rpcprefix value                HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --ws.origins value                  Origins from which to accept websockets requests
  --graphql                           Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
  --graphql.corsdomain value          Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --graphql.vhosts value              Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --rpc.gascap value                  Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 0)
  --rpc.evmtimeout value              Sets a timeout used for eth_call (0=infinite) (default: 5s)
  --rpc.txfeecap value                Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 0)
  --rpc.allow-unprotected-txs         Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC
  --jspath loadScript                 JavaScript root path for loadScript (default: ".")
  --exec value                        Execute JavaScript statement
  --preload value                     Comma separated list of JavaScript files to preload into the console

NETWORKING OPTIONS:
  --bootnodes value                   Comma separated enode URLs for P2P discovery bootstrap
  --discovery.dns value               Sets DNS discovery entry points (use "" to disable DNS)
  --port value                        Network listening port (default: 8589)
  --maxpeers value                    Maximum number of network peers (network disabled if set to 0) (default: 25)
  --maxpendpeers value                Maximum number of pending connection attempts (defaults used if set to 0) (default: 0)
  --nat value                         NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any")
  --nodiscover                        Disables the peer discovery mechanism (manual peer addition)
  --v5disc                            Enables the experimental RLPx V5 (Topic Discovery) mechanism
  --netrestrict value                 Restricts network communication to the given IP networks (CIDR masks)
  --nodekey value                     P2P node key file
  --nodekeyhex value                  P2P node key as hex (for testing)

MINER OPTIONS:
  --mine                              Enable mining
  --miner.threads value               Number of CPU threads to use for mining (default: 0)
  --miner.notify value                Comma separated HTTP URL list to notify of new work packages
  --miner.notify.full                 Notify with pending block headers instead of work packages
  --miner.gasprice value              Minimum gas price for mining a transaction (default: 1000000000)
  --miner.gaslimit value              Target gas ceiling for mined blocks (default: 8000000)
  --miner.etherbase value             Public address for block mining rewards (default = first account) (default: "0")
  --miner.extradata value             Block extra data set by the miner (default = client version)
  --miner.recommit value              Time interval to recreate the block being mined (default: 3s)
  --miner.noverify                    Disable remote sealing verification

GAS PRICE ORACLE OPTIONS:
  --gpo.blocks value                  Number of recent blocks to check for gas prices (default: 20)
  --gpo.percentile value              Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60)
  --gpo.maxprice value                Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo (default: 500000000000)
  --gpo.ignoreprice value             Gas price below which gpo will ignore transactions (default: 2)

VIRTUAL MACHINE OPTIONS:
  --vmdebug                           Record information useful for VM and contract debugging

LOGGING AND DEBUGGING OPTIONS:
  --fakepow                           Disables proof-of-work verification
  --nocompaction                      Disables db compaction after import
  --verbosity value                   Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3)
  --vmodule value                     Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
  --log.json                          Format logs with JSON
  --log.backtrace value               Request a stack trace at a specific logging statement (e.g. "block.go:271")
  --log.debug                         Prepends log messages with call-site location (file and line number)
  --pprof                             Enable the pprof HTTP server
  --pprof.addr value                  pprof HTTP server listening interface (default: "127.0.0.1")
  --pprof.port value                  pprof HTTP server listening port (default: 6060)
  --pprof.memprofilerate value        Turn on memory profiling with the given rate (default: 524288)
  --pprof.blockprofilerate value      Turn on block profiling with the given rate (default: 0)
  --pprof.cpuprofile value            Write CPU profile to the given file
  --trace value                       Write execution trace to the given file

METRICS AND STATS OPTIONS:
  --metrics                              Enable metrics collection and reporting
  --metrics.expensive                    Enable expensive metrics collection and reporting
  --metrics.addr value                   Enable stand-alone metrics HTTP server listening interface (default: "127.0.0.1")
  --metrics.port value                   Metrics HTTP server listening port (default: 6060)
  --metrics.influxdb                     Enable metrics export/push to an external InfluxDB database
  --metrics.influxdb.endpoint value      InfluxDB API endpoint to report metrics to (default: "http://localhost:8086")
  --metrics.influxdb.database value      InfluxDB database name to push reported metrics to (default: "geth")
  --metrics.influxdb.username value      Username to authorize access to the database (default: "test")
  --metrics.influxdb.password value      Password to authorize access to the database (default: "test")
  --metrics.influxdb.tags value          Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost")
  --metrics.influxdbv2                   Enable metrics export/push to an external InfluxDB v2 database
  --metrics.influxdb.token value         Token to authorize access to the database (v2 only) (default: "test")
  --metrics.influxdb.bucket value        InfluxDB bucket name to push reported metrics to (v2 only) (default: "geth")
  --metrics.influxdb.organization value  InfluxDB organization name (v2 only) (default: "geth")

WEMIX OPTIONS:
  --consensusmethod value             Wemix consensus method (integer, 1=PoW, 2=PoA, 3=ETCD, 4=PBFT) (default: 2)
  --fixeddifficulty value             Fixed difficulty to disable PoW (default: 1)
  --fixedgaslimit value               Fixed gas limit to control block size better (default: 0)
  --maxidleblockinterval value        Interval to generate empty block (default: 600)
  --blocksperturn value               Number of blocks per turn for PoA (default: 100)
  --noncelimit value                  Nonce limit for non-governing accounts (default: 0)
  --userocksdb value                  LevelDB (0) or RocksDB (1) (default: 1)
  --prefetchcount value               Transaction prefetch count for faster db read (default: 0)
  --log value                         Rotating log file: <file-name>,<count>,<size> (default: "log,5,10M")
  --maxtxsperblock value              Max # of transactions in a block (default: 5000)
  --hub value                         Id of message hub
  --wemix.block.interval value        Block generation interval in seconds (default: 1)
  --wemix.block.timeadjblocks value   Block interval to ajdust timestamp (default: 120)
  --wemix.block.minbuildtime value    Minimum block generation time in ms (default: 300)
  --wemix.block.minbuildtxs value     Minimum txs in a block with pending txs (default: 2500)
  --wemix.block.trailtime value       Time to leave for block data transfer in ms (default: 300)

ALIASED (deprecated) OPTIONS:
  --nousb                             Disables monitoring for and managing USB hardware wallets (deprecated)

MISC OPTIONS:
  --snapshot                                Enables snapshot-database mode (default = enable)
  --bloomfilter.size value                  Megabytes of memory allocated to bloom-filter for pruning (default: 2048)
  --help, -h                                show help
  --override.arrowglacier value             Manually specify Arrow Glacier fork-block, overriding the bundled setting (default: 0)
  --override.terminaltotaldifficulty value  Manually specify TerminalTotalDifficulty, overriding the bundled setting (default: 0)


COPYRIGHT:
   Copyright 2013-2022 The go-ethereum / go-metadium / go-wemix Authors
```


# Use Public API Server(RPC)

Not desiring to install and manage the WEMIX3.0 client, it is possible to use the RPC server WEMIX Foundation provides 24 hours a day for free.&#x20;

Developers can leverage RPC servers and public network endpoints to interact with on-chain data and send different types of transactions to the network. The API follows the JSON-RPC standard, a stateless and lightweight Remote Procedure Call (RPC) protocol commonly used when interacting with blockchain networks.

{% hint style="info" %}
**JSON-RPC calls**

[WEMIX3.0 JSON-RPC API](/en/dapp-developer/json-rpc) is 100% compatible with standard Web3 [Ethereum JSON-RPC API](https://eth.wiki/json-rpc/API)**.**
{% endhint %}

{% tabs %}
{% tab title="Mainnet" %}
HTTP(HTTPS) server endpoint

* <https://api.wemix.com>

WS(WSS) server endpoint

* <wss://ws.wemix.com>
  {% endtab %}

{% tab title="Testnet" %}
HTTP(HTTPS) server endpoint

* <https://api.test.wemix.com>

WS(WSS) server endpoint

* [wss://ws.test.wemix.com](wss://ws,test,wemix.com)
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}
**Speed limit**

Rate limiting is a function to limit the rate for incoming connections. For example, if too many references co-occur and burden the server, connections that exceed the defined rate limit may be rejected.

The RPC server has a speed limit for each IP to prevent malicious attacks and provide reliable services to more users.
{% endhint %}


# Connect Node

## **Node Connection**

The method to connect through the locally installed `gwemix` RPC web server is as follows.

```
gwemix attach rpc:http://localhost:8588
```

The method to connect through the locally installed `gwemix` IPC file is as follows.

```
gwemix attach {data_folder}/gwemix.ipc
```

Downloading and unzipping the binary {data\_folder}, the shell script file called `gwemix.sh` is located under the bin directory. The method to connect to a node through an IPC file using `gwemix.sh` is as follows.

```
{data_folder}/bin/gwemix.sh console
```

## **Node Settings**

When using `gwemix.sh`, it is possible to set node execution options in advance by creating a file called `.rc` in {data\_folder}.

```
PORT=8588
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full
GWEMIX_OPTS="--rpc.allow-unprotected-txs"
```

Set up as above and run `gwemix`, `gwemix`will run with the following run line options.

```
gwemix --http.port 8588 --wemix-testnet --syncmode full --rpc.allow-unprotected-txs 
```


# Account

A WEMIX3.0 account is an object with a WEMIX balance that can send transactions from a WEMIX blockchain. This chapter describes how to create an External-Owned Account (EOA) and check the balance directly controlled by the user.

## **Create Account**

Account files are created in the keystore directory. To create a new account, use the following command.

```
gwemix wemix new-account --out <account-file-name>
```

{% hint style="info" %}
MetaMask allows creating new accounts conveniently without having to install gwemix directly. Wallet creation and WEMIX3.0 network settings are possible [through MetaMask](/en/quick-start/account/use-metamask).
{% endhint %}

## **Import Account**

Account files created externally can also be copied and used in the keystore directory.

```
mkdir {data_directory}/keystore
chmod 700 {data_directory}/keystore
cp <account-file-name> {data_directory}/keystore
```

## **Check Account Balance**

Access the gwemix console and run the following command to check the account balance.

```
eth.getBalance('{your_address}')
```

Because the gwemix console is a JavaScript console, a JavaScript function that reads all addresses in the Keystore can be used to read all balances as a function.

```
function checkAllBalances() { 
var i = 0; 
eth.accounts.forEach( function(e){
     console.log("eth.accounts["+i+"]: " + e + " \tbalance: " + web3.fromWei(eth.getBalance(e), "ether") + " ether"); 
i++; 
})
};
```


# Use MetaMask

Creating a WEMIX3.0 wallet using MetaMask

MetaMask is a wallet for general users that can perform send/receive functions of coin, FT, and NFT on WEMIX3.0 Mainnet/Testnet. In addition, developers can connect REMIX IDE through MetaMask to distribute smart contracts and conduct behavior tests.&#x20;

Let's proceed from installation to use in the following order.

* Step 1: Install Metamask
* Step 2: Launch Metamask
* Step 3: Add WEMIX3.0 Network Information
* Step 4: Send WEMIX Coin

## Step 1 : Install MetaMask <a href="#installing-metamasks" id="installing-metamasks"></a>

Web users can download and install MetaMask from the [Chrome Web Store](https://chrome.google.com/webstore/category/extensions) and [Mozilla add-ons](https://addons.mozilla.org/en-US/firefox/), and mobile users can use the Apple App Store and Google Play Store.

Users go to the MetaMask's [download page](https://metamask.io/download/), select the platform they want, and follow the instrument's installation instructions.

The process is almost the same for all platforms, so in this section we will explain based on the MetaMask installed through the Chrome web store on Mac computers.

![](https://lh4.googleusercontent.com/RnF-mLqD4aRsnSh0jguxs55TE_1Lijq8ZFZ9VcsPT-I4IYFUWAVeBbfAmaDkSgShSKBUzvVeQCfjCgUvqxb37pgZeOqsndl_JOpxjWGGjV8irjwwWkbGDZQ1I0Y6-HW6mvjbtA)

## Step 2 : Launch MetaMask <a href="#running-metamask" id="running-metamask"></a>

If metamask is successfully installed, it will be visible in the extensions tab at the top right. If you click MetaMask in the picture below, you will be taken to the MetaMask start screen.

If MetaMask is successfully installed, it will be visible in the Extensions tab in the upper right corner. Pressing MetaMask in the figure below takes you to the MetaMask start screen.

![](https://lh4.googleusercontent.com/1CrLrcodMobrBIikw1vWUviujur6twBWa9zOroyVTahX31s1LhR1y-XI9JUgiVcawdrjxLhlp8DZjB_ffjPhFxda2lDzJVPpZn2z5lWrZwKvwckKJdRYWrXU6OxnLNOB_8xSBQ)

Users who have previously created a wallet using MetaMask can select 'Import Wallet' and recover the wallet using the Secret Recovery Phase that they have backed up. On the other hand, new users press 'Create a Wallet'.

The following is based on the case where 'Create a Wallet' is selected.

First of all, you need to register 'Password' as shown in the picture below. The password is not stored on the server, but it is information that the user must remember, so please manage it carefully. Never store in a place that can be easily exposed.

![](https://lh5.googleusercontent.com/bPYjUVo4xUS9afKNBKq-c2m8gW-cBobqMmbfvBHIflw2Pv4NgLs9R8ITYTJDjuGeXJzqk8h7oLJQwouccAD3q5pEQ5nJOEuZKgwrNUFqqknKLqIlK68uQBcL14v8ae_-JO5YBg)

Pressing 'Create' in the figure above creates 12 seed phrases (Secret Recovery Phrase). These 12 seed phrases are the 'secret key' of a wallet that stores multiple assets. Remember, this information should never be kept on devices connected to the Internet.

In the event of device theft, loss, or failure, the wallet and funds will be unrecoverable without the seed phrase. On the next page, confirm that you have 'written it down'.

![](https://lh3.googleusercontent.com/RprVBTl3qctcSEPaVwQHrfupaUJYjDGp7THklZnCv5TQX3bl0138tfCmz-n-hkN78mPQzCJJ0P-peCxTJdlGhwamSSAwHUlZGMKovakPp-fxRvXjZszN1c022MpOJI5UejggLg)

## Step 3 : Add WEMIX3.0 Network Information <a href="#adding-wemix-network-information" id="adding-wemix-network-information"></a>

If MetaMask is executed through the above procedure, you can see the screen below.

<figure><img src="/files/ufFJFMANVbbUGGP5Y7Au" alt=""><figcaption></figcaption></figure>

You can see that MetaMask basically supports Ethereum wallets. You cannot use it as a WEMIX wallet in these settings.

Now, let's change the network from Ethereum to WEMIX3.0 Mainnet/Testnet. In Settings, let's connect WEMIX3.0 blockchain node to the MetaMask wallet.

<figure><img src="/files/lo6CTiMJkl4TETyCVxEp" alt=""><figcaption></figcaption></figure>

In the figure below, you will be moved to the 'Networks' menu on the Settings screen. Then click 'Add a Network' and manually add WEMIX3.0 Mainnet or Testnet.

<figure><img src="/files/SRmMlc2eLQhxuRdKoYzC" alt=""><figcaption><p>Added WEMIX3.0 Testnet Network</p></figcaption></figure>

<figure><img src="/files/3KpHWaZosMcgeelaoTMs" alt=""><figcaption><p>Added WEMIX3.0 Mainnet Network</p></figcaption></figure>

The following parameters must be entered for each network:

{% hint style="info" %}

#### Testnet

Network Name: WEMIX\_Testnet&#x20;

New RPC URL: <https://api.test.wemix.com/>

ChainID: 1112

Symbol: tWEMIX

Block Explorer URL: <https://explorer.test.wemix.com/>
{% endhint %}

{% hint style="info" %}

#### Mainnet

Network Name: WEMIX\_Mainnet&#x20;

New RPC URL: <https://api.wemix.com/>

ChainID: 1111

Symbol: WEMIX

Block Explorer URL: <https://explorer.wemix.com/>
{% endhint %}

To send WEMIX or TWEMIX using MetaMask, you can add both Mainnet and Testnet. When you save that network and return to the main screen, the network automatically changes to the information you enter and also the unit display is no longer ETH but WEMIX.

<figure><img src="/files/Ol1CMhq7c1O9pGEsIeEc" alt=""><figcaption></figcaption></figure>

## Step 4 : Send WEMIX coin <a href="#send-wemix-coins" id="send-wemix-coins"></a>

To send WEMIX coins, click the 'Send' button. Then, a window for entering the address you want to receive (Send to) appears.

Enter the address you want to receive and record the amount you want to send in the 'Amount' field.

<figure><img src="/files/qocLVlsXTZyDpjS1Lvou" alt=""><figcaption></figcaption></figure>

Enter the address and amount to receive and select 'Next', a screen showing 'Gas Fee' based on Ethereum will be displayed as shown below.

WEMIX has a different fee policy than Ethereum, so press the 'EDIT' button to go to the screen below.

<figure><img src="/files/zd6V0b8k6RMSt9ZluWlr" alt=""><figcaption></figcaption></figure>

In the picture above, if 'Advanced Options' is selected, the user sets 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/Tc34SzmNRnf5bICkpok9" alt=""><figcaption></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Check the check box to keep the value you changed.&#x20;

Complete the Fee setting in the figure above and select 'Save' to be ready for withdrawal.&#x20;

Selecting 'Confirm' creates a 'Send WEMIX' transaction and once confirmed by WEMIX Block Producers, it is included in the block and the transfer is complete.


# Testnet Faucet

## Testnet Faucet

The **WEMIX3.0 Testnet Faucet** is a free web service that provides funding for developing and experimenting with smart contracts on the blockchain network. Developers can obtain tWEMIX and tWEMIX$ without purchasing WEMIX on the mainnet, allowing them to test various features of the WEMIX ecosystem.

Currently, the Testnet Faucet supports tWEMIX and tWEMIX$. tWEMIX serves as the native coin for the testnet and is essential for gas fees and other payments. tWEMIX$ is the official test stablecoin and can be used to experiment with functions related to stablecoins such as WEMIX.Fi, PNIX DEX, or Kurrency.

{% hint style="danger" %}
The tWEMIX and tWEMIX$ provided through the Testnet Faucet are only available for development and testing purposes and cannot be used on the mainnet.
{% endhint %}

## Using the Testnet Faucet

The Testnet Faucet is provided through a separate web page, and users can receive test funds to their MetaMask wallet address. By selecting either tWEMIX or tWEMIX$ and entering your wallet address, funds will be sent within approximately 10 seconds. When using the Faucet, 10 tWEMIX and 100 WEMIX$ are provided per transaction. You must use up all the funds provided in one transaction before being able to use the Faucet again.

{% embed url="<https://wallet.test.wemix.com/faucet>" %}

{% hint style="info" %}
You can find detailed instructions on how to use the Testnet Faucet to receive test coins in the [Receive Test Coin](/en/tutorial/receive-test-coin) section.
{% endhint %}


# Install & Operation

This chapter contains instructions on installing and operating `gwemix`.&#x20;

Developers can download the binary from gwemix official Github repository, clone the source code, and install it when a Linux machine with minimum specifications is ready.&#x20;

Follow the instructions below to install the WEMIX client.

* [End Node](/en/install-and-operation/end-node)
* [Block Producer Node](/en/install-and-operation/block-producer-node)
* [Download](/en/install-and-operation/download)
* [Operation Guide](/en/install-and-operation/operation-guide)


# End Node

## Target use

* The contents included in this chapter are for users who directly install WEMIX3.0 blockchain end node and need to read and write data directly to the blockchain through the [JSON-RPC API](https://docs.wemix.com/en/install-and-operation/pages/v0rv3ntLeeKevFTmPAQA#wemix3.0-json-rpc-api) method.
* If you are a general dApp developer or want to test, you can use the [public RPC server](/en/quick-start/start-node/use-public-api-server-rpc) provided for free instead of installing the blockchain end node yourself.
* In general, the following cases require the installation and operation of blockchain end nodes.
  1. Exchange operator
  2. High-performance dApp developer

## Roles and functions

* Validation of received block data
* Synchronization of block data and status information
* RPC, WS request processing
* Forward the received transaction to the connected BN (Bridge Node)


# System Requirements

End Node

The recommended and minimum hardware specifications for operating the WEMIX3.0 blockchain end node are as follows. Both physical servers or cloud virtual machines (VMs) similar to the recommended specifications below can be used.

{% tabs %}
{% tab title="Recommended" %}

* vCPU: 16 core&#x20;
* RAM: 128 GB&#x20;
* Storage: Minimum 1TB SSD (must be expandable periodically)
* Example: [Azure Virtual Machine Standard*E16d*v4](https://azureprice.net/vm/Standard_E16d_v4)&#x20;
  {% endtab %}

{% tab title="Minimum" %}

* vCPU: 8 core&#x20;
* RAM: 64 GB&#x20;
* Storage: Minimum 1TB SSD (must be expandable periodically)
* Example: [Azure Virtual Machine Standard*E8d*v4](https://azureprice.net/vm/Standard_E8d_v4)
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}
**Storage**

As the WEMIX network grows, so does the minimum storage requirements. We recommend using more than the minimum requirements to safely run the full nodes.

The storage growth rate varies according to the TPS and transaction size of the WEMIX3.0 blockchain, so full node operators should periodically check the disk size.

In general, you can operate with --gcmode full, which does not store the state information of all previous blocks, but if necessary, when operated with --gcmode archive, the chain data size increases several times faster than operating with --gcmode full. Thus, be careful about it.
{% endhint %}

{% hint style="info" %}
**Operating system**

It is officially recommended to install and run in a Linux-based environment. We plan to provide support for other operating systems in the future.
{% endhint %}


# Firewall Setting

End Node

## EN security <a href="#en" id="en"></a>

The outbound & inbound Security Groups that need to be set in the end node are as follows.

* Outbound

| SOURCE | DESTINATION | SERVICE | PROTOCOL | PORT |
| ------ | ----------- | ------- | -------- | ---- |
| EN     | all         | p2p     | tcp, udp | 8589 |

* Inbound

| SOURCE | DESTINATION | SERVICE | PROTOCOL | PORT |
| ------ | ----------- | ------- | -------- | ---- |
| all    | EN          | p2p     | tcp, udp | 8589 |
| Dev    | EN          | rpc     | tcp      | 8588 |
| Dev    | EN          | ws      | tcp      | 8598 |


# Install Guide

End Node

### Build

WEMIX3.0 is implemented based on Ethereum, so the build method is the same as `go-ethereum`, except that `geth` has been changed to `gwemix`.

First, the developer downloads the [`go-wemix`](https://github.com/wemixarchive/go-wemix) source code by executing the following command on the Linux machine.

```
git clone https://github.com/wemixarchive/go-wemix.git
```

After that, go to the go-wemix directory and run the command below to start `gwemix` build. Depending on the USE\_ROCKSDB option, it is built as Rocksdb or Leveldb. Since the two databases are not compatible, you must check the db type and version when using chain data received from another machine.

This chapter is explained based on Ubuntu environment. To build gwemix from source code directly in Ubuntu environment, you need to follow the steps below.

{% tabs %}
{% tab title="Ubuntu 22.04 LTS" %}

#### Dependency

```
sudo apt-get update
sudo apt-get install -y build-essential golang
```

#### Rocksdb only

```
sudo apt-get install -y libsnappy-dev libjemalloc-dev
cd /usr/lib/x86_64-linux-gnu/
sudo ln -sf libjemalloc.so.2 libjemalloc.so.1
```

#### Download source code

```
git clone https://github.com/wemixarchive/go-wemix.git 
cd go-wemix
```

#### In case of rocksdb

```
make
```

#### In case of leveldb

```
make USE_ROCKSDB=NO
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME with the following info

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full    # snap, full or archive 
GWEMIX_OPTS="--maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}

{% tab title="Ubuntu 20.04.4 or 18.04.6 LTS" %}

#### Dependency

```
sudo apt-get update
sudo apt-get install -y build-essential 
```

#### Rocksdb only

```
sudo apt-get install -y libsnappy-dev libjemalloc-dev
cd /usr/lib/x86_64-linux-gnu/
sudo ln -sf libjemalloc.so.2 libjemalloc.so.1
```

#### Install go version 1.18.4

```
wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz 
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.4.linux-amd64.tar.gz 
export PATH=$PATH:/usr/local/go/bin 
source $HOME/.profile
```

#### Download source code

```
git clone https://github.com/wemixarchive/go-wemix.git 
cd go-wemix
```

#### In case of rocksdb

```
make
```

#### In case of leveldb

```
make USE_ROCKSDB=NO
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME with the following info

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full    # snap, full or archive 
GWEMIX_OPTS="--maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}
{% endtabs %}

When executing the `make`, `logrot` and `gwemix.tar.gz` are built at once for convenience of installation and are saved as compressed files in the `build` directory. The generated `gwemix.tar.gz` contains the following files.

```
bin/gwemix        ## gwemix binary
bin/gwemix.sh     ## gwemix control shell script
bin/logrot        ## log rotator
```

### **Build with Docker Image**

WEMIX3.0 can use docker images to solve cases where library dependencies are a problem. When building on Linux or MacOS X, you can build it through the following process.

{% hint style="info" %}
Currently, docker build is not supported in Apple Chip MacOS environment and Windows environment, and support will be provided in the future.
{% endhint %}

{% tabs %}
{% tab title="Rocksdb" %}

```
make USE_ROCKSDB=YES gwemix-linux
```

{% endtab %}

{% tab title="Leveldb" %}

```
make USE_ROCKSDB=NO gwemix-linux
```

{% endtab %}
{% endtabs %}

To install the `gwemix.tar.gz` binary built through Docker by copying it to the Ubuntu environment, follow the steps below.

{% tabs %}
{% tab title="Ubuntu 22.04 or 20.04.4 LTS" %}

#### Rocksdb only

```
sudo apt-get install -y libsnappy-dev libjemalloc-dev
cd /usr/lib/x86_64-linux-gnu/
sudo ln -sf libjemalloc.so.2 libjemalloc.so.1
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME <a href="#create-rc-at-optnxt-2" id="create-rc-at-optnxt-2"></a>

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full    # snap, full or archive 
GWEMIX_OPTS="--maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}

{% tab title="Ubuntu 18.04.6 LTS" %}

#### Rocksdb only

```
sudo apt-get isntall libjemalloc1
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full    # snap, full or archive 
GWEMIX_OPTS="--maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}
{% endtabs %}


# Block Producer Node

## Target use

* This chapter is for NCPs (Node Council Partners) participating as BP nodes of the WEMIX3.0 blockchain.
* BP nodes must perform the consensus process and quickly generate and propagate blocks, so hardware, network resources, and firewall policy requirements must be strictly met.

<figure><img src="/files/caipdHrnEsjaD74jR9oX" alt=""><figcaption><p>WEMIX3.0 Network Connection</p></figcaption></figure>


# System Requirements

Block Producer Node

The hardware specifications for operating the WEMIX3.0 BP blockchain node are as follows.

{% tabs %}
{% tab title="HW specifications" %}

* vCPU: 32 core&#x20;
* RAM: 256 GB&#x20;
* Storage: Minimum 2TB SSD (must be expandable periodically)
* Recommended: [Azure Virtual Machine Standard\_*E32ds\_*&#x76;4 ](https://azureprice.net/vm/Standard_E32ds_v4)
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}
**Specification**

To safely operate BP nodes, you must use HW above the recommended requirements.

For BP, it is recommended to operate with --syncmode full.
{% endhint %}

{% hint style="info" %}
**Operating system**

It is officially recommended to install and run in a Linux-based environment. We plan to provide support for other operating systems in the future.
{% endhint %}


# Firewall Setting

Block Producer Node

## BP Node Security

The outbound & inbound Security Groups that must be set in the BP node is as follows.

* Outbound

| SOURCE | DESTINATION | SERVICE | PROTOCOL | PORT |
| ------ | ----------- | ------- | -------- | ---- |
| BP     | BP          | p2p     | tcp      | 8589 |
| BP     | BP          | etcd    | tcp      | 8590 |

* Inbound

| SOURCE | DESTINATION | SERVICE | PROTOCOL | PORT |
| ------ | ----------- | ------- | -------- | ---- |
| BP     | BP          | p2p     | tcp      | 8589 |
| BP     | BP          | etcd    | tcp      | 8590 |
| PN     | BP          | p2p     | tcp      | 8589 |

The list of BPs and PNs that need to be applied to the Security Group will be delivered separately as a document when BP is installed.


# Install Guide

Block Producer Node

### Build

WEMIX3.0 is implemented based on Ethereum, so the build method is the same as `go-ethereum`, except that `geth` has been changed to `gwemix`. The installation method of BP is the same as that of EN and uses the same binary. Therefore, it proceeds to build in the same procedure.

First, the developer downloads the [`go-wemix`](https://github.com/wemixarchive/go-wemix) source code by executing the following command on the Linux machine.

```
git clone https://github.com/wemixarchive/go-wemix.git
```

After that, go to the go-wemix directory and run the command below to start `gwemix` build. Depending on the USE\_ROCKSDB option, it is built as Rocksdb or Leveldb. Since the two databases are not compatible, you must check the db version when using chain data received from another machine.

This chapter is based on Ubuntu environment. To build gwemix from source code directly in Ubuntu environment, you need to follow the steps below.

{% tabs %}
{% tab title="Ubuntu 22.04 LTS" %}

#### Dependency

```
sudo apt-get update
sudo apt-get install -y build-essential golang
```

#### Rocksdb only

```
sudo apt-get install -y libsnappy-dev libjemalloc-dev
cd /usr/lib/x86_64-linux-gnu/
sudo ln -sf libjemalloc.so.2 libjemalloc.so.1
```

#### Download source code

```
git clone https://github.com/wemixarchive/go-wemix.git 
cd go-wemix
```

#### In case of rocksdb

```
make
```

#### In case of leveldb

```
make USE_ROCKSDB=NO
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME with the following info

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full
GWEMIX_OPTS="--txpool.nolocals --snapshot=false --maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}

{% tab title="Ubuntu 20.04.4 or 18.04.6 LTS" %}

#### Dependency

```
sudo apt-get update
sudo apt-get install -y build-essential 
```

#### Rocksdb only

```
sudo apt-get install -y libsnappy-dev libjemalloc-dev
cd /usr/lib/x86_64-linux-gnu/
sudo ln -sf libjemalloc.so.2 libjemalloc.so.1
```

#### Install go version 1.18.4

```
wget https://go.dev/dl/go1.18.4.linux-amd64.tar.gz 
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.18.4.linux-amd64.tar.gz 
export PATH=$PATH:/usr/local/go/bin 
source $HOME/.profile
```

#### Download source code

```
git clone https://github.com/wemixarchive/go-wemix.git 
cd go-wemix
```

#### In case of rocksdb

```
make
```

#### In case of leveldb

```
make USE_ROCKSDB=NO
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME with the following info

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full
GWEMIX_OPTS="--txpool.nolocals --snapshot=false --maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}
{% endtabs %}

When executing the `make`, `logrot` and `gwemix.tar.gz` are built at once for convenience of installation and are saved as compressed files in the `build` directory. The generated `gwemix.tar.gz` contains the following files.

```
bin/gwemix        ## gwemix binary
bin/gwemix.sh     ## gwemix control shell script
bin/logrot        ## log rotator
```

### **Build with Docker Image**

WEMIX3.0 can use docker images to solve cases where library dependencies are a problem. When building on Linux or MacOS X, you can build it through the following process.

{% hint style="info" %}
Currently, docker build is not supported in Apple Chip MacOS environment and Windows environment, and support will be provided in the future.
{% endhint %}

{% tabs %}
{% tab title="Rocksdb" %}

```
make USE_ROCKSDB=YES gwemix-linux
```

{% endtab %}

{% tab title="Leveldb" %}

```
make USE_ROCKSDB=NO gwemix-linux
```

{% endtab %}
{% endtabs %}

To install the `gwemix.tar.gz` binary built through Docker by copying it to the Ubuntu environment, follow the steps below.

{% tabs %}
{% tab title="Ubuntu 22.04 or 20.04.4 LTS" %}

#### Rocksdb only

```
sudo apt-get install -y libsnappy-dev libjemalloc-dev
cd /usr/lib/x86_64-linux-gnu/
sudo ln -sf libjemalloc.so.2 libjemalloc.so.1
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME <a href="#create-rc-at-optnxt-2" id="create-rc-at-optnxt-2"></a>

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full 
GWEMIX_OPTS="--txpool.nolocals --snapshot=false --maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}

{% tab title="Ubuntu 18.04.6 LTS" %}

#### Rocksdb only

```
sudo apt-get isntall libjemalloc1
```

#### Copy and untar "build" to $GWEMIX\_HOME

```
GWEMIX_HOME='/opt/gwemix'
sudo mkdir -p $GWEMIX_HOME 
sudo chown $USER:$USER $GWEMIX_HOME
cp build/gwemix.tar.gz $GWEMIX_HOME/
cd $GWEMIX_HOME 
tar xvzf gwemix.tar.gz
```

#### Create .rc at $GWEMIX\_HOME

```
PORT=8588 
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full 
GWEMIX_OPTS="--txpool.nolocals --snapshot=false --maxpeers=100"
```

#### Start gwemix

```
$GWEMIX_HOME/bin/gwemix.sh start
```

#### Check log

```
tail -F $GWEMIX_HOME/logs/log
```

{% endtab %}
{% endtabs %}


# Download

## Blockchain client binary for Linux <a href="#get-the-packages" id="get-the-packages"></a>

* [gwemix v0.10.0](https://github.com/wemixarchive/go-wemix/releases/tag/w0.10.0)
* [gwemix v0.10.1](https://github.com/wemixarchive/go-wemix/releases/tag/w0.10.1)
* [gwemix v0.10.2](https://github.com/wemixarchive/go-wemix/releases/tag/w0.10.2)
* [gwemix v0.10.3](https://github.com/wemixarchive/go-wemix/releases/tag/w0.10.3)
* [gwemix v0.10.4](https://github.com/wemixarchive/go-wemix/releases/tag/w0.10.4)
* [gwemix v0.10.5](https://github.com/wemixarchive/go-wemix/releases/tag/w0.10.5)

### Chaindata (Rocksdb Only)

Chaindata of WEMIX3.0 mainnet and testnet can be downloaded p2p by running gwemix client. However, as the size of blockchain data continues to increase, the time required for synchronization is also increasing. Therefore, for the convenience of users, the WEMIX Foundation provides chaindata of WEMIX3.0 mainnet and testnet by daily backup and compression. After downloading the chaindata through the link below, you can use it by unzipping it in the `$GWEMIX_HOME/geth` directory.

* [Mainnet](https://packages.wemix.com/)
* [Testnet](https://packages.test.wemix.com/)


# Operation Guide

Start/Stop/Restart EN

The binary file of the WEMIX3.0 client node (i.e., `gwemix`) can be controlled using the following command.

### Start

This is a command to run the built `gwemix`using script (i.e., `gwemix.sh`).

```
{data_directory}/bin/gwemix.sh start
```

When `gwemix` is executed with the above command, a log file with a size of 10MB is automatically saved in the `{data_folder}/log` directory. Up to 6 log files are saved, and this number can be changed in `gwemix.sh`.

### Stop

This is a command to stop running `gwemix`.

```
{data_directory}/bin/gwemix.sh stop
```

### Restart

This is a command to stop and start `gwemix`in operation.

```
{data_directory}/bin/gwemix.sh restart
```

### Remove data

This is a command to delete all `chaindata` of `gwemix` in operation. **Please note that all `chaindata` will be removed by this operation.**

```
{data_directory}/bin/gwemix.sh wipe
```

### Console access

This is a command to access `gwemix` JavaScript console.

```
{data_directory}/bin/gwemix.sh console
```

### Log

The status of the current `gwemix`can be identified using the log file.

```
tail -F {data_folder}/logs/log
```

The log level is divided from 1 to 5 and the default is 3.

```
0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3)
```

To change the log level, access the gwemix console and execute the command below to apply immediately.

```
debug.verbosity({log_level})
```


# dApp Developer

This section introduces the environment and usage for smart contract development provided by WEMIX3.0 for dApp development. It introduces the WEMIX3.0 API provided through Ethereum 100% compatible JSON-RPC and Open API server.


# Smart Contract

WEMIX3.0 provides the same smart contract environment as Ethereum. This chapter explains how to introduce and use Solidity, precompiled contracts provided by WEMIX3.0, and write, deploy, and test simple contracts.


# Solidity

This chapter describes the Solidity language and development environment.

Solidity is an advanced object-oriented language for implementing smart contracts, a program that controls the behavior of accounts within Ethereum states. Solidity is a bracket-type language influenced by C++, Python, and JavaScript designed to work with Ethereum Virtual Machines(EVMs). Solidity is statically typed and supports inheritance, library, and complex user-defined types, among other features.&#x20;

Solidity allows creating contracts for purposes such as voting, crowdfunding, blind auctions, and multi-signed wallets.

### Integrated Development Environment(IDE)

Various environments support Solidity. It can be used by installing Solidity Plugin from browser-based Remix to popular IDE tools such as IntelliJ and Visual Studio.

#### **How to use Remix**

Go to <https://remix.ethereum.org> and: Storage.sol, Owner.sol, and Ballot.sol are shown in the contracts directory, and to create a new smart contract, select it to erase it and create a new file.

![Remix Home Screen](/files/C8sPEQopkPeRAmF4X4l3)

Create and view the following example smart contracts: The example Smart Contract provides the ability to read count values through the `get()` function and raise or lower count values through the `inc()`, and `dec()` functions.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.11;

contract Counter {
    uint256 count;
    
    constructor(uint256 _count) {
        count = _count;
    }
    
    function get() public view returns (uint256) {
        return count;
    }
    
    function inc() public {
        count += 1;
    }
    
    function dec() public {
        count -= 1;
    }
}
```

![Writing Sample](/files/Jxn7OmSbkrMxQR2dD26u)

Once the code is written, compile after selecting the correct compiler version on the Solidity Compiler screen.

![Compile Sample code](/files/953VDgVjbmTKu2AY17HY)

From the Deploy & Run Transactions screen, you can select the environment you want to deploy and deploy Smart Contract to test it. The figure below is an example of a deployment to the WEMIX3.0 testnet using the "Injected Provider-Metamask" provided by Remix.

![Sample code](/files/HnKZYwgEAwZSDS31NrS5)

If you are using MetaMask, you must add WEMIX3.0 Testnet as follows: The gas fee of WEMIX3.0 Testnet is different from Ethereum, so you need to change it when you send it. You can change Max fee to 100 GWEI and Max priority fee to 100.000000001 GWEI.

For more information about adding networks and setting gas costs, see [Use MetaMask](/en/quick-start/account/use-metamask).


# Precompiled Contracts

The WEMIX3.0 Blockchain provides pre-compiled contracts.

There are precompiled contracts in WEMIX smart contracts. The compiled contract provides contracts deployed in Ethereum and newly supported by WEMIX.

## Recovery of ECDSA signature

The 0x01 address provides a function to recover the public key of the elliptic curve digital signature algorithm. The hash value of the transaction and the v, r, s signature value are entered, and the address is returned.

The contract address distributed on the WEMIX3.0 testnet is 0xD37d47514f46efaCa967fc191D040B3ee713110A, which can be found through testnet explorer.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract Ecrecover {
    address addressTest = 0x12Cb274aAD8251C875c0bf6872b67d9983E53fDd;
    bytes32 msgHash = 0xc51dac836bc7841a01c4b631fa620904fc8724d7f9f1d3c420f0e02adf229d50;
    uint8 v = 0x1b;
    bytes32 r = 0x44287513919034a471a7dc2b2ed121f95984ae23b20f9637ba8dff471b6719ef;
    bytes32 s = 0x7d7dc30309a3baffbfd9342b97d0e804092c0aeb5821319aa732bc09146eafb4;


    function verify() public view returns(bool) {
        // Use ECRECOVER to verify address
        return (ecrecover(msgHash, v, r, s) == (addressTest));
    }
}
```

## SHA256 Hash function

The 0x02 address provides an SHA-256 hash function. When the data is entered, the corresponding SHA-256 hash value is returned.

The contract address distributed on the WEMIX3.0 testnet is 0xdbec92984EE8508e3A47C150C5BDBF02B8928A72, which can be found through testnet explorer.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract Sha256hash {
    bytes32 public expectedHash = 0x7f83b1657ff1fc53b92dc18148a1d65dfc2d4b1fa3d677284addd200126d9069;

    function calculateHash() internal pure returns (bytes32) {
        string memory word = 'Hello World!';
        bytes32 hash = sha256(bytes (word));

        return hash;        
    }

    function checkHash() public view returns(bool) {
        return (calculateHash() == expectedHash);
    }
}

```

## RIPEMD160 Hash function

The 0x03 address provides a RIPEMD-160 hash function. When data is entered, the corresponding RIPEMD-160 hash value is returned.

The contract address distributed on the WEMIX3.0 testnet is 0x39b2CB921353097993e72e811A5FC4992b72e926, which can be found through testnet explorer.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract Ripmd160 {
    bytes20 public expectedHash = hex'8476ee4631b9b30ac2754b0ee0c47e161d3f724c';

    function calculateHash() internal pure returns (bytes20) {
        string memory word = 'Hello World!';
        bytes20 hash = ripemd160(bytes (word));

        return hash;        
    }

    function checkHash() public view returns(bool) {
        return (calculateHash() == expectedHash);
    }
}
```

## Data Copy function

The 0x04 address provides a data copy function. This feature is used as a more reasonable way to copy data to memory.&#x20;

Currently, Solidity does not support the dataCopy function, so it must be called in-line assembly.

The contract address distributed on the WEMIX3.0 testnet is 0x709Ba0DD7055BC61B781Ddda31F5Df0018F33391, which can be found through testnet explorer.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract Datacopy {
    bytes public memoryStored;

    function callDatacopy(bytes memory data) public returns (bytes memory) {
        bytes memory result = new bytes(data.length);
        assembly {
            let len := mload(data)
            if iszero(call(gas(), 0x04, 0, add(data, 0x20), len, add(result,0x20), len)) {
                invalid()
            }
        }

        memoryStored = result;

        return result;
    }
}
```

## Modular Exponentiation function

The 0x05 address provides a function to raise the integer `b` (base) to `e-`square (exponential) and calculate the remainder when divided by a positive integer `m` (modulus).

The Solidity Compiler does not support this and must be called an inline assembly.

The contract address distributed on the WEMIX3.0 testnet is 0x370AF3a491f1D7cc08D7cc590bB2a746E612a216, which can be found through testnet explorer.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract ModularCheck {
    uint public checkResult;

    // Function to Verify ModExp Result
    function verify( uint _base, uint _exp, uint _modulus) public {
        checkResult = modExp(_base, _exp, _modulus);
    }

    function modExp(uint256 _b, uint256 _e, uint256 _m) public returns (uint256 result) {
        assembly {
            // Free memory pointer
            let pointer := mload(0x40)
            // Define length of base, exponent and modulus. 0x20 == 32 bytes
            mstore(pointer, 0x20)
            mstore(add(pointer, 0x20), 0x20)
            mstore(add(pointer, 0x40), 0x20)
            // Define variables base, exponent and modulus
            mstore(add(pointer, 0x60), _b)
            mstore(add(pointer, 0x80), _e)
            mstore(add(pointer, 0xa0), _m)
            // Store the result
            let value := mload(0xc0)
            // Call the precompiled contract 0x05 = bigModExp
            if iszero(call(not(0), 0x05, 0, pointer, 0xc0, value, 0x20)) {
                revert(0, 0)
            }
            result := mload(value)
        }
    }
}
```

## Point addition on Elliptic curve

The 0x06 address provides a function that implements an addition operation for points on an elliptic curve. This operation receives two valid points(ax,ay) and(bx,by) on the elliptic curve bn256 and returns the point(ax,ay)+(bx,by) on the elliptic curve as a result.&#x20;

The Solidity Compiler does not support this function and must be called an inline assembly.

The contract address distributed on the WEMIX3.0 testnet is 0x557359e169E56aAcb0d1E5FA9A7E8717967FcEbD, which can be found through testnet explorer.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract BnAddCheck {
    bytes32[2] public checkResult;

    // Function to Verify ModExp Result
    function verify(uint ax, uint ay, uint bx, uint by) public {
        bytes32[4] memory input;
        input[0] = bytes32(ax);
        input[1] = bytes32(ay);
        input[2] = bytes32(bx);
        input[3] = bytes32(by);
        checkResult = callBn256Add(input[0], input[1], input[2], input[3]);
    }

    function callBn256Add(bytes32 ax, bytes32 ay, bytes32 bx, bytes32 by) public returns (bytes32[2] memory result) {
        bytes32[4] memory input;
        input[0] = ax;
        input[1] = ay;
        input[2] = bx;
        input[3] = by;
        assembly {
            let success := call(gas(), 0x06, 0, input, 0x80, result, 0x40)
            switch success
            case 0 {
                revert(0,0)
            }
        }
    }
}
```

## Point multiplication on Elliptic curve

The 0x07 address provides a function that implements a multiplication operation for points on an elliptic curve expressed as scalar values. This operation takes a valid point(x,y) on the elliptic curve bn256 and returns the point scalar \* (x,y) on the elliptic curve.&#x20;

The Solidity Compiler does not support this function and must be called as inline assembly.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract BnMulCheck {
    bytes32[2] public checkResult;

    // Function to Verify ModExp Result
    function verify(uint x, uint y, uint scalar) public {
        bytes32[3] memory input;
        input[0] = bytes32(x);
        input[1] = bytes32(y);
        input[2] = bytes32(scalar);
        checkResult = callBn256ScalarMul(input[0], input[1], input[2]);
    }

    function callBn256ScalarMul(bytes32 x, bytes32 y, bytes32 scalar) public returns (bytes32[2] memory result) {
        bytes32[3] memory input;
        input[0] = x;
        input[1] = y;
        input[2] = scalar;
        assembly {
            let success := call(not(0), 0x07, 0, input, 0x60, result, 0x40)
            switch success
            case 0 {
                revert(0,0)
            }
        }
    }
}
```

## Elliptic curve pairing function for zkSNARK validation

The 0x08 address provides a function for elliptic curve peering operations to validate the zkSNARK proposed in EIP-197.&#x20;

The Solidity Compiler does not support this function and must be called as inline assembly.

```
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.10;

contract BnPairingCheck {

    ...
    function pairing(G1Point[] memory p1, G2Point[] memory p2) public returns (bool) {
        require(p1.length == p2.length);
        uint elements = p1.length;
        uint inputSize = elements * 6;
        uint[] memory input = new uint[](inputSize);
        for (uint i = 0; i < elements; i++)
        {
            input[i * 6 + 0] = p1[i].X;
            input[i * 6 + 1] = p1[i].Y;
            input[i * 6 + 2] = p2[i].X[0];
            input[i * 6 + 3] = p2[i].X[1];
            input[i * 6 + 4] = p2[i].Y[0];
            input[i * 6 + 5] = p2[i].Y[1];
        }
        uint[1] memory out;
        bool success;
        assembly {
            success := call(gas(), 0x08, 0, add(input, 0x20), mul(inputSize, 0x20), out, 0x20)
            switch success
            case 0 {
                invalid()
            }
        }
        require(success);
        return out[0] != 0;
    }
    ...
}
```


# Sample Contracts

This chapter describes how to write and deploy smart contracts using truffle.

### **Creating Smart Contracts**

This chapter describes how to create and distribute smart contracts using Truffle.

### **How to use Truffle**

#### 1. Installation

Install truffle using NPM, the Node Package Manager. Please refer to the following link for how to install npm: <https://www.npmjs.com/>

```
$ npm install --g truffle
```

#### 2. Initialization

```
$ truffle init
```

When truffle init is performed, a truffle project is created. The Truffle project consists of build/contracts, contracts, migrations, tests, and truffle-config.js.

* build/contracts: The result of compiling the contract written in solidity (abi, bytecode) is saved
* contract: smart contract solidity files
* migrations: deploy code(js format)
* test: test code(js format)
* truffle-config.js: Configuration such as solidity compiler version setting, network setting, etc

Performing truffle init, the example solidity code called Migrations.sol is created as follows in the contract folder. To deploy the written smart contract, the user must first compile the written smart contract.

```
pragma solidity >=0.4.22 <0.9.0;

contract Migrations {
  address public owner = msg.sender;
  uint public last_completed_migration;

  modifier restricted() {
    require(
      msg.sender == owner,
      "This function is restricted to the contract's owner"
    );
    _;
  }

  function setCompleted(uint completed) public restricted {
    last_completed_migration = completed;
  }
}

```

#### 3. Settings

You must modify the truffle-config.js file for compilation and deployment.

3.1 Account Settings

Add HDWalletProvider and privKeys in the Truflle-config.js file for settings for the account you want to use for deployment. Private keys can be imported after creating an account through the Web Wallet (<https://wallet.test.wemix.com>).

```
const HDWalletProvider = require('@truffle/hdwallet-provoder');
const privKeys = ["privatekey from Web Wallet"];
```

3.2 Network Settings

To use the WEMIX3.0 Testnet, add the network settings as follows:

```
networks: {
  wemix_testnet: {
    provider: ()=> new HDWalletProvider(privKeys, "https://api.test.wemix.com"),
    network_id: 1112,
    maxFeePerGas: 100000000010,
    maxPriorityFeePerGas: 100000000000
  }
},
```

3.3 Compiler Settings

Set the last Solidity compiler version you want to use. The current version is 0.8.x, and the example uses 0.8.11. If it is installed directly on the operating system using the compiler, you can comment on the docker setting just like the initial setting. To install using docker, set "docker: true" as shown below and docker should be installed. If you use the optimizer, you can un-annotate and set the appropriate settings.

```
compilers: {
    solc: {
      version: "0.8.11",    // Fetch exact version from solc-bin (default: truffle's version)
      docker: true,         // Use "0.5.1" you've installed locally with docker (default: false)
      // settings: {          // See the solidity docs for advice about optimization and evmVersion
      //  optimizer: {
      //    enabled: false,
      //    runs: 200
      //  },
      //  evmVersion: "byzantium"
      }
    }
```

#### 4. Write a Solidity code

Here is a simple smart contract example that increments or decrements the count variable and retrieves its value. Save it as Counter.sol.

```
pragma solidity ^0.8.0;

contract Counter {
    uint256 count;
    
    constructor(uint256 _count) {
        count = _count;
    }
    
    function get() public view returns (uint256) {
        return count;
    }
    
    function inc() public {
        count += 1;
    }
    
    function dec() public {
        count -= 1;
    }
}
```

#### 5. compile a Solidity code

When truffle compile \<file name> is performed in the truffle project folder, it compiles the target solidity file. The compiled solidity contracts are stored in the build/contracts folder as \<contract name>.json format.

```
truffle compile <file name>
ex) truffle compile Counter.sol
```

#### 6. Deploy a smart contract

To distribute the compiled contract file to the blockchain, write the script and save it as 2\_deploy\_contracts.js:

```
var Counter = artifacts.require("./Counter.sol");

module.exports = function(deployer) {
  deployer.deploy(Counter, 10)
    .then(() => Counter.deployed());
};
```

Deploy a contract individually by loading them as artifacts.require (\<artifacts file name stored in build/contracts>) and performing developer.deploy(contract\_artifacts, {constructor arguments}).

```
truffle migrate <file name>
ex) truffle migrate 1_initial_migration.js
```

The deployment script can be executed with the truffle migrate \<file name>. If not used, it is performed in numerical order used in the script name.

The results of the deployment on WEMIX3.0 Testnet are as follows: For deployment, the account that you want to use for deployment must have WEMIX. You can receive the required WEMIX from WEMIX-Faucet at <https://wallet.test.wemix.com>.

```
❯ truffle migrate --reset --network wemix_testnet

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


Starting migrations...
======================
> Network name:    'wemix_testnet'
> Network id:      1112
> Block gas limit: 105000000 (0x6422c40)


1_initial_migration.js
======================

   Replacing 'Migrations'
   ----------------------
   > transaction hash:    0x8f57dc573afbf1e33b75b2f05282aac9152be70cee292c31c94877397cf27d82
   > Blocks: 0            Seconds: 0
   > contract address:    0x09C38aaf3AF7Dba9Cc2B755d75Acccf4A5b7bECC
   > block number:        428504
   > block timestamp:     1658480854
   > account:             0x435AaB89A2878102fDf894dA3e5F3b4454FF9772
   > balance:             9.926666599999266666
   > gas used:            250142 (0x3d11e)
   > gas price:           100.000000001 gwei
   > value sent:          0 ETH
   > total cost:          0.025014200000250142 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:     0.025014200000250142 ETH


2_deploy_contracts.js
=====================

   Deploying 'Counter'
   -------------------
   > transaction hash:    0x893fcc06e298b95ff145c90311c5d36a3f8c511470e73a753d13195ea9dae051
   > Blocks: 0            Seconds: 0
   > contract address:    0x76F3A4DFD8741E765Bf27Cd0BaaE26f64c192765
   > block number:        428508
   > block timestamp:     1658480857
   > account:             0x435AaB89A2878102fDf894dA3e5F3b4454FF9772
   > balance:             9.904089499999040895
   > gas used:            179858 (0x2be92)
   > gas price:           100.000000001 gwei
   > value sent:          0 ETH
   > total cost:          0.017985800000179858 ETH

   > Saving migration to chain.
   > Saving artifacts
   -------------------------------------
   > Total cost:     0.017985800000179858 ETH

Summary
=======
> Total deployments:   2
> Final cost:          0.04300000000043 ETH
```

#### 7. Test a smart contract

The deployed contract can be tested through the javascript file as follows.

```
const migration = artifacts.require("Migrations");

contract("Migration", async () => {
    describe("Migration test", async () => {
        it("setCompleted", async () => {
            const migrations = await migration.deployed();
            await migrations.setCompleted(0);
        });
    });
});

```

* contract : test target contact
* describe : test case set
* it : Individual test case

```
truffle test <test file name>
```

When the test code is completed, save the test file as \<testName.test.js> format in the test folder, and perform the truffle test \<testName.test.js> to perform the test.


# JSON-RPC

For software applications to interact with the WEMIX3.0 blockchain, such as reading blockchain data or sending transactions to the network, they must connect to a WEMIX3.0 node. To do this, all WEMIX3.0 clients implement the JSON-RPC specification, providing a set of methods the application can use. JSON-RPC is a lightweight Remote Procedure Call(RPC) protocol without storing state. It is a transport method that can be used in multiple environments. It defines various data structures and processing rules and can be used within the same process, on sockets or HTTP, or in different message passing environments. Use JSON(RFC 4627) as the data format.

## WEMIX3.0 API Specifications

The WEMIX3.0 API specification is 100% compatible with the Ethereum API, and for more information, see the link to the Ethereum API specification.

<https://github.com/ethereum/execution-apis>

## WEMIX3.0 JSON-RPC API

The WEMIX3.0 JSON-RPC API method is 100% compatible with Ethereum. Please refer to the link below for details.

<https://ethereum.org/ko/developers/docs/apis/json-rpc/#json-rpc-methods>


# API Reference

This chapter describes the APIs provided through the WEMIX Explorer Open API Server. The provided API types include Account API, Block API, Contract API,  Transaction API, Event logs API, Tokens API, etc.

* [Account APIs](/en/dapp-developer/api-reference/account-apis)
* [Block APIs](/en/dapp-developer/api-reference/block-apis)
* [Contract APIs](/en/dapp-developer/api-reference/contract-apis)
* [Transaction APIs](/en/dapp-developer/api-reference/transaction-apis)
* [Event logs APIs](/en/dapp-developer/api-reference/event-logs-apis)
* [Tokens APIs](/en/dapp-developer/api-reference/tokens-apis)

The WEMIX Developer APIs are provided as a community service and without warranty, so please just use what you need and no more. \
They support both GET/POST requests and a rate limit of 120 requests/m.

To use the API service, use the API key below.

{% hint style="info" %}
**API Key**

1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
{% endhint %}

{% hint style="success" %}
Either a link back or mention that your app is "Powered by Wemix.io APIs" is required if used in commercial applications or sites.
{% endhint %}


# Account APIs

### Get WEMIX Balance for a single address

#### URI

<table data-header-hidden><thead><tr><th width="130"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>POST https://explorerapi.wemix.com/v1/accounts/balance</td></tr><tr><td><em>Testnet</em></td><td>POST https://explorerapi.test.wemix.com/v1/accounts/balance</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**        | **value**        | **required** |
| -------------- | ---------------- | ------------ |
| *Content-Type* | application/json | true         |
| *api-key*      | api key          | true         |

* **BODY(application/json)**

| **key**     | **type**      | **value**                                                                                                                                                                    | **required** |
| ----------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| *addresses* | List\<String> | <p>Address of account:                                                                         - min : 1                                              </p><p>- max : 20 </p> | true         |

#### REQUEST SAMPLE

```
POST https://explorerapi.test.wemix.com/v1/accounts/balance
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
Content-Type: application/json

{
    "addresses" : [
                "0x76C6E4A0a2A141343c370D5d36276DA643B0c829",
                "0xcD07A6d6A8DE7CdD3F5E1224eBC3540f70AEC52f"
    ]
}
```

#### **RESPONSE PARAMETER** <a href="#response-data-1" id="response-data-1"></a>

| **key**                | **type**      | **value**                   |
| ---------------------- | ------------- | --------------------------- |
| *status*               | String        | Status of request           |
| *message*              | String        | Response Message of request |
| *results*              | Json          | Results of request          |
| *results.data*         | List\<Object> | List of data                |
| *results.data.address* | String        | Address of account          |
| *results.data.balance* | String        | Balance of address          |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": [
            {
                "address": "0x76C6E4A0a2A141343c370D5d36276DA643B0c829",
                "balance": "999999999989999999999589997401953799975191356000"
            },
            {
                "address": "0xcD07A6d6A8DE7CdD3F5E1224eBC3540f70AEC52f",
                "balance": "10000000000009000000000000000004"
            }
        ]
    }
}
```

### Get list of transactions by address.

#### **URI**

<table data-header-hidden><thead><tr><th width="125"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/transactions</td></tr><tr><td><em>Testnet</em></td><td><p>GET </p><p>https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/transactions</p></td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api key   | true         |

* **PATH VARIABLE**

<table data-header-hidden><thead><tr><th width="155"></th><th></th><th width="173"></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>required</strong></td></tr><tr><td><em>address_hash</em></td><td>String</td><td><ul><li>Address(sender/receiver/contract)</li></ul></td><td>true</td></tr></tbody></table>

* **QUERY STRING**

<table data-header-hidden><thead><tr><th width="158"></th><th width="204"></th><th width="173"></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>required</strong></td></tr><tr><td><em>limit</em></td><td>Integer</td><td>Maximum number of record will retrieve               Default: 50, Max: 1000 </td><td>false</td></tr><tr><td><em>offset</em></td><td>Integer</td><td>Start retrieve record                                                   Default: 0</td><td>false</td></tr><tr><td><em>startBlock</em></td><td>String</td><td>Start block                                                   Default: null</td><td>false</td></tr><tr><td><em>endBlock</em></td><td>String</td><td>End block                                                   Default: null</td><td>false</td></tr><tr><td><em>input</em></td><td>Boolean</td><td>Include input data                                                   - true                                                   - Default: false</td><td>false</td></tr><tr><td><em>simple</em></td><td>Boolean</td><td>Include data simple                                                   - true                                                   - Default: false</td><td>false</td></tr><tr><td><em>condition</em></td><td>String</td><td><p>Address condition</p><p>- Default: all</p><p>- to</p><p>- from</p><p>- contract                                                                                                                                                     </p></td><td></td></tr></tbody></table>

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/v1/accounts/0xBbAB376Fd9c3a0f5ef1D2114c8dd1512FD858ee2/transactions
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER** <a href="#response-data-1" id="response-data-1"></a>

| **key**                                     | **type**      | **include data&#x20;*****simple*** | **value**                                                                                                                                                                                                        |
| ------------------------------------------- | ------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *status*                                    | String        |                                    | Status of request                                                                                                                                                                                                |
| *message*                                   | String        |                                    | Response Message of request                                                                                                                                                                                      |
| *reuslts*                                   | Json          |                                    | Results of request                                                                                                                                                                                               |
| *reuslts.count*                             | String        |                                    | Total count of data                                                                                                                                                                                              |
| *reuslts.data*                              | List\<Object> |                                    | List of data                                                                                                                                                                                                     |
| *results.data.timestamp*                    | String        |                                    | UTC time when the transaction occurred                                                                                                                                                                           |
| *results.data.nonce*                        | String        |                                    | Number of transaction requests                                                                                                                                                                                   |
| *results.data.sender*                       | String        | O                                  | Address of sender                                                                                                                                                                                                |
| *results.data.receiver*                     | String        | O                                  | Address of receiver                                                                                                                                                                                              |
| *results.data.value*                        | *String*      |                                    | Value of transaction                                                                                                                                                                                             |
| *results.data.confirmations*                | String        |                                    | Block height                                                                                                                                                                                                     |
| *results.data.transaction\_hash*            | String        | O                                  | Hash value of the transaction                                                                                                                                                                                    |
| *results.data.block\_hash*                  | String        |                                    | Hash value of the block                                                                                                                                                                                          |
| *results.data.transaction\_index*           | String        |                                    | Index of the transaction on the block                                                                                                                                                                            |
| *results.data.tx\_status*                   | String        | O                                  | Status of the transaction:                                                                               - 0: Failed,                                                                               - 1: Success |
| *results.data.tx\_message*                  | String        |                                    | Message when executing transaction                                                                                                                                                                               |
| results.data.in\_tx\_status                 | String        |                                    | Status of internal transaction.                             - 0: Failed,                                                                               - 1: Success                                              |
| *results.data.in\_tx\_message*              | String        |                                    | Message when executing internal transaction                                                                                                                                                                      |
| *results.data.tx\_fee*                      | String        | O                                  | Fee of executing the transaction                                                                                                                                                                                 |
| *results.data.block\_number*                | String        | O                                  | Number of block that contains the transaction                                                                                                                                                                    |
| *results.data.contract\_address*            | String        |                                    | Address of contract creation if this is create contract transaction                                                                                                                                              |
| *results.data.gas\_limit*                   | String        |                                    | Limit of gas for executing the transaction                                                                                                                                                                       |
| *results.data.gas\_price*                   | String        | O                                  | Gas price of transaction                                                                                                                                                                                         |
| *results.data.cumulative\_gas\_used*        | String        | O                                  | Total amount of gas used when transaction was executed in the block.                                                                                                                                             |
| results.data.gas\_used                      | String        |                                    | Total amount of Gas used transactions                                                                                                                                                                            |
| *results.data.max\_fee\_per\_gas*           | String        |                                    | Maximum (priority fee + base fee) limit                                                                                                                                                                          |
| *results.data.max\_priority\_fee\_per\_gas* | String        |                                    | Maximum priority fee limit                                                                                                                                                                                       |
| *results.data.input*                        | String        |                                    | ABI encoding of transaction data                                                                                                                                                                                 |
| *results.data.to\_block*                    | String        | O                                  | Lookup block(add simple only)                                                                                                                                                                                    |
| *results.data.from\_block*                  | String        | O                                  | Start block(add simple only)                                                                                                                                                                                     |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "23712",
        "data": [
            {
                "timestamp": "2022-12-28T00:08:23Z",
                "sender": "0xac4783dcf53c1fb67e152c300390d61ea8b3e1d3",
                "receiver": "0x0898a80d55e4de9d398193d0f6aa788b9790e8d3",
                "value": "0",
                "confirmations": "6070555",
                "transaction_hash": "0x56e18258a7fa25ca232402c708926bfb44a1cea4ead4d5803cadea0d8aaaa2b4",
                "block_hash": "0x886565489899cb867f054a1ed301c190687776a265824065c055f799e69a570f",
                "transaction_index": "0",
                "tx_status": "0",
                "block_number": "14133850",
                "gas_price": "110000000000",
                "cumulative_gas_used": "67884",
                "gas_used": "67884",
                "max_fee_per_gas": "110000000000",
                "max_priority_fee_per_gas": "110000000000"
            },
            ...
        ]
    }
}
```

#### **RESPONSE SAMPLE(Simple Transaction)**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "23712",
        "data": [
            {
                "sender": "0xac4783dcf53c1fb67e152c300390d61ea8b3e1d3",
                "receiver": "0x0898a80d55e4de9d398193d0f6aa788b9790e8d3",
                "transaction_hash": "0x56e18258a7fa25ca232402c708926bfb44a1cea4ead4d5803cadea0d8aaaa2b4",
                "tx_status": "1",
                "tx_fee": "7467240000000000",
                "block_number": "14133850",
                "gas_price": "110000000000",
                "gas_used": "67884"
            },
            ...
        ],
        "to_block": "20204526"
    }
}
```

### Get "Internal Transactions" by address

#### **URI**

<table><thead><tr><th width="124"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/internal-transactions</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/internal-transactions</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**                                           | **required** |
| --------------- | -------- | --------------------------------------------------- | ------------ |
| *address\_hash* | String   | <ul><li>Address(sender/receiver/contract)</li></ul> | true         |

* **QUERY STRING**

| **key**      | **type** | **value**                                                                           | **required**         |
| ------------ | -------- | ----------------------------------------------------------------------------------- | -------------------- |
| *limit*      | Integer  | Maximum number of record will retrieve           Default: 50, Max: 1000             | false                |
| *offset*     | Integer  | Start retrieve record            Default: 0                                         | false                |
| *startBlock* | String   | Start block                                                   Default: null         | <p>false</p><p> </p> |
| *endBlock*   | String   | End block                                                   Default: null           | <p>false</p><p> </p> |
| *input*      | Boolean  | Include input data                                                   Default: false | false                |

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/v1/accounts/0xBEd789c6008F788a28fc222C83082D67033Daf7F/internal-transactions?input=true
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                           | **type**      | **value**                                                                                                                                                                                     |
| --------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *status*                          | String        | Status of request                                                                                                                                                                             |
| *message*                         | String        | Response Message of request                                                                                                                                                                   |
| *results*                         | Json          | Results of request                                                                                                                                                                            |
| *results.count*                   | String        | Total count of data                                                                                                                                                                           |
| *results.data*                    | List\<Object> | List of data                                                                                                                                                                                  |
| *results.data.timestamp*          | String        | UTC time when the transaction occurred                                                                                                                                                        |
| *results.data.sender*             | String        | Address of sender                                                                                                                                                                             |
| *results.data.receiver*           | String        | Address of receiver                                                                                                                                                                           |
| *results.data.value*              | String        | Value of internal transaction                                                                                                                                                                 |
| *results.data.status*             | String        | Status of internal transaction                                                   - 0: Failed,                                                                               - 1: Success      |
| *results.data.message*            | String        | Message of internal transaction                                                                                                                                                               |
| *results.data.transaction\_hash*  | String        | Hash value of the transaction                                                                                                                                                                 |
| *results.data.block\_number*      | String        | Block height                                                                                                                                                                                  |
| *results.data.contract\_address*  | String        | Address of contract creation if this is create contract transaction                                                                                                                           |
| *results.data.trace\_address*     | List\<String> | Trace mapping information                                                                                                                                                                     |
| *results.data.trace\_type*        | String        | Type of trace: call, delegatecall, codecall, staticcall, selfdestruct                                                                                                                         |
| *results.data.sub\_traces*        | String        | Number of sub traces from this internal transaction                                                                                                                                           |
| *results.data.transaction\_index* | String        | Index of the transaction on the block                                                                                                                                                         |
| *results.data.gas\_used*          | String        | Total amount of Gas used transactions                                                                                                                                                         |
| *results.data.gas\_limit*         | String        | Limit of gas for executing the transaction                                                                                                                                                    |
| *results.data.external\_receiver* | String        | Whether external receive has occurred                                    - false: external transaction exists                                     - true: external transaction does not exist |
| results.data.input                | String        | Input parameters used when executing a transaction                                                                                                                                            |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "2047",
        "data": [
            {
                "timestamp": "2023-02-15T06:24:53Z",
                "sender": "0xbed789c6008f788a28fc222c83082d67033daf7f",
                "receiver": "0x53b690b826d611884d40f68252236d7c23d32d53",
                "value": "0",
                "status": "0",
                "message": null,
                "transaction_hash": "0x985512f6e0729d28ccdd568f6e9b7486b63aa0926cd4dbd9852b5899e9d27f7e",
                "block_number": "10207545",
                "contract_address": null,
                "trace_address": [
                    "0",
                    "1"
                ],
                "trace_type": "delegatecall",
                "sub_traces": null,
                "transaction_index": "0",
                "gas_used": "43323",
                "gas_limit": "81177",
                "external_receiver": false
                "input": "0xbac4f3380000000000000000000000007ad5ffaa39d3638fc775bb118d1092caa210fcbf"
        ]
    }
}
```

### Get a list of "ERC20 - Token Transfer Events" by address

#### **URI**

<table><thead><tr><th width="129"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/token-transfer/erc20</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/token-transfer/erc20</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**                                                                       | **required**        |
| --------------- | -------- | ------------------------------------------------------------------------------- | ------------------- |
| *address\_hash* | String   | <ul><li>Address(sender/receiver/contract)</li><li>Transaction Address</li></ul> | <p> </p><p>true</p> |

* **QUERY STRING**

| **key**      | **type** | **value**                                                                                                 | **required** |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*      | Integer  | Maximum number of record will retrieve               Default: 50, Max: 1000                               | false        |
| *offset*     | Integer  | Start retrieve record                                                                          Default: 0 | false        |
| *startBlock* | String   | Start Block                                                                        Default: null          | false        |
| *endBlock*   | String   | End Block                                                                        Default: null            | false        |

#### REQUEST SAMPLE

```
GET https://explorerapi.test.wemix.com/v1/accounts/0x43dc58449beb06bf350e0181703c617f0bfa78bf/token-transfer/erc20
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

<table data-header-hidden><thead><tr><th></th><th width="308"></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td></tr><tr><td><em>status</em></td><td>String</td><td>Status of request</td></tr><tr><td><em>message</em></td><td>String</td><td>Message of request</td></tr><tr><td><em>results</em></td><td>Json</td><td>Results of request</td></tr><tr><td><em>results.count</em></td><td>String</td><td>Total count of data</td></tr><tr><td><em>results.data</em></td><td>List&#x3C;Object></td><td>List of data</td></tr><tr><td><em>results.data.timestamp</em></td><td>String</td><td>UTC time when the transaction occurred</td></tr><tr><td><em>results.data.sender</em></td><td>String</td><td>Address of sender</td></tr><tr><td><em>results.data.receiver</em></td><td>String</td><td>Address of receiver</td></tr><tr><td><em>results.data.value</em></td><td>String</td><td>Transfer value</td></tr><tr><td><em>results.data.confirmations</em></td><td>String</td><td>Number of block's confirmation</td></tr><tr><td><em>results.data.block_number</em></td><td>String</td><td>Block number</td></tr><tr><td><em>results.data.transaction_hash</em></td><td>String</td><td>Hash of transaction</td></tr><tr><td><em>results.data.block_hash</em></td><td>String</td><td>Hash of block</td></tr><tr><td><em>results.data.token_address</em></td><td>String</td><td>Token creation if this is create token contract address</td></tr><tr><td><em>results.data.token_name</em></td><td>String</td><td>Name of token </td></tr><tr><td><em>results.data.token_symbol</em></td><td>String</td><td>Symbol of token</td></tr><tr><td><em>results.data.token_decimals</em></td><td>String</td><td>Decimals of token</td></tr><tr><td><em>results.data.transaction_index</em></td><td>String</td><td>Index of transaction</td></tr></tbody></table>

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "2",
        "data": [
            {
                "timestamp": "2023-01-19T12:35:54Z",
                "sender": "0x43dc58449beb06bf350e0181703c617f0bfa78bf",
                "receiver": "0x05ceb79bf4cd7a24bbe6066d9e54c643b9cb1108",
                "value": "0",
                "confirmations": "4126491",
                "block_number": "16079523",
                "transaction_hash": "0x626c86c34db077d68131094d9768abf3cd03be3267d1a967e4352835ab09f73e",
                "block_hash": "0x2795a79f72ddd47c729fefd36797713e4de3fc25b24e70357d59612abc5ac961",
                "token_address": "0x01199b488fa05df702eee426b14d1cfdbd7b746d",
                "token_name": null,
                "token_symbol": null,
                "token_decimals": null,
                "transaction_index": "0"
            },
            {
                "timestamp": "2023-01-18T14:40:32Z",
                "sender": "0xd9a370dd275181b47e39d6e88625d44f2eb1a466",
                "receiver": "0x43dc58449beb06bf350e0181703c617f0bfa78bf",
                "value": "0",
                "confirmations": "4205414",
                "block_number": "16000600",
                "transaction_hash": "0x5077a2519f8c8e6cf6bce16c6228068063b86fc54a771371d8d79a2d88267bde",
                "block_hash": "0x23fda9b7bc8aabe59ccfd56a67d7660a927a576e65866c0fb8bdeff0cbd24909",
                "token_address": "0x32637199e54e5b79990d84a0d2a161ec22ac1068",
                "token_name": null,
                "token_symbol": null,
                "token_decimals": null,
                "transaction_index": "0"
            }
        ]
    }
}
```

### Get a list of "ERC721 - Token Transfer Events" by address

#### **URI**

<table><thead><tr><th width="129"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/token-transfer/erc721</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/token-transfer/erc721</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**                                                                       | **required**        |
| --------------- | -------- | ------------------------------------------------------------------------------- | ------------------- |
| *address\_hash* | String   | <ul><li>Address(sender/receiver/contract)</li><li>Transaction Address</li></ul> | <p> </p><p>true</p> |

* **QUERY STRING**

| **key**      | **type** | **value**                                                                                                 | **required** |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*      | Integer  | Maximum number of record will retrieve               Default: 50, Max: 1000                               | false        |
| *offset*     | Integer  | Start retrieve record                                                                          Default: 0 | false        |
| *startBlock* | String   | Start Block                                                                        Default: null          | false        |
| *endBlock*   | String   | End Block                                                                        Default: null            | false        |

#### REQUEST SAMPLE

```
GET https://explorerapi.test.wemix.com/v1/accounts/0x43dc58449beb06bf350e0181703c617f0bfa78bf/token-transfer/erc721
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

<table data-header-hidden><thead><tr><th></th><th width="308"></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td></tr><tr><td><em>status</em></td><td>String</td><td>Status of request</td></tr><tr><td><em>message</em></td><td>String</td><td>Message of request</td></tr><tr><td><em>results</em></td><td>Json</td><td>Results of request</td></tr><tr><td><em>results.count</em></td><td>String</td><td>Total count of data</td></tr><tr><td><em>results.data</em></td><td>List&#x3C;Object></td><td>List of data</td></tr><tr><td><em>results.data.timestamp</em></td><td>String</td><td>UTC time when the transaction occurred</td></tr><tr><td><em>results.data.sender</em></td><td>String</td><td>Address of sender</td></tr><tr><td><em>results.data.receiver</em></td><td>String</td><td>Address of receiver</td></tr><tr><td><em>results.data.confirmations</em></td><td>String</td><td>Number of block's confirmation</td></tr><tr><td><em>results.data.block_number</em></td><td>String</td><td>Block number</td></tr><tr><td><em>results.data.transaction_hash</em></td><td>String</td><td>Hash of transaction</td></tr><tr><td><em>results.data.block_hash</em></td><td>String</td><td>Hash of block</td></tr><tr><td><em>results.data.token_address</em></td><td>String</td><td>Token creation if this is create token contract address</td></tr><tr><td><em>results.data.token_name</em></td><td>String</td><td>Name of token </td></tr><tr><td><em>results.data.token_symbol</em></td><td>String</td><td>Symbol of token</td></tr><tr><td><em>results.data.token_decimals</em></td><td>String</td><td>Decimals of token</td></tr><tr><td><em>results.data.transaction_index</em></td><td>String</td><td>Index of transaction</td></tr></tbody></table>

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "3",
        "data": [
            {
                "timestamp": "2023-01-12T05:40:28Z",
                "sender": "0x0000000000000000000000000000000000000000",
                "receiver": "0x43dc58449beb06bf350e0181703c617f0bfa78bf",
                "confirmations": "18158317",
                "block_number": "15449790",
                "transaction_hash": "0x288e7082ed9eb284391566d6212e224d1a345d2a2a7471329959714334cca67a",
                "block_hash": "0xebc8a7e50a4ac1d631e1a1bf8ec73944b87086be04c8e787274c469638a9a66c",
                "token_address": "0xd05f171995fa2ce44f2bc765e120fed1430a538f",
                "token_name": "MyNFT",
                "token_symbol": "NFT",
                "token_decimals": null,
                "transaction_index": "0"
            },
            {
                "timestamp": "2023-01-12T03:38:33Z",
                "sender": "0x0000000000000000000000000000000000000000",
                "receiver": "0x43dc58449beb06bf350e0181703c617f0bfa78bf",
                "confirmations": "18165632",
                "block_number": "15442475",
                "transaction_hash": "0x3249ccb59cb5986941b4a84503ab29ae45995cc43278163ac5f6ea1301eca07f",
                "block_hash": "0x4dfbc1eefee42cc5541543ecbfe40e9bc88ab17c3d839eefc62fff0bb8b85f1b",
                "token_address": "0x3665731c515974eee182618c48bbdec847063627",
                "token_name": "MyNFT",
                "token_symbol": "NFT",
                "token_decimals": null,
                "transaction_index": "0"
            },
            {
                "timestamp": "2023-01-12T03:16:14Z",
                "sender": "0x0000000000000000000000000000000000000000",
                "receiver": "0x43dc58449beb06bf350e0181703c617f0bfa78bf",
                "confirmations": "18166971",
                "block_number": "15441136",
                "transaction_hash": "0x3f1585e992b5ba4bc4f60419faa25bbc3e2ea839e0b8484d17a87b32765f5a9b",
                "block_hash": "0x0ecb317f27d0f14022215ebf75f763398aac6ef538182383f2389183e5a6344a",
                "token_address": "0x3665731c515974eee182618c48bbdec847063627",
                "token_name": "MyNFT",
                "token_symbol": "NFT",
                "token_decimals": null,
                "transaction_index": "0"
            }
        ]
    }
}
```

### Get ERC20/ERC721 Token List for a single address

#### URI

<table data-header-hidden><thead><tr><th width="126"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/tokens</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/tokens</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**               | **required** |
| --------------- | -------- | ----------------------- | ------------ |
| *address\_hash* | String   | address of token holder | true         |

* **QUERY STRING**

| **key**  | **type** | **value**                                                                                                 | **required** |
| -------- | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*  | Number   | Maximum number of record will retrieve               Default: 50                                          | false        |
| *offset* | Number   | Start retrieve record                                                                          Default: 0 | false        |

#### **REQUEST SAMPLE**

```
GET https://explorerapi.test.wemix.com/v1/accounts/0xB20d32637296190A4A492dddB4Af2b0f03Df24F1/tokens
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                            | **type**      | **value**              |
| ---------------------------------- | ------------- | ---------------------- |
| *erc\_20*                          | List\<Object> | List of ERC-20         |
| *erc\_20.count*                    | String        | Count of ERC-20 Lists  |
| *erc\_20.results*                  | Json          | Results of request     |
| *erc\_20.results.balance*          | String        | Balance                |
| *erc\_20.results.token\_address*   | String        | Address of token       |
| *erc\_20.results.holder\_address*  | String        | Address of holder      |
| *erc\_20.results.holder\_type*     | String        | Type of token          |
| *erc\_20.results.token\_decimals*  | String        | Decimal of token       |
| *erc\_721*                         | List\<Object> | List of ERC-721        |
| *erc\_721.count*                   | String        | Count of ERC-721 Lists |
| *erc\_721.results*                 | Json          | Results of request     |
| *erc\_721.results.balance*         | String        | Balance                |
| *erc\_721.results.token\_address*  | String        | Address of token       |
| *erc\_721.results.holder\_address* | String        | Address of holder      |

#### **RESPONSE SAMPLE**

```
{
    "erc_20": {
        "count": "1",
        "results": [
            {
                "balance": "4098808369498578418",
                "token_address": "0x4af286b2bf66ae46da121ffeb46c2a3bbe05dd97",
                "token_symbol": "TIPO",
                "token_name": "TIPOToken",
                "holder_address": "0xb20d32637296190a4a492dddb4af2b0f03df24f1",
                "holder_type": "0",
                "token_decimals": "18"
            }
        ]
    },
    "erc_721": {
        "count": "1",
        "results": [
            {
                "balance": "1",
                "token_address": "0x62E1Ad2A3A9AB55bA20Bc4EB27Fca655C41fDD88",
                "holder_address": "0xb20d32637296190a4a492dddb4af2b0f03df24f1"
            }
        ]
    }
}
```

### Get ERC20 Token List for a single address

#### URI

<table data-header-hidden><thead><tr><th width="126"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/tokens/erc20</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/tokens/erc20</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**               | **required** |
| --------------- | -------- | ----------------------- | ------------ |
| *address\_hash* | String   | address of token holder | true         |

* **QUERY STRING**

| **key**  | **type** | **value**                                                                                                 | **required** |
| -------- | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*  | Number   | Maximum number of record will retrieve               Default: 50                                          | false        |
| *offset* | Number   | Start retrieve record                                                                          Default: 0 | false        |

#### **REQUEST SAMPLE**

```
https://explorerapi.test.wemix.com/v1/accounts/0x52d68c69b088dbc87e5e4f48e6f4df31f018685e/tokens/erc20
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                       | **type** | **value**                  |
| ----------------------------- | -------- | -------------------------- |
| *status*                      | String   | Status of request          |
| *messag*e                     | String   | Message of request         |
| *results*                     | Json     | Results of request         |
| *results.count*               | String   | Total count of ERC-20 List |
| *results.data.token\_address* | String   | Address of token           |
| *results.data.token\_name*    | String   | Name of token              |
| *results.data.token\_symbol*  | String   | Symbol of token            |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "68",
        "data": [
            {
                "token_address": "0x3ebda066925bbc790fe198f47ef650ddb764ecfe",
                "token_name": "cWEMIX",
                "token_symbol": "cWEMIX"
            },
            ...
        ]
    }
}
```

### Get ERC721 Token List for a single address

#### URI

<table data-header-hidden><thead><tr><th width="126"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/tokens/erc721</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/tokens/erc721</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**               | **required** |
| --------------- | -------- | ----------------------- | ------------ |
| *address\_hash* | String   | address of token holder | true         |

* **QUERY STRING**

| **key**  | **type** | **value**                                                                                                 | **required** |
| -------- | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*  | Number   | Maximum number of record will retrieve               Default: 50                                          | false        |
| *offset* | Number   | Start retrieve record                                                                          Default: 0 | false        |

#### **REQUEST SAMPLE**

```
GET https://explorerapi.test.wemix.com/v1/accounts/0xB20d32637296190A4A492dddB4Af2b0f03Df24F1/tokens/erc721
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                       | **type** | **value**                   |
| ----------------------------- | -------- | --------------------------- |
| *status*                      | String   | Status of request           |
| *message*                     | String   | Message of request          |
| *results*                     | Json     | Results of request          |
| *results.count*               | String   | Total count of ERC-721 List |
| *results.data.token\_address* | String   | Address of token            |
| *results.data.token\_name*    | String   | Name of token               |
| *results.data.token\_symbol*  | String   | Symbol of token             |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "1",
        "data": [
            {
                "token_address": "0x62e1ad2a3a9ab55ba20bc4eb27fca655c41fdd88",
                "token_name": "Tangled",
                "token_symbol": "TTPS"
            }
        ]
    }
}
```

### Get ERC721 Token Inventory of a specific ERC721 contract

#### URI

<table data-header-hidden><thead><tr><th width="126"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/tokens/inventory/{token_address}</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/tokens/inventory/{token_address}</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

| **key**             | **type** | **value**                                 | **required** |
| ------------------- | -------- | ----------------------------------------- | ------------ |
| *contract\_address* | String   | Contract address requiring inventory list | true         |
| *token\_address*    | String   | Specific token address                    | false        |

* **QUERY STRING**

| **key**  | **type** | **value**                                                                                                 | **required** |
| -------- | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*  | Number   | Maximum number of record will retrieve               Default: 50                                          | false        |
| *offset* | Number   | Start retrieve record                                                                          Default: 0 | false        |

#### **REQUEST SAMPLE**

```
GET https://explorerapi.test.wemix.com/v1/accounts/0xe3929888ddd76cefa78ac586a7749c7f5a86a143/tokens/inventory
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                        | **type**      | **value**              |
| ------------------------------ | ------------- | ---------------------- |
| *status*                       | String        | Status of request      |
| *message*                      | String        | Message of request     |
| *results*                      | Json          | Results of request     |
| *results.count*                | String        | Count of inventory     |
| *results.data*                 | List\<Object> | List of data           |
| results.data.contract\_address | String        | token contract address |
| *results.data.token\_id*       | String        | Id of token            |
| *results.data.token\_uri*      | String        | uri of token           |
| results.data.token\_name       | String        | token name             |
| results.data.token\_symbol     | String        | token symbol           |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "264",
        "data": [
            {
                "contract_address": "0x5f240d896ef64a6a13ec6cd8e530f465943ae354",
                "token_id": "39",
                "token_uri": "https://nile.blob.core.windows.net/metadata/LUS/39.json",
                "token_name": "Sample",
                "token_symbol": "SAMPLE"
            }
            ...
        ]
    }
}
```

### Get list of Blocks Mined by address

#### **URI**

<table data-header-hidden><thead><tr><th width="129"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/accounts/{address_hash}/mined-blocks</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/accounts/{address_hash}/mined-blocks</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api key   | true         |

* **PARH VARIABLE**

| **key**         | **type** | **value**        | **required** |
| --------------- | -------- | ---------------- | ------------ |
| *address\_hash* | String   | Address of miner | true         |

* **QUERY STRING**

| **key**  | **type** | **value**                                                                                                 | **required** |
| -------- | -------- | --------------------------------------------------------------------------------------------------------- | ------------ |
| *limit*  | Number   | Maximum number of record will retrieve                                           Default: 50              | false        |
| *offset* | Number   | Start retrieve record                                                                          Default: 0 | false        |

#### REQUEST SAMPLE

```
GET https://explorerapi.test.wemix.com/v1/accounts/0xf04f49b134996023e980022502581c7278f3191a/mined-blocks
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                           | **type**      | **value**                                       |
| --------------------------------- | ------------- | ----------------------------------------------- |
| *status*                          | String        | Status of request                               |
| *message*                         | String        | Message of request                              |
| *results*                         | Json          | Results of request                              |
| *results.count*                   | String        | Total count of data                             |
| *results.data*                    | List\<Object> | List of data                                    |
| *results.data.timestamp*          | String        | UTC time when the transaction occurred          |
| *results.data.miner*              | String        | Address of miner                                |
| *results.data.reward*             | String        | Reward for miner when mining this block         |
| results.data.fees                 | String        | Fee used when block was created                 |
| *results.data.block\_number*      | String        | Block height                                    |
| *results.data.gas\_used*          | String        | Number of used gas                              |
| *results.data.gas\_limit*         | String        | Number of limit gas                             |
| *results.data.transaction\_count* | String        | Number of transactions in the block             |
| results.data.mining\_reward       | String        | Rewards specified when blocks are created (pmr) |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "1295039",
        "data": [
            {
                "timestamp": "2023-08-10T09:50:47Z",
                "miner": "0xf04f49b134996023e980022502581c7278f3191a",
                "reward": "1000000000000000000",
                "fees": "0",
                "block_number": "33609019",
                "gas_used": "0",
                "gas_limit": "105000000",
                "transaction_count": "0",
                "mining_reward": "1000000000000000000"
            },
            ...
        ]
    }
}
```


# Block APIs

### Get Block And Uncle Rewards by block number

#### URI

<table data-header-hidden><thead><tr><th width="147"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/blocks/{block_number}</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/blocks/{block_number}</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/v1/blocks/6029508
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
Content-Type: application/json
```

#### **RESPONSE PARAMETER**

<table data-header-hidden><thead><tr><th width="187"></th><th width="197"></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td></tr><tr><td><em>status</em></td><td>String</td><td>Status value of request</td></tr><tr><td><em>message</em></td><td>String</td><td>Message of request</td></tr><tr><td><em>results</em></td><td>Json</td><td>Result of request</td></tr><tr><td><em>results.data</em></td><td>List&#x3C;Object></td><td>List of data</td></tr><tr><td><em>results. data.timestamp</em></td><td>String</td><td>UTC time when the transaction occurred</td></tr><tr><td><em>results.data.miner</em></td><td>String</td><td>Address of block's miner</td></tr><tr><td><em>result.data.reward</em></td><td>String</td><td>Reward of block</td></tr><tr><td>results.data.fees</td><td>String</td><td>Fee used when block was created</td></tr><tr><td><em>results.data.block_number</em></td><td>Integer</td><td>Number of the block containing the transaction</td></tr><tr><td>results.data.mining_reward</td><td>String</td><td>Rewards specified when blocks are created (pmr)</td></tr></tbody></table>

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": {
            "timestamp": "2022-12-28T21:51:44Z",
            "miner": "0x6ec14966480e3baf4c62a1f4532c95c42b07b9c9",
            "reward": "1000000000000000000",
            "fees": "0",
            "block_number": "6029508",
            "mining_reward": "1000000000000000000"
        }
    }
}
```


# Contract APIs

### Get Contract ABI for Verified contract source code

#### URI

<table data-header-hidden><thead><tr><th width="132"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/contracts/{contract_address}/abi</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/contracts/{contract_address}/abi</td></tr></tbody></table>

#### REQUEST PARAMETER

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

<table data-header-hidden><thead><tr><th></th><th width="186"></th><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>required</strong></td><td><strong>value</strong></td></tr><tr><td><em>contract_address</em></td><td>String</td><td>Verified contract address</td><td>true</td><td></td></tr></tbody></table>

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/v1/contracts/0xB4EF146F31Bd7e680707658a9772D0cfD35c8df4/abi
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

<table data-header-hidden><thead><tr><th></th><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>value</strong></td></tr><tr><td><em>status</em></td><td>String</td><td>Status of request</td><td></td></tr><tr><td><em>message</em></td><td>String</td><td>Response Message of request</td><td></td></tr><tr><td><em>results</em></td><td>Object</td><td>Result of request</td><td></td></tr><tr><td><em>results.data</em></td><td>Json</td><td>Contract abi</td><td></td></tr><tr><td><em>results.data.name</em></td><td>String</td><td>Name of contract</td><td></td></tr><tr><td><em>results.data.type</em></td><td>String</td><td>Type of contract</td><td></td></tr><tr><td><em>results.data.inputs</em></td><td>String</td><td>Array of contract objects</td><td></td></tr><tr><td><em>results.data.inputs.name</em></td><td>String</td><td>Name of parameter</td><td></td></tr><tr><td><em>results.data.inputs.type</em></td><td>String</td><td>Type of parameter</td><td></td></tr><tr><td><em>results.data.inputs.internalType</em></td><td>String</td><td>Internal type of parameter</td><td></td></tr><tr><td><em>results.data.output</em></td><td>String</td><td>Array similar to inputs</td><td></td></tr><tr><td><em>results.data.stateMutability</em></td><td>String</td><td>Blockchain state value</td><td></td></tr></tbody></table>

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": [
            {
                "type": "constructor",
                "inputs": [
                    {
                        "name": "name",
                        "type": "string",
                        "internalType": "string"
                    },
                    {
                        "name": "symbol",
                        "type": "string",
                        "internalType": "string"
                    }
                ],
                "stateMutability": "nonpayable"
            },
            {
                "name": "Approval",
                "type": "event",
                "inputs": [
                    {
                        "name": "owner",
                        "type": "address",
                        "indexed": true,
                        "internalType": "address"
                    },
                    {
                        "name": "spender",
                        "type": "address",
                        "indexed": true,
                        "internalType": "address"
                    },
                    {
                        "name": "value",
                        "type": "uint256",
                        "indexed": false,
                        "internalType": "uint256"
                    }
                ],
                "anonymous": false
            },
            {
                "name": "Transfer",
                "type": "event",
                "inputs": [
                    {
                        "name": "from",
                        "type": "address",
                        "indexed": true,
                        "internalType": "address"
                    },
                    {
                        "name": "to",
                        "type": "address",
                        "indexed": true,
                        "internalType": "address"
                    },
                    {
                        "name": "value",
                        "type": "uint256",
                        "indexed": false,
                        "internalType": "uint256"
                    }
                ],
                "anonymous": false
            },
            {
                "name": "allowance",
                "type": "function",
                "inputs": [
                    {
                        "name": "owner",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "spender",
                        "type": "address",
                        "internalType": "address"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "stateMutability": "view"
            },
            {
                "name": "approve",
                "type": "function",
                "inputs": [
                    {
                        "name": "spender",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "amount",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "bool",
                        "internalType": "bool"
                    }
                ],
                "stateMutability": "nonpayable"
            },
            {
                "name": "balanceOf",
                "type": "function",
                "inputs": [
                    {
                        "name": "account",
                        "type": "address",
                        "internalType": "address"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "stateMutability": "view"
            },
            {
                "name": "burn",
                "type": "function",
                "inputs": [
                    {
                        "name": "account",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "amount",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "bool",
                        "internalType": "bool"
                    }
                ],
                "stateMutability": "nonpayable"
            },
            {
                "name": "decimals",
                "type": "function",
                "inputs": [],
                "outputs": [
                    {
                        "name": "",
                        "type": "uint8",
                        "internalType": "uint8"
                    }
                ],
                "stateMutability": "view"
            },
            {
                "name": "decreaseAllowance",
                "type": "function",
                "inputs": [
                    {
                        "name": "spender",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "subtractedValue",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "bool",
                        "internalType": "bool"
                    }
                ],
                "stateMutability": "nonpayable"
            },
            {
                "name": "increaseAllowance",
                "type": "function",
                "inputs": [
                    {
                        "name": "spender",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "addedValue",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "bool",
                        "internalType": "bool"
                    }
                ],
                "stateMutability": "nonpayable"
            },
            {
                "name": "name",
                "type": "function",
                "inputs": [],
                "outputs": [
                    {
                        "name": "",
                        "type": "string",
                        "internalType": "string"
                    }
                ],
                "stateMutability": "view"
            },
            {
                "name": "symbol",
                "type": "function",
                "inputs": [],
                "outputs": [
                    {
                        "name": "",
                        "type": "string",
                        "internalType": "string"
                    }
                ],
                "stateMutability": "view"
            },
            {
                "name": "totalSupply",
                "type": "function",
                "inputs": [],
                "outputs": [
                    {
                        "name": "",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "stateMutability": "view"
            },
            {
                "name": "transfer",
                "type": "function",
                "inputs": [
                    {
                        "name": "to",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "amount",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "bool",
                        "internalType": "bool"
                    }
                ],
                "stateMutability": "nonpayable"
            },
            {
                "name": "transferFrom",
                "type": "function",
                "inputs": [
                    {
                        "name": "from",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "to",
                        "type": "address",
                        "internalType": "address"
                    },
                    {
                        "name": "amount",
                        "type": "uint256",
                        "internalType": "uint256"
                    }
                ],
                "outputs": [
                    {
                        "name": "",
                        "type": "bool",
                        "internalType": "bool"
                    }
                ],
                "stateMutability": "nonpayable"
            }
        ]
    }
}
```

### Get contract source code for verified contract source code

#### URI

<table data-header-hidden><thead><tr><th width="124"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/contracts/{contract_address}/code</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/contracts/{contract_address}/code</td></tr></tbody></table>

#### REQUEST PARAMETER

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

<table data-header-hidden><thead><tr><th></th><th width="186"></th><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>required</strong></td><td><strong>value</strong></td></tr><tr><td><em>contract_address</em></td><td>String</td><td>Verified contract address</td><td>true</td><td></td></tr></tbody></table>

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/v1/contracts/0xB4EF146F31Bd7e680707658a9772D0cfD35c8df4/code
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

<table data-header-hidden><thead><tr><th></th><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>value</strong></td></tr><tr><td><em>status</em></td><td>String</td><td>Status of request</td><td></td></tr><tr><td><em>message</em></td><td>String</td><td>Response Message of request</td><td></td></tr><tr><td><em>results</em></td><td>Json</td><td>Results of request</td><td></td></tr><tr><td><em>results.data</em></td><td>List&#x3C;Object></td><td>List of data</td><td></td></tr><tr><td><em>results.data.address</em></td><td>String</td><td>Contract address</td><td></td></tr><tr><td><em>results.data.logo</em></td><td>String</td><td>Logo set during contract code verification</td><td></td></tr><tr><td><em>results.data.compiler</em></td><td>String</td><td>Solidity compiler version</td><td></td></tr><tr><td><em>results.data.libraries</em></td><td>String</td><td>Libraries List</td><td></td></tr><tr><td><em>results.data.verify_data</em></td><td>String</td><td>Contract code validation date</td><td></td></tr><tr><td><em>results.data.contract_name</em></td><td>String</td><td>Name of contract</td><td></td></tr><tr><td><em>results.data.runs_optimizer</em></td><td>String</td><td>Value of time which running optimizer</td><td></td></tr><tr><td><em>results.optimization_enabled</em></td><td>String</td><td>Identify if optimization is enable or not                                                                            - 1: enable                                                                                     - Other number: not</td><td></td></tr><tr><td><em>results.data.contract_code</em></td><td>String</td><td>Contract code deployed on the network</td><td></td></tr><tr><td><em>results.date.contract_abi</em></td><td>Json</td><td>Abi of contract</td><td></td></tr><tr><td><em>results.data.contract_source</em></td><td>String</td><td>Solidity contract code</td><td></td></tr><tr><td><em>constructor_arguments</em></td><td>String</td><td>Arguments of constructor</td><td></td></tr><tr><td><em>reuslts.data.swam_source</em></td><td>String</td><td>Address of swarm source</td><td></td></tr><tr><td><em>reuslts.data.verify_status</em></td><td>String</td><td>Contract code verify status</td><td></td></tr><tr><td><em>reuslts.data.verify_message</em></td><td>String</td><td>Message written during contract code verification</td><td></td></tr></tbody></table>

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": {
            "address": "0xB4EF146F31Bd7e680707658a9772D0cfD35c8df4",
            "logo": null,
            "compiler": "0.8.10+commit.fc410830",
            "libraries": "[]",
            "verify_date": "2023-03-09T05:53:24Z",
            "contract_name": "MyToken",
            "runs_optimizer": "200",
            "optimization_enabled": "0",
            "contract_code": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a08231146101a357806395d89b41146101d35780639dc29fac146101f1578063a457c2d714610221578063a9059cbb14610251578063dd62ed3e14610281576100b4565b806306fdde03146100b9578063095ea7b3146100d757806318160ddd1461010757806323b872dd14610125578063313ce567146101555780633950935114610173575b600080fd5b6100c16102b1565b6040516100ce9190610d59565b60405180910390f35b6100f160048036038101906100ec9190610e14565b610343565b6040516100fe9190610e6f565b60405180910390f35b61010f610366565b60405161011c9190610e99565b60405180910390f35b61013f600480360381019061013a9190610eb4565b610370565b60405161014c9190610e6f565b60405180910390f35b61015d61039f565b60405161016a9190610f23565b60405180910390f35b61018d60048036038101906101889190610e14565b6103a8565b60405161019a9190610e6f565b60405180910390f35b6101bd60048036038101906101b89190610f3e565b6103df565b6040516101ca9190610e99565b60405180910390f35b6101db610427565b6040516101e89190610d59565b60405180910390f35b61020b60048036038101906102069190610e14565b6104b9565b6040516102189190610e6f565b60405180910390f35b61023b60048036038101906102369190610e14565b6104f0565b6040516102489190610e6f565b60405180910390f35b61026b60048036038101906102669190610e14565b610567565b6040516102789190610e6f565b60405180910390f35b61029b60048036038101906102969190610f6b565b61058a565b6040516102a89190610e99565b60405180910390f35b6060600380546102c090610fda565b80601f01602080910402602001604051908101604052809291908181526020018280546102ec90610fda565b80156103395780601f1061030e57610100808354040283529160200191610339565b820191906000526020600020905b81548152906001019060200180831161031c57829003601f168201915b5050505050905090565b60008061034e610611565b905061035b818585610619565b600191505092915050565b6000600254905090565b60008061037b610611565b90506103888582856107e4565b610393858585610870565b60019150509392505050565b60006012905090565b6000806103b3610611565b90506103d48185856103c5858961058a565b6103cf919061103b565b610619565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461043690610fda565b80601f016020809104026020016040519081016040528092919081815260200182805461046290610fda565b80156104af5780601f10610484576101008083540402835291602001916104af565b820191906000526020600020905b81548152906001019060200180831161049257829003601f168201915b5050505050905090565b60006104e6836104c761039f565b60ff16600a6104d691906111c4565b846104e1919061120f565b610ae8565b6001905092915050565b6000806104fb610611565b90506000610509828661058a565b90508381101561054e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610545906112db565b60405180910390fd5b61055b8286868403610619565b60019250505092915050565b600080610572610611565b905061057f818585610870565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610689576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106809061136d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156106f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f0906113ff565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107d79190610e99565b60405180910390a3505050565b60006107f0848461058a565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461086a578181101561085c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108539061146b565b60405180910390fd5b6108698484848403610619565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156108e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d7906114fd565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610950576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109479061158f565b60405180910390fd5b61095b838383610cb6565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156109e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d890611621565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610acf9190610e99565b60405180910390a3610ae2848484610cbb565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4f906116b3565b60405180910390fd5b610b6482600083610cb6565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610bea576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610be190611745565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610c9d9190610e99565b60405180910390a3610cb183600084610cbb565b505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610cfa578082015181840152602081019050610cdf565b83811115610d09576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d2b82610cc0565b610d358185610ccb565b9350610d45818560208601610cdc565b610d4e81610d0f565b840191505092915050565b60006020820190508181036000830152610d738184610d20565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610dab82610d80565b9050919050565b610dbb81610da0565b8114610dc657600080fd5b50565b600081359050610dd881610db2565b92915050565b6000819050919050565b610df181610dde565b8114610dfc57600080fd5b50565b600081359050610e0e81610de8565b92915050565b60008060408385031215610e2b57610e2a610d7b565b5b6000610e3985828601610dc9565b9250506020610e4a85828601610dff565b9150509250929050565b60008115159050919050565b610e6981610e54565b82525050565b6000602082019050610e846000830184610e60565b92915050565b610e9381610dde565b82525050565b6000602082019050610eae6000830184610e8a565b92915050565b600080600060608486031215610ecd57610ecc610d7b565b5b6000610edb86828701610dc9565b9350506020610eec86828701610dc9565b9250506040610efd86828701610dff565b9150509250925092565b600060ff82169050919050565b610f1d81610f07565b82525050565b6000602082019050610f386000830184610f14565b92915050565b600060208284031215610f5457610f53610d7b565b5b6000610f6284828501610dc9565b91505092915050565b60008060408385031215610f8257610f81610d7b565b5b6000610f9085828601610dc9565b9250506020610fa185828601610dc9565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610ff257607f821691505b6020821081141561100657611005610fab565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061104682610dde565b915061105183610dde565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156110865761108561100c565b5b828201905092915050565b60008160011c9050919050565b6000808291508390505b60018511156110e8578086048111156110c4576110c361100c565b5b60018516156110d35780820291505b80810290506110e185611091565b94506110a8565b94509492505050565b60008261110157600190506111bd565b8161110f57600090506111bd565b8160018114611125576002811461112f5761115e565b60019150506111bd565b60ff8411156111415761114061100c565b5b8360020a9150848211156111585761115761100c565b5b506111bd565b5060208310610133831016604e8410600b84101617156111935782820a90508381111561118e5761118d61100c565b5b6111bd565b6111a0848484600161109e565b925090508184048111156111b7576111b661100c565b5b81810290505b9392505050565b60006111cf82610dde565b91506111da83610dde565b92506112077fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846110f1565b905092915050565b600061121a82610dde565b915061122583610dde565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561125e5761125d61100c565b5b828202905092915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b60006112c5602583610ccb565b91506112d082611269565b604082019050919050565b600060208201905081810360008301526112f4816112b8565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611357602483610ccb565b9150611362826112fb565b604082019050919050565b600060208201905081810360008301526113868161134a565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006113e9602283610ccb565b91506113f48261138d565b604082019050919050565b60006020820190508181036000830152611418816113dc565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b6000611455601d83610ccb565b91506114608261141f565b602082019050919050565b6000602082019050818103600083015261148481611448565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006114e7602583610ccb565b91506114f28261148b565b604082019050919050565b60006020820190508181036000830152611516816114da565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611579602383610ccb565b91506115848261151d565b604082019050919050565b600060208201905081810360008301526115a88161156c565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b600061160b602683610ccb565b9150611616826115af565b604082019050919050565b6000602082019050818103600083015261163a816115fe565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b600061169d602183610ccb565b91506116a882611641565b604082019050919050565b600060208201905081810360008301526116cc81611690565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b600061172f602283610ccb565b915061173a826116d3565b604082019050919050565b6000602082019050818103600083015261175e81611722565b905091905056fea26469706673582212201f76b864b2f0d48c0d35357589878ed34030d7adc560092a0758c8fe7263e26664736f6c634300080a0033",
            "contract_abi": [
                {
                    "type": "constructor",
                    "inputs": [
                        {
                            "name": "name",
                            "type": "string",
                            "internalType": "string"
                        },
                        {
                            "name": "symbol",
                            "type": "string",
                            "internalType": "string"
                        }
                    ],
                    "stateMutability": "nonpayable"
                },
                {
                    "name": "Approval",
                    "type": "event",
                    "inputs": [
                        {
                            "name": "owner",
                            "type": "address",
                            "indexed": true,
                            "internalType": "address"
                        },
                        {
                            "name": "spender",
                            "type": "address",
                            "indexed": true,
                            "internalType": "address"
                        },
                        {
                            "name": "value",
                            "type": "uint256",
                            "indexed": false,
                            "internalType": "uint256"
                        }
                    ],
                    "anonymous": false
                },
                {
                    "name": "Transfer",
                    "type": "event",
                    "inputs": [
                        {
                            "name": "from",
                            "type": "address",
                            "indexed": true,
                            "internalType": "address"
                        },
                        {
                            "name": "to",
                            "type": "address",
                            "indexed": true,
                            "internalType": "address"
                        },
                        {
                            "name": "value",
                            "type": "uint256",
                            "indexed": false,
                            "internalType": "uint256"
                        }
                    ],
                    "anonymous": false
                },
                {
                    "name": "allowance",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "owner",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "spender",
                            "type": "address",
                            "internalType": "address"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "name": "approve",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "spender",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "amount",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "bool",
                            "internalType": "bool"
                        }
                    ],
                    "stateMutability": "nonpayable"
                },
                {
                    "name": "balanceOf",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "account",
                            "type": "address",
                            "internalType": "address"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "name": "burn",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "account",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "amount",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "bool",
                            "internalType": "bool"
                        }
                    ],
                    "stateMutability": "nonpayable"
                },
                {
                    "name": "decimals",
                    "type": "function",
                    "inputs": [],
                    "outputs": [
                        {
                            "name": "",
                            "type": "uint8",
                            "internalType": "uint8"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "name": "decreaseAllowance",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "spender",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "subtractedValue",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "bool",
                            "internalType": "bool"
                        }
                    ],
                    "stateMutability": "nonpayable"
                },
                {
                    "name": "increaseAllowance",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "spender",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "addedValue",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "bool",
                            "internalType": "bool"
                        }
                    ],
                    "stateMutability": "nonpayable"
                },
                {
                    "name": "name",
                    "type": "function",
                    "inputs": [],
                    "outputs": [
                        {
                            "name": "",
                            "type": "string",
                            "internalType": "string"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "name": "symbol",
                    "type": "function",
                    "inputs": [],
                    "outputs": [
                        {
                            "name": "",
                            "type": "string",
                            "internalType": "string"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "name": "totalSupply",
                    "type": "function",
                    "inputs": [],
                    "outputs": [
                        {
                            "name": "",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "stateMutability": "view"
                },
                {
                    "name": "transfer",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "to",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "amount",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "bool",
                            "internalType": "bool"
                        }
                    ],
                    "stateMutability": "nonpayable"
                },
                {
                    "name": "transferFrom",
                    "type": "function",
                    "inputs": [
                        {
                            "name": "from",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "to",
                            "type": "address",
                            "internalType": "address"
                        },
                        {
                            "name": "amount",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ],
                    "outputs": [
                        {
                            "name": "",
                            "type": "bool",
                            "internalType": "bool"
                        }
                    ],
                    "stateMutability": "nonpayable"
                }
            ],
            "contract_source": "\n// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Context.sol\n\n\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n\n// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol\n\n\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\n}\n\n// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/IERC20Metadata.sol\n\n\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() external view returns (string memory);\n\n    /**\n     * @dev Returns the symbol of the token.\n     */\n    function symbol() external view returns (string memory);\n\n    /**\n     * @dev Returns the decimals places of the token.\n     */\n    function decimals() external view returns (uint8);\n}\n\n// File: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol\n\n\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\n\n\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * The default value of {decimals} is 18. To change this, you should override\n * this function so it returns a different value.\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n    mapping(address => uint256) private _balances;\n\n    mapping(address => mapping(address => uint256)) private _allowances;\n\n    uint256 private _totalSupply;\n\n    string private _name;\n    string private _symbol;\n\n    /**\n     * @dev Sets the values for {name} and {symbol}.\n     *\n     * All two of these values are immutable: they can only be set once during\n     * construction.\n     */\n    constructor(string memory name_, string memory symbol_) {\n        _name = name_;\n        _symbol = symbol_;\n    }\n\n    /**\n     * @dev Returns the name of the token.\n     */\n    function name() public view virtual override returns (string memory) {\n        return _name;\n    }\n\n    /**\n     * @dev Returns the symbol of the token, usually a shorter version of the\n     * name.\n     */\n    function symbol() public view virtual override returns (string memory) {\n        return _symbol;\n    }\n\n    /**\n     * @dev Returns the number of decimals used to get its user representation.\n     * For example, if `decimals` equals `2`, a balance of `505` tokens should\n     * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n     *\n     * Tokens usually opt for a value of 18, imitating the relationship between\n     * Ether and Wei. This is the default value returned by this function, unless\n     * it's overridden.\n     *\n     * NOTE: This information is only used for _display_ purposes: it in\n     * no way affects any of the arithmetic of the contract, including\n     * {IERC20-balanceOf} and {IERC20-transfer}.\n     */\n    function decimals() public view virtual override returns (uint8) {\n        return 18;\n    }\n\n    /**\n     * @dev See {IERC20-totalSupply}.\n     */\n    function totalSupply() public view virtual override returns (uint256) {\n        return _totalSupply;\n    }\n\n    /**\n     * @dev See {IERC20-balanceOf}.\n     */\n    function balanceOf(address account) public view virtual override returns (uint256) {\n        return _balances[account];\n    }\n\n    /**\n     * @dev See {IERC20-transfer}.\n     *\n     * Requirements:\n     *\n     * - `to` cannot be the zero address.\n     * - the caller must have a balance of at least `amount`.\n     */\n    function transfer(address to, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _transfer(owner, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-allowance}.\n     */\n    function allowance(address owner, address spender) public view virtual override returns (uint256) {\n        return _allowances[owner][spender];\n    }\n\n    /**\n     * @dev See {IERC20-approve}.\n     *\n     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n     * `transferFrom`. This is semantically equivalent to an infinite approval.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function approve(address spender, uint256 amount) public virtual override returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, amount);\n        return true;\n    }\n\n    /**\n     * @dev See {IERC20-transferFrom}.\n     *\n     * Emits an {Approval} event indicating the updated allowance. This is not\n     * required by the EIP. See the note at the beginning of {ERC20}.\n     *\n     * NOTE: Does not update the allowance if the current allowance\n     * is the maximum `uint256`.\n     *\n     * Requirements:\n     *\n     * - `from` and `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     * - the caller must have allowance for ``from``'s tokens of at least\n     * `amount`.\n     */\n    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {\n        address spender = _msgSender();\n        _spendAllowance(from, spender, amount);\n        _transfer(from, to, amount);\n        return true;\n    }\n\n    /**\n     * @dev Atomically increases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     */\n    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        _approve(owner, spender, allowance(owner, spender) + addedValue);\n        return true;\n    }\n\n    /**\n     * @dev Atomically decreases the allowance granted to `spender` by the caller.\n     *\n     * This is an alternative to {approve} that can be used as a mitigation for\n     * problems described in {IERC20-approve}.\n     *\n     * Emits an {Approval} event indicating the updated allowance.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `spender` must have allowance for the caller of at least\n     * `subtractedValue`.\n     */\n    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n        address owner = _msgSender();\n        uint256 currentAllowance = allowance(owner, spender);\n        require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n        unchecked {\n            _approve(owner, spender, currentAllowance - subtractedValue);\n        }\n\n        return true;\n    }\n\n    /**\n     * @dev Moves `amount` of tokens from `from` to `to`.\n     *\n     * This internal function is equivalent to {transfer}, and can be used to\n     * e.g. implement automatic token fees, slashing mechanisms, etc.\n     *\n     * Emits a {Transfer} event.\n     *\n     * Requirements:\n     *\n     * - `from` cannot be the zero address.\n     * - `to` cannot be the zero address.\n     * - `from` must have a balance of at least `amount`.\n     */\n    function _transfer(address from, address to, uint256 amount) internal virtual {\n        require(from != address(0), \"ERC20: transfer from the zero address\");\n        require(to != address(0), \"ERC20: transfer to the zero address\");\n\n        _beforeTokenTransfer(from, to, amount);\n\n        uint256 fromBalance = _balances[from];\n        require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n        unchecked {\n            _balances[from] = fromBalance - amount;\n            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by\n            // decrementing then incrementing.\n            _balances[to] += amount;\n        }\n\n        emit Transfer(from, to, amount);\n\n        _afterTokenTransfer(from, to, amount);\n    }\n\n    /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n     * the total supply.\n     *\n     * Emits a {Transfer} event with `from` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     */\n    function _mint(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: mint to the zero address\");\n\n        _beforeTokenTransfer(address(0), account, amount);\n\n        _totalSupply += amount;\n        unchecked {\n            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.\n            _balances[account] += amount;\n        }\n        emit Transfer(address(0), account, amount);\n\n        _afterTokenTransfer(address(0), account, amount);\n    }\n\n    /**\n     * @dev Destroys `amount` tokens from `account`, reducing the\n     * total supply.\n     *\n     * Emits a {Transfer} event with `to` set to the zero address.\n     *\n     * Requirements:\n     *\n     * - `account` cannot be the zero address.\n     * - `account` must have at least `amount` tokens.\n     */\n    function _burn(address account, uint256 amount) internal virtual {\n        require(account != address(0), \"ERC20: burn from the zero address\");\n\n        _beforeTokenTransfer(account, address(0), amount);\n\n        uint256 accountBalance = _balances[account];\n        require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n        unchecked {\n            _balances[account] = accountBalance - amount;\n            // Overflow not possible: amount <= accountBalance <= totalSupply.\n            _totalSupply -= amount;\n        }\n\n        emit Transfer(account, address(0), amount);\n\n        _afterTokenTransfer(account, address(0), amount);\n    }\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n     *\n     * This internal function is equivalent to `approve`, and can be used to\n     * e.g. set automatic allowances for certain subsystems, etc.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `owner` cannot be the zero address.\n     * - `spender` cannot be the zero address.\n     */\n    function _approve(address owner, address spender, uint256 amount) internal virtual {\n        require(owner != address(0), \"ERC20: approve from the zero address\");\n        require(spender != address(0), \"ERC20: approve to the zero address\");\n\n        _allowances[owner][spender] = amount;\n        emit Approval(owner, spender, amount);\n    }\n\n    /**\n     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n     *\n     * Does not update the allowance amount in case of infinite allowance.\n     * Revert if not enough allowance is available.\n     *\n     * Might emit an {Approval} event.\n     */\n    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {\n        uint256 currentAllowance = allowance(owner, spender);\n        if (currentAllowance != type(uint256).max) {\n            require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n            unchecked {\n                _approve(owner, spender, currentAllowance - amount);\n            }\n        }\n    }\n\n    /**\n     * @dev Hook that is called before any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * will be transferred to `to`.\n     * - when `from` is zero, `amount` tokens will be minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n\n    /**\n     * @dev Hook that is called after any transfer of tokens. This includes\n     * minting and burning.\n     *\n     * Calling conditions:\n     *\n     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n     * has been transferred to `to`.\n     * - when `from` is zero, `amount` tokens have been minted for `to`.\n     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n     * - `from` and `to` are never both zero.\n     *\n     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n     */\n    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}\n}\n\n// File: contracts/TToken.sol\n\n\npragma solidity ^0.8.10;\n\n\ncontract MyToken is ERC20 {\n    constructor(string memory name, string memory symbol) ERC20(name, symbol) {\n        // Mint 100 tokens to msg.sender\n        // Similar to how\n        // 1 dollar = 100 cents\n        // 1 token = 1 * (10 ** decimals)\n        _mint(msg.sender, 99999999 * 10**uint(decimals()));\n    }\n    function burn(address account, uint256 amount) public virtual returns (bool) {\n        \n        _burn(account, amount * 10**uint(decimals()));\n\n        return true;\n    }\n}",
            "constructor_arguments": "",
            "swam_source": "bzz-raw://12201f76b864b2f0d48c0d35357589878ed34030d7adc560092a0758c8fe7263e266",
            "verify_status": "1",
            "verify_message": null
        }
    }
}
```

### Verify contract source code

#### URI

<table data-header-hidden><thead><tr><th width="121"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>POST https://explorerapi.wemix.com/v1/contracts/{contract_address}/verify</td></tr><tr><td><em>Testnet</em></td><td>POST https://explorerapi.test.wemix.com/v1/contracts/{contract_address}/verify</td></tr></tbody></table>

#### REQUEST PARAMETER

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **BODY(application/json)**

<table data-header-hidden><thead><tr><th></th><th></th><th></th><th data-hidden></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>value</strong></td><td><strong>required</strong></td></tr><tr><td><em>contract_name</em></td><td>String</td><td>Name of contract</td><td>Name of contract</td><td></td></tr><tr><td><em>compiler</em></td><td>String</td><td>Solidity compiler version</td><td>Version of compiler</td><td></td></tr><tr><td><em>runs_optimizer</em></td><td>Integer</td><td>Value of time which running optimizer</td><td>Value of time which running optimizer</td><td></td></tr><tr><td><em>optimization_enabled</em></td><td>Integer</td><td>Identify if optimization is enable or not                                                                            - 1: enable                                                                                     - Other number: not</td><td>Identify if optimization is enable or not                                                                            1: enable                                                                                    Other number: not</td><td></td></tr><tr><td><em>contract_source</em></td><td>String</td><td>Solidity contract code(base64 encoding)</td><td>BASE64 encoded of source code of the contract</td><td></td></tr><tr><td><em>constructor_arguments</em></td><td>String</td><td>Arguments of constructor</td><td>Input arguments of the contract's constructor</td><td></td></tr><tr><td><em>libraries</em></td><td>List&#x3C;Object></td><td>Library list used for the contract</td><td>Name of library</td><td></td></tr></tbody></table>

#### REQUEST SAMPLE

```
POST https://explorerapi.wemix.com/v1/contracts/{contract_address}/verify
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
Content-Type: application/json

{
  "contract_name": "MyToken",
  "compiler": "0.8.10",
  "runs_optimizer": 200,
  "optimization_enabled": 0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ICAgICAgICAvLyBTaW1pbGFyIHRvIGhvdw0KICAgICAgICAvLyAxIGRvbGxhciA9IDEwMCBjZW50cw0KICAgICAgICAvLyAxIHRva2VuID0gMSAqICgxMCAqKiBkZWNpbWFscykNCiAgICAgICAgX21pbnQobXNnLnNlbmRlciwgOTk5OTk5OTkgKiAxMCoqdWludChkZWNpbWFscygpKSk7DQogICAgfQ0KICAgIGZ1bmN0aW9uIGJ1cm4oYWRkcmVzcyBhY2NvdW50LCB1aW50MjU2IGFtb3VudCkgcHVibGljIHZpcnR1YWwgcmV0dXJucyAoYm9vbCkgew0KICAgICAgICANCiAgICAgICAgX2J1cm4oYWNjb3VudCwgYW1vdW50ICogMTAqKnVpbnQoZGVjaW1hbHMoKSkpOw0KDQogICAgICAgIHJldHVybiB0cnVlOw0KICAgIH0NCn0=",
  "constructor_arguments": "",
  "libraries": []
}
```

#### **RESPONSE PARAMETER**

<table data-header-hidden><thead><tr><th></th><th></th><th></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>value</strong></td></tr><tr><td><em>results</em></td><td>Json</td><td>Result of verification process                                                             - 0: Failed                                                                                                        - 1: Success</td><td></td></tr></tbody></table>

**RESPONSE SAMPLE**

```
{
    "results": 1
}
```


# Transaction APIs

### Check contract execution status (if there was an error during contract execution)

#### URI

<table data-header-hidden><thead><tr><th width="121"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/transactions/{transaction_hash}/transaction-status</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/transactions/{transaction_hash}/transaction-status</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

| **key**             | **type** | **value**        | **required** |
| ------------------- | -------- | ---------------- | ------------ |
| *transaction\_hash* | String   | transaction hash | true         |

#### **REQUEST SAMPLE**

```
GET https://explorerapi.wemix.com/v1/transactions/0x83236e5bf7ea6cfdac4dd5114f9440e40d056af22eed751bcf620d004e64337a/transaction-status 
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f435391
```

#### **RESPONSE  PARAMETER**

| **key**                    | **type**      | **value**                                                                                                                                                                                                                                      |
| -------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *status*                   | String        | Status of request                                                                                                                                                                                                                              |
| *message*                  | String        | Response Message of request                                                                                                                                                                                                                    |
| *reuslts*                  | Json          | Results of request                                                                                                                                                                                                                             |
| *reuslts.data*             | List\<Object> | List of data                                                                                                                                                                                                                                   |
| *results.data.status*      | Integer       | Identify if the transaction is an error or not                                                                                   - 0: Error                                                                                       - 1: Success |
| *results.data.description* | String        | Message to add more information about the error                                                                                                                                                                                                |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": {
            "status": "1"
        }
    }
}
```

### Check transaction receipt status (Only applicable for Post Byzantium fork transactions)

#### URI

<table data-header-hidden><thead><tr><th width="131"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/transactions/{transaction_hash}/receipt-status</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/transactions/{transaction_hash}/receipt-status</td></tr></tbody></table>

**REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **PATH VARIABLE**

| **key**             | **type** | **value**        | **required** |
| ------------------- | -------- | ---------------- | ------------ |
| *transaction\_hash* | String   | transaction hash | true         |

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/api/ext/v1/transactions/0x83236e5bf7ea6cfdac4dd5114f9440e40d056af22eed751bcf620d004e64337a/receipt-status
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**               | **type**      | **value**                                                                                                                                                                                                                                                                                                                                                       |
| --------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *status*              | String        | Status of request                                                                                                                                                                                                                                                                                                                                               |
| *message*             | String        | Response Message of request                                                                                                                                                                                                                                                                                                                                     |
| *reuslts*             | Json          | Results of request                                                                                                                                                                                                                                                                                                                                              |
| *reuslts.data*        | List\<Object> | List of data                                                                                                                                                                                                                                                                                                                                                    |
| *results.data.status* | String        | Identify when the receipt of transaction is available                                                                                                                                                                          - 0: Not available(exists transaction)                                                                            - 1: Available |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": {
            "status": "1"
        }
    }
}
```

### Get "Internal Transactions" by transaction hash

#### **URI**

<table><thead><tr><th width="124"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/transactions/{transaction_hash}/internal-transactions</td></tr><tr><td><em>Testnet</em></td><td>GET https://microscopeapi.test.wemix.com/v1/transactions/{transaction_hash}/internal-transactions</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api key   | true         |

* **PATH VARIABLE**

| **key**         | **type** | **value**                                | **required** |
| --------------- | -------- | ---------------------------------------- | ------------ |
| *address\_hash* | String   | <ul><li>Address of transaction</li></ul> | true         |

* **QUERY STRING**

| **key** | **type** | **value**                                                                           | **required** |
| ------- | -------- | ----------------------------------------------------------------------------------- | ------------ |
| *limit* | Integer  | Maximum number of record will retrieve           Default: 50, Max: 1000             | false        |
| *input* | Boolean  | Include input data                                                   Default: false | false        |

#### REQUEST SAMPLE

```
GET https://explorerapi.wemix.com/v1/transactions/0xcf26b25dd7ce714615ea1a6aac0c7fe3d10372b2ecce243178875d43d76d3701/internal-transactions?input=true
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                           | **type**      | **value**                                                                                                                                                                                     |
| --------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *status*                          | String        | Status of request                                                                                                                                                                             |
| *message*                         | String        | Response Message of request                                                                                                                                                                   |
| *results*                         | Json          | Results of request                                                                                                                                                                            |
| *results.count*                   | String        | Total count of data                                                                                                                                                                           |
| *results.data*                    | List\<Object> | List of data                                                                                                                                                                                  |
| *results.data.timestamp*          | String        | UTC time when the transaction occurred                                                                                                                                                        |
| *results.data.sender*             | String        | Address of sender                                                                                                                                                                             |
| *results.data.receiver*           | String        | Address of receiver                                                                                                                                                                           |
| *results.data.value*              | String        | Value of internal transaction                                                                                                                                                                 |
| *results.data.status*             | String        | Status of internal transaction                                                   - 0: Failed,                                                                               - 1: Success      |
| *results.data.message*            | String        | Message of internal transaction                                                                                                                                                               |
| *results.data.transaction\_hash*  | String        | Hash value of the transaction                                                                                                                                                                 |
| *results.data.block\_number*      | String        | Block height                                                                                                                                                                                  |
| *results.data.contract\_address*  | String        | Address of contract creation if this is create contract transaction                                                                                                                           |
| *results.data.trace\_address*     | List\<String> | Trace mapping information                                                                                                                                                                     |
| *results.data.trace\_type*        | String        | Type of trace: call, delegatecall, codecall, staticcall, selfdestruct                                                                                                                         |
| *results.data.sub\_traces*        | String        | Number of sub traces from this internal transaction                                                                                                                                           |
| *results.data.transaction\_index* | String        | Index of the transaction on the block                                                                                                                                                         |
| *results.data.gas\_used*          | String        | Total amount of Gas used transactions                                                                                                                                                         |
| *results.data.gas\_limit*         | String        | Limit of gas for executing the transaction                                                                                                                                                    |
| *results.data.external\_receiver* | String        | Whether external receive has occurred                                    - false: external transaction exists                                     - true: external transaction does not exist |
| results.data.input                | String        | Input parameters used when executing a transaction                                                                                                                                            |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "19",
        "data": [
            {
                "timestamp": "2023-06-23T08:22:24Z",
                "sender": "0xde6ed165a256d3b7a478a3855daa63c18ef2b032",
                "receiver": "0x64817f0077bb6ed63d22c09ce167aa197a5e518a",
                "value": "0",
                "status": "1",
                "message": null,
                "transaction_hash": "0xcf26b25dd7ce714615ea1a6aac0c7fe3d10372b2ecce243178875d43d76d3701",
                "block_number": "21273859",
                "contract_address": null,
                "trace_address": [
                    "0",
                    "1",
                    "1",
                    "1",
                    "1",
                    "1"
                ],
                "trace_type": "delegatecall",
                "sub_traces": null,
                "transaction_index": "1",
                "gas_used": "489",
                "gas_limit": "26410",
                "external_receiver": false
            },
            ...
        ]
    }
}
```


# Event logs APIs

### Get Event Logs by address, block number in range and topic

#### **URI**

<table data-header-hidden><thead><tr><th width="119"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/event-logs</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/event-logs</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **QUERY STRING**

<table data-header-hidden><thead><tr><th></th><th width="198"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>required</strong></td></tr><tr><td><em>address</em></td><td>String</td><td>Contract address</td><td>true</td></tr><tr><td><em>limit</em></td><td>Number</td><td>Maximum number of record will retrieve                                               Default: 50, Max: 1000</td><td>false</td></tr><tr><td><em>offset</em></td><td>Number</td><td>Start retrieve record                                                Default: 0</td><td>false</td></tr><tr><td><em>start_block</em></td><td>Number</td><td><p>Get event logs from block number</p><p>Default: null</p></td><td>false</td></tr><tr><td><em>end_block</em></td><td>Number</td><td><p>Get event logs to block number</p><p>Default: null</p></td><td>false</td></tr><tr><td><em>type</em></td><td>String</td><td>Type of message call:<br>- single<br>- combine</td><td>false</td></tr><tr><td><em>topic_0</em></td><td>String</td><td>topic 0</td><td>true</td></tr><tr><td><em>topic_1</em></td><td>String</td><td>topic 1</td><td>false</td></tr><tr><td><em>topic_2</em></td><td>String</td><td>topic 2</td><td>false</td></tr><tr><td><em>topic_3</em></td><td>String</td><td>topic 3</td><td>false</td></tr><tr><td><em>operand</em></td><td>String</td><td>Type of query:                      - and                                          - or</td><td>false</td></tr></tbody></table>

#### **REQUEST SAMPLE**

```
GET https://explorerapi.wemix.com/v1/event-logs?address=0xeAD50432B7DCb8402208a65bc58951b8ccEF9F08
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### RESPONSE PARAMETER

<table data-header-hidden><thead><tr><th width="238"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td></tr><tr><td><em>status</em></td><td>String</td><td>Status of request</td></tr><tr><td><em>message</em></td><td>String</td><td>Message of request</td></tr><tr><td><em>results</em></td><td>List&#x3C;Object></td><td>Results of request</td></tr><tr><td><em>results.count</em></td><td>String</td><td>Total count of event-log</td></tr><tr><td><em>results.data</em></td><td>List&#x3C;Object></td><td>List of data</td></tr><tr><td><em>results.data.timestamp</em></td><td>String</td><td>UTC time when the transaction occurred</td></tr><tr><td><em>results.data.address</em></td><td>String</td><td>Address that relate to this event log</td></tr><tr><td><em>results.data.data</em></td><td>String</td><td>Data of event log</td></tr><tr><td><em>results.data.method</em></td><td>String</td><td>Method of this event log</td></tr><tr><td><em>results.transaction_hash</em></td><td>String</td><td>Transaction hash</td></tr><tr><td><em>results.log_name</em></td><td>String</td><td>Name of log</td></tr><tr><td><em>results.log_abi</em></td><td>String</td><td>Abi of event_log</td></tr><tr><td><em>results.data.transaction_index</em></td><td>String</td><td>Index of transaction</td></tr><tr><td><em>results.data.log_index</em></td><td>String</td><td>Index of log</td></tr><tr><td><em>results.data.topics_count</em></td><td>String</td><td>Number of topic</td></tr><tr><td><em>results.data.topic_0</em></td><td>String</td><td>Value of topic 0</td></tr><tr><td><em>results.data.topic_1</em></td><td>String</td><td>Value of topic 1</td></tr><tr><td><em>results.data.topic_2</em></td><td>String</td><td>Value of topic 2</td></tr><tr><td><em>results.data.topic_3</em></td><td>String</td><td>Value of topic 3</td></tr></tbody></table>

#### **RESPONSE SAMPLE**

````
```json
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "214201",
        "data": [
            {
                "timestamp": "2023-08-10T10:11:05Z",
                "address": "0xead50432b7dcb8402208a65bc58951b8ccef9f08",
                "data": "0x0000000000000000000000009c2d3bb8565c2fc4335c1068dd0b6ca60fb4ecab",
                "method": "0xcdb6c50f",
                "transaction_hash": "0x2098c1cf552111f2a55ea022d832a9bd7a73c5661e62881334aab6e56353bced",
                "log_name": null,
                "log_abi": null,
                "address_type": null,
                "address_extra": null,
                "transaction_index": "0",
                "log_index": "0",
                "topics_count": "1",
                "topic_0": "0xcdb6c50fc95430ac4511195bb0a3cb943f34705415ec82960792a7545a6850bb",
                "topic_1": null,
                "topic_2": null,
                "topic_3": null
            },
            ...
        ]
    }
}
````


# Tokens APIs

### Get ERC20-Token total supply by contract's address

#### URI

<table data-header-hidden><thead><tr><th width="130"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/tokens/{contract_address}/total-supply</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/tokens/{contract_address}/total-supply</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

#### **REQUEST SAMPLE**

```
GET https://explorerapi.wemix.com/v1/tokens/0x8E81fCc2d4A3bAa0eE9044E0D7E36F59C9BbA9c1/total-supply
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                      | **type**      | **value**                   |
| ---------------------------- | ------------- | --------------------------- |
| *status*                     | String        | Status of request           |
| *message*                    | String        | Response Message of request |
| *results*                    | Json          | Results of request          |
| *results.data*               | List\<Object> | List of data                |
| *results.data.total\_supply* | String        | Total supply of token       |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": {
            "total_supply": "9782909016599000000000000"
        }
    }
}
```

### Get ERC20-Token Account Balance

#### **URI**

<table data-header-hidden><thead><tr><th width="128"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/tokens/{contract_address}/balance/{address_hash}</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/tokens/{contract_address}/balance/{address_hash}</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

#### **REQUEST SAMPLE**

```
GET https://explorerapi.wemix.com/v1/tokens/0x8E81fCc2d4A3bAa0eE9044E0D7E36F59C9BbA9c1/balance/0x2769c8A36d2cEF785952e08224c457AefccD0b6a
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                | **type**      | **value**                               |
| ---------------------- | ------------- | --------------------------------------- |
| *status*               | String        | Status of request                       |
| *message*              | String        | Response Message of request             |
| *results*              | Json          | Results of request                      |
| *results.data*         | List\<Object> | List of data                            |
| *results.data.balance* | String        | Balance of address with ERC-20 contract |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "data": {
            "balance": "82256898291758"
        }
    }
}
```

### Get ERC-721 Token held by holder inventory

#### **URI**

<table data-header-hidden><thead><tr><th width="128"></th><th></th></tr></thead><tbody><tr><td><strong>network</strong></td><td><strong>uri</strong></td></tr><tr><td><em>Mainnet</em></td><td>GET https://explorerapi.wemix.com/v1/tokens/{contract_address}/inventory<br><br>GET https://explorerapi.wemix.com/v1/tokens/{contract_address}/inventory/{holder_address}</td></tr><tr><td><em>Testnet</em></td><td>GET https://explorerapi.test.wemix.com/v1/tokens/{contract_address}/inventory<br><br>GET https://explorerapi.test.wemix.com/v1/tokens/{contract_address}/inventory/{holder_address}</td></tr></tbody></table>

#### **REQUEST PARAMETER**

* **HEADER**

| **key**   | **value** | **required** |
| --------- | --------- | ------------ |
| *api-key* | api-key   | true         |

* **QUERY STRING**

<table data-header-hidden><thead><tr><th></th><th width="198"></th><th></th><th></th></tr></thead><tbody><tr><td><strong>key</strong></td><td><strong>type</strong></td><td><strong>value</strong></td><td><strong>required</strong></td></tr><tr><td><em>limit</em></td><td>Number</td><td>Maximum number of record will retrieve                                               Default: 50, Max: 1000</td><td>false</td></tr><tr><td><em>offset</em></td><td>Number</td><td>Start retrieve record                                                Default: 0</td><td>false</td></tr><tr><td><em>holder_address</em></td><td>String</td><td>Address of holder</td><td></td></tr></tbody></table>

#### **REQUEST SAMPLE**

```
GET https://explorerapi.test.wemix.com/v1/tokens/0x62e1ad2a3a9ab55ba20bc4eb27fca655c41fdd88/inventory
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539

GET https://explorerapi.test.wemix.com/v1/tokens/0x62e1ad2a3a9ab55ba20bc4eb27fca655c41fdd88/inventory/0x07f4701f781c898cf18883262ab0e7c3cc199835
api-key: 1ba5e446edf1997f67b51bf9e60b3fbba6fa1bf84301115292805d7e24f43539
```

#### **RESPONSE PARAMETER**

| **key**                        | **type**      | **value**                               |
| ------------------------------ | ------------- | --------------------------------------- |
| *status*                       | String        | Status of request                       |
| *message*                      | String        | Response Message of request             |
| *results*                      | Json          | Results of request                      |
| *results.count*                |               |                                         |
| *results.data*                 | List\<Object> | List of data                            |
| *results.data.holder\_address* | String        | Balance of address with ERC-20 contract |
| *results.data.token\_id*       | String        | Uri of token                            |
| *results.data.token\_uri*      | String        | Id of token                             |
| *results.token\_name*          | String        | Name of token                           |
| *results.token\_symbol*        | String        | Symbol of token                         |

#### **RESPONSE SAMPLE**

```
{
    "status": "200",
    "message": "success",
    "results": {
        "count": "65",
        "data": [
            {
                "holder_address": "0xb0fb83eed8de308d0a076b9763d47a0e1f5d3b7d",
                "token_id": "51",
                "token_uri": "ipfs://bafyreifytod4coyoolbxj6f4nm6hluwqcrhy4vi5hxl5nzpeydodnowh7u/metadata.json"
            },
           ...
        ],
        "token_name": "Tangled",
        "token_symbol": "TTPS"
    }
}
```


# Tutorial

This section covers how to create dApps, create and verify ERC-20 tokens, create and verify ERC-721 tokens, burn tokens, and install End Node for beginners who are new to blockchain.

{% hint style="danger" %}
**Caution**

Once deployed contracts cannot be modified or deleted. \
Please write and deploy the necessary information in the code.
{% endhint %}

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

* [Create a Wallet](/en/tutorial/create-a-wallet)
* [Receive Test Coin](/en/tutorial/receive-test-coin)
* [ERC-20 Token](/en/tutorial/erc-20-token)
  * [Write ERC-20 Token Contract](/en/tutorial/erc-20-token/write-erc-20-contract)
  * [Check ERC-20 Token](/en/tutorial/erc-20-token/check-erc-20-token)
  * [Send ERC-20 Token](/en/tutorial/erc-20-token/send-erc-20-token)
  * [Check ERC-20 Token API](/en/tutorial/erc-20-token/check-erc-20-token-api)
  * [Burn ERC-20 Token](/en/tutorial/erc-20-token/burn-erc-20-token)
* [ERC-721 Token](/en/tutorial/erc-721-token)
  * [Write ERC-721 Token Contract](/en/tutorial/erc-721-token/write-erc-721-contract)
  * [Minting ERC-721 Token](/en/tutorial/erc-721-token/minting-erc-721-token)
  * [Check ERC-721 Token API](/en/tutorial/erc-721-token/check-erc-721-token-api)
  * [Burn ERC-721 Token](/en/tutorial/erc-721-token/burn-erc-721-token)
* [Use Fee Delegation](/en/tutorial/use-fee-delegation)


# Create a Wallet

MetaMask wallet is required to proceed with the tutorial process. \
(These guidelines are based on Chrome.)

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

## Create a Wallet by MetaMask

### 1 . Installing/Creating MetaMask wallet for the First Time

{% content-ref url="/pages/TKU0SU1a9glHEWcI1dlD" %}
[Use MetaMask](/en/quick-start/account/use-metamask)
{% endcontent-ref %}

### 2 . Already Installed/Created MetaMask wallet

You must run the MetaMask Extensions that are installed. If you do not have MetaMask Extensions installed, you must go to the [Chrome Web Store](https://chrome.google.com/webstore/category/extensions) to download and run MetaMask.

If MetaMask is installed, it will be visible in the Extensions tab in the upper right corner. Pressing MetaMask in the figure below takes you to the MetaMask start screen.

<figure><img src="/files/AkHWUd2zcWZ4qjwSleQQ" alt=""><figcaption><p>Install MetaMask Extension</p></figcaption></figure>

Users who have previously created a wallet using MetaMask can recover their wallet by selecting 'Import Wallet' and using the Secret Recovery Phase that they have backed up.

Once MetaMask is running, you can now change the network from Ethereum to WEMIX3.0 Testnet as shown in the picture below.

<figure><img src="/files/89X4ntgYCxOJvDLrLtAZ" alt=""><figcaption><p>Connect WEMIX_Testnet</p></figcaption></figure>

If you have not added a WEMIX3.0 Testnet network, go to the Networks menu on the MetaMask's Settings screen. Then click 'Add a Network' and add the network manually.

The following parameters must be entered for each network.\
For the more information, move to[ Use MetaMask](/en/quick-start/account/use-metamask).

{% hint style="info" %}
**Testnet**

Network Name: WEMIX\_Testnet&#x20;

New RPC URL: <https://api.test.wemix.com/>

ChainID: 1112

Symbol: TWEMIX

Block Explorer URL: <https://explorer.test.wemix.com/>
{% endhint %}

{% hint style="info" %}
**Mainnet**

Network Name: WEMIX\_Mainnet&#x20;

New RPC URL: <https://api.wemix.com/>

ChainID: 1111

Symbol: WEMIX

Block Explorer URL: <https://explorer.wemix.com/>
{% endhint %}


# Receive Test Coin

## Go to Testnet Faucet page

<figure><img src="/files/9zj2zXijjHMsM4sCbMY9" alt=""><figcaption></figcaption></figure>

* Go to the [Testnet Faucet](https://wallet.test.wemix.com/faucet) page.

## Select WEMIX or WEMIX$

<figure><img src="/files/PzWNG2fjVcLhECCrlFB7" alt=""><figcaption></figcaption></figure>

* Select the type of assets you need on the testnet. tWEMIX is used for purposes such as paying gas fees, while tWEMIX$ serves as the official test stablecoin for experimenting with various functions within the WEMIX ecosystem.

## Enter the MetaMask wallet address

<figure><img src="/files/9L66ASFprSbcr04FDKUM" alt=""><figcaption></figcaption></figure>

* Enter your MetaMask wallet address to receive the test assets.

## Request test assets

<figure><img src="/files/RgfoFbnhnWFZraSRRh9M" alt=""><figcaption></figcaption></figure>

* Press the "Request" button to request test coins and tokens from the Testnet Faucet.

<figure><img src="/files/MrdnSP02r44AfuPi4a2B" alt=""><figcaption></figcaption></figure>

* Upon completion of the request, you will be guided as shown in the image. Please note that your request may be denied if you already have a sufficient amount of test assets.

<figure><img src="/files/XPIQQb4forleqteah2gn" alt=""><figcaption></figcaption></figure>

## Check your wallet

<figure><img src="/files/F9Wjm0nSv4mUxpAjbjbr" alt=""><figcaption></figcaption></figure>

* The test assets received through the Testnet Faucet can be viewed in your wallet. If you do not see the assets, you can add the token by entering the following information:

<table><thead><tr><th width="229">Token information</th><th>Content</th></tr></thead><tbody><tr><td>Token contract address</td><td>0xAe81b9fFCde5Ab7673dD4B2f5c648a5579430B17</td></tr><tr><td>Token symbol</td><td>WEMIX$</td></tr><tr><td>Token decimal</td><td>18</td></tr></tbody></table>

<figure><img src="/files/23JpqpZT3WFX0AlXVhtj" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/5J3iIJ21q9xZ4xWD2wUY" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/26dlIIdrfdvEZOlQ5UrN" alt=""><figcaption></figcaption></figure>


# Create Smart Contract

This section covers how to create Smart Contract by using the three tools below.

## REMIX

Remix is an integrated development environment (IDE) that supports the development and deployment of Smart Contracts in a solidity programming language available in a browser. You can deploy and test Smart Contract with a browser.

It is a browser-based tool that users can easily follow and use, and it is a tool to use when creating ERC-720 Smart Contract.

{% content-ref url="/pages/L0UKSHlgn1P8igDLfOqg" %}
[Remix](/en/tutorial/create-smart-contract/remix)
{% endcontent-ref %}

## Truffle

Truffle is a blockchain framework that helps you easily develop dApp based on Ethereum. Smart Contracts can be compiled and distributed via Truffle.

{% content-ref url="/pages/nmOGOztBi3P8ZR17igCR" %}
[Truffle](/en/tutorial/create-smart-contract/truffle)
{% endcontent-ref %}

## Hardhat

Hardhat is a dApp development tool similar to Truffle and is a development framework that supports the creation, compilation, and distribution of Smart Contracts.

{% content-ref url="/pages/6hC0u20QiqVi6EovorV6" %}
[Hardhat](/en/tutorial/create-smart-contract/hardhat)
{% endcontent-ref %}


# Remix

Deploy and Execute Smart Contracts using Remix ID

Remix is an integrated development environment that helps you develop, deploy and manage smart contracts for EVM-based blockchains such as Ethereum running in a web browser environment.

<figure><img src="/files/yUt2qA7ZtOIN5vfQv3pj" alt=""><figcaption><p>Remix IDE, Main Screen</p></figcaption></figure>

To learn how to use Remix, let's create and deploy simple smart contracts. The smart contract to be created is a solidity code that sets a greeting message at deployment, queries it through a greet() function, and changes the greeting message through a setGeering() function.

<pre data-line-numbers><code><strong>//SPDX-License-Identifier: Unlicense
</strong>pragma solidity ^0.8.0;

contract Greeter {
    string private greeting;

    constructor(string memory _greeting) {
        greeting = _greeting;
    }

    function greet() public view returns (string memory) {
        return greeting;
    }

    function setGreeting(string memory _greeting) public {
        greeting = _greeting;
    }
}
</code></pre>

When you access the Remix IDE, there are pre-generated contracts. Select and clear these contracts, create a new Greeter.sol, and enter the code above.

<figure><img src="/files/1Y3rUAc0zs32MPQnuc4P" alt=""><figcaption><p>Greeter.sol</p></figcaption></figure>

Select the Solidity Compiler tab and press the 'Compile Greeter.sol' button to compile the smart contract you created. You can select Advanced Configurations to set up additional features such as Enable Optimization.

<figure><img src="/files/K8Ni08mahgf0xEcCIo06" alt=""><figcaption><p>Compile Greeter.sol</p></figcaption></figure>

To deploy smart contracts to the WEMIX3.0 Testnet via MetaMask, add the WEMIX3.0 Testnet from the MetaMask plug-in installed in your web browser, select the account you want to use, and then select 'Injected Provider - MetaMask' from ENVIRONMENT on the 'DEPLOY & RUN TRANSACTION' tab.&#x20;

If the MetaMask is not installed, you can install and set it up through the 'Use MetaMask' link below. If you have confirmed that your account is set up correctly, select the correct sol file in CONTRACT, type the initial greeting string next to the 'Deploy' button, and press the button to run the deployment. When the MetaMask runs, click OK to run the transaction, and the deployment proceeds.

WEMIX has a different fee policy than Ethereum, so press the 'EDIT' button to go to the screen below.

Please refer to the link below for details.

{% content-ref url="/pages/TKU0SU1a9glHEWcI1dlD" %}
[Use MetaMask](/en/quick-start/account/use-metamask)
{% endcontent-ref %}

<figure><img src="/files/hLZQ048eFPpqBj3RdL7X" alt=""><figcaption></figcaption></figure>

When a smart contract is deployed, you will see the contract name and functions that call address deployed under 'Deployed Contract'. It looks blue for read functions and orange for write functions. Press the 'greet' button to see the string you entered during deployment. For read functions, it runs immediately, but for functions that need to be written, the transaction must be executed using a MetaMask.

<figure><img src="/files/aMbseXUeVK1z8su1rMyT" alt=""><figcaption></figcaption></figure>


# Truffle

This section covers how to create and deploy Smart Contracts using Truffle.

You can install Truffle using npm, the Node package manager.\
Please refer to the following link for instructions on installing npm. \
[https://www.npmjs.com/](< https://www.npmjs.com/>)

```
$ npm install --g truffle
```

If Truffle is intalled, use 'truffle init' command to initialize.

```
$ truffle init

Starting init...
================

> Copying project files to /Users/user/Projects/Solidity/truffle-test

Init successful, sweet!

Try our scaffold commands to get started:
  $ truffle create contract YourContractName # scaffold a contract
  $ truffle create test YourTestName         # scaffold a test

http://trufflesuite.com/docs

$ tree
.
├── contracts
├── migrations
├── test
└── truffle-config.js

4 directories, 1 file
```

If you execute 'truffle init', 'Truffle project' is created. The generated Truffle project consists of build/contracts, contracts, migrations, tests, and truffle-config.js.

* build/contracts : save the result (abi, bitecode) of the compiled contract written in solidity
* contract : smart contract solidity files&#x20;
* migrations : deploy code(js format)&#x20;
* test : test code(js format)&#x20;
* truffle-config.js : solidity compiler version setting, network setting and others\` configuration&#x20;

Use the 'truffle create contract' command to create a simple smart contract template.

```
/ SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract Greeter {
  constructor() public {
  }
}
```

Apply the 'Greater.sol' that you created earlier on this template.

```
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

contract Greeter {
    string private greeting;

    constructor(string memory _greeting) public {
        greeting = _greeting;
    }

    function greet() public view returns (string memory) {
        return greeting;
    }

    function setGreeting(string memory _greeting) public {
        greeting = _greeting;
    }
}
```

To compile and deploy the 'Greater.sol' smart contract, you have to change the 'Truffle-config.js' file.

You need to add HDWalletProvider and privKeys in the 'Truffle-config.js' file to set up the account that you use for deployment. Private keys can be imported after you create an account through the [Web Wallet](https://wallet.test.wemix.com/) or Metamask.

```
const HDWalletProvider = require('@truffle/hdwallet-provoder');
const privKeys = ["privatekey from Web Wallet"];
```

To use the WEMIX3.0 Testnet, add the network settings as show below.

```
networks: {
  wemix_testnet: {
    provider: ()=> new HDWalletProvider(privKeys, "https://api.test.wemix.com"),
    network_id: 1112,
    maxFeePerGas: 100000000010,
    maxPriorityFeePerGas: 100000000000
  }
},
```

Set the version of the Solidity Compiler you want to use. The current latest version is 0.8.x, and the exmaple uses version 0.8.11. If it is installed directly on the operating system that uses the complier, you can annotate the docker settings in the same way as the initial settings. To install it by using docker, you need to set 'docker:true' as show below and docker must be installed. If you use the optimizer, you can turn off the annotation and set the appropriate settings.

```
compilers: {
    solc: {
      version: "0.8.11",    // Fetch exact version from solc-bin (default: truffle's version)
      docker: true,         // Use "0.5.1" you've installed locally with docker (default: false)
      // settings: {          // See the solidity docs for advice about optimization and evmVersion
      //  optimizer: {
      //    enabled: false,
      //    runs: 200
      //  },
      //  evmVersion: "byzantium"
      }
    }
```

After completing the configuration of the truffle-config.js file, you can execute a smart contract compilation. Running the truffle compile \<file name> in the truffle project folder will compile the solidity file you specified as a target. The complied solidity contract are stored in the build/contracts folder in the format, \<contract name>.json.

```
truffle compile <file name>
ex) truffle compile Greeter.sol
```

To deploy the compiled smart contract on the blockchain, you need to write the script shown below and save it as 1\_deploy\_contracts.js.

```
var Greeter = artifacts.require("./Greeter.sol");

module.exports = function(deployer) {
  deployer.deploy(Greeter, "Hello!")
    .then(() => Greeter.deployed());
};
```

You can deploy smart contracts individually by loading the smart contracts that you want to deploy with artifacts.require (\<artifacts file name stored in build/contacts>), and executing deployer.deploy(contract\_artifacts,{constructor arguments}).

```
truffle migrate <file name>
ex) truffle migrate 1_deploy_contracts.js
```

The deployed script can be executed with the truffle migrate \<file name> above. If you don\`t use \<file name>, it is performed in the numerical order used in the script name.&#x20;

The result of the deployment in the WEMIX3.0 Testnet is as follows. For deployment, you must have WEMIX in the account that you want to use for deployment. You can get WEMIX you need from [Testnet Faucet](https://wallet.test.wemix.com/faucet).

```
❯ truffle migrate --reset --network wemix_testnet

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


Starting migrations...
======================
> Network name:    'wemix_testnet'
> Network id:      1112
> Block gas limit: 105000000 (0x6422c40)


1_deploy_contracts.js
=====================

   Deploying 'Greeter'
   -------------------
   > transaction hash:    0xf180dc9041ca140547b62f1a600e2ab920cfe4776d4a5590511df3051d1d09b7
   > Blocks: 0            Seconds: 0
   > contract address:    0x450F45A74b6dC7b38E25Ca84F91C6a909B2e5728
   > block number:        21511136
   > block timestamp:     1679563304
   > account:             0x1134397c2E4aE380B7D4aa446c59D07977fCeB87
   > balance:             99.933323083999672507
   > gas used:            327493 (0x4ff45)
   > gas price:           100.000000001 gwei
   > value sent:          0 ETH
   > total cost:          0.032749300000327493 ETH

   > Saving artifacts
   -------------------------------------
   > Total cost:     0.032749300000327493 ETH

Summary
=======
> Total deployments:   1
> Final cost:          0.032749300000327493 ETH
```

You can test the deployed smart contract using the javascript file as follows.

```
const migration = artifacts.require("Migrations");

contract("Migration", async () => {
    describe("Migration test", async () => {
        it("setCompleted", async () => {
            const migrations = await migration.deployed();
            await migrations.setCompleted(0);
        });
    });
});

```

* contract : test target contract
* describe : test case collection
* it : each test case

```
truffle test <test file name>
```

When the test code is complete, save the test file as \<testName.test.js> format in the test folder and execute the truffle test \<testName.test.js> to perform the test.


# Hardhat

Deploy and Execute Smart Contracts using Hardhat

Let\`s create and deploy Smart Contracts using Hardhat.&#x20;

You can create Hardhat project as follows. After running 'npx hardhat', you select what type of project to create and set the the root path for the project. If You choose to add the '.gitignore file' or install the dependency module for the sample project, the necessary files are installed.&#x20;

```
$ mkdir greeter
$ cd greeter

$ npm install --save-dev hardhat

$ npx hardhat
888    888                      888 888               888
888    888                      888 888               888
888    888                      888 888               888
8888888888  8888b.  888d888 .d88888 88888b.   8888b.  888888
888    888     "88b 888P"  d88" 888 888 "88b     "88b 888
888    888 .d888888 888    888  888 888  888 .d888888 888
888    888 888  888 888    Y88b 888 888  888 888  888 Y88b.
888    888 "Y888888 888     "Y88888 888  888 "Y888888  "Y888

👷 Welcome to Hardhat v2.13.0 👷‍

✔ What do you want to do? · Create a JavaScript project
✔ Hardhat project root: · /Users/trident/Projects/Solidity/hardhat-test
✔ Do you want to add a .gitignore? (Y/n) · y
✔ Do you want to install this sample project's dependencies with npm (hardhat @nomicfoundation/hardhat-toolbox)? (Y/n) · y
```

After installation, the directory structure is as follows. Smart contracts will be located in contracts, deployed scripts in scripts, test code in tests, and compiled results in artifacts, cache. Set the network connection information, solidity compiler version information, and so on in hardhat.config.js.

```
tree . -I node_modules
.
├── README.md
├── contracts
│   └── Lock.sol
├── hardhat.config.js
├── package-lock.json
├── package.json
├── scripts
│   └── deploy.js
└── test
    └── Lock.js

4 directories, 7 files
```

The Lock.sol that is created by default is compiled as follows.

```solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

// Uncomment this line to use console.log
// import "hardhat/console.sol";

contract Lock {
    uint public unlockTime;
    address payable public owner;

    event Withdrawal(uint amount, uint when);

    constructor(uint _unlockTime) payable {
        require(
            block.timestamp < _unlockTime,
            "Unlock time should be in the future"
        );

        unlockTime = _unlockTime;
        owner = payable(msg.sender);
    }

    function withdraw() public {
        // Uncomment this line, and the import of "hardhat/console.sol", to print a log in your terminal
        // console.log("Unlock time is %o and block timestamp is %o", unlockTime, block.timestamp);

        require(block.timestamp >= unlockTime, "You can't withdraw yet");
        require(msg.sender == owner, "You aren't the owner");

        emit Withdrawal(address(this).balance, block.timestamp);

        owner.transfer(address(this).balance);
    }
}
```

```
$ npx hardhat compile
Compiled 1 Solidity files successfully
```

Run the test using Lock.js, which is created by default.

```
$ npx hardhat test


  Lock
    Deployment
      ✔ Should set the right unlockTime (2392ms)
      ✔ Should set the right owner
      ✔ Should receive and store the funds to lock
      ✔ Should fail if the unlockTime is not in the future (46ms)
    Withdrawals
      Validations
        ✔ Should revert with the right error if called too soon
        ✔ Should revert with the right error if called from another account
        ✔ Shouldn't fail if the unlockTime has arrived and the owner calls it
      Events
        ✔ Should emit an event on withdrawals
      Transfers
        ✔ Should transfer the funds to the owner


  9 passing (3s)
```

Deploying smart contracts uses deploy.js, which is provided by default. You need to set up a network to deploy in advance, but add the WEMIX3.0 Testnet and Mainnet to hardhat.config.js as shown below. If you save the private key of the account address that use for deployment, it is easy to work with, so we recommend that you create a test account and then send as many WEMIX as you need. How to extract private keys from a MetaMask is omitted here.

{% code title="hardhat.config.js" %}

```
require("@nomicfoundation/hardhat-toolbox");

/** @type import('hardhat/config').HardhatUserConfig */
const PrivateKey = "<<Private Key>>"

module.exports = {
  solidity: "0.8.18",
  networks: {
    wemix_testnet: {
      url: "https://api.test.wemix.com",
      accounts: [`0x${PrivateKey}`],
      gasPrice: 101000000000
    },
    wemix_mainnet: {
      url: "https://api.wemix.com",
      accounts: [`0x${PrivateKey}`],
      gasPrice: 101000000000
    },
  },
};
```

{% endcode %}

{% code title="scripts/deploy.js" %}

```
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");

async function main() {
  const currentTimestampInSeconds = Math.round(Date.now() / 1000);
  const unlockTime = currentTimestampInSeconds + 60;

  const lockedAmount = hre.ethers.utils.parseEther("0.001");

  const Lock = await hre.ethers.getContractFactory("Lock");
  const lock = await Lock.deploy(unlockTime, { value: lockedAmount });

  await lock.deployed();

  console.log(
    `Lock with ${ethers.utils.formatEther(
      lockedAmount
    )}ETH and unlock timestamp ${unlockTime} deployed to ${lock.address}`
  );
}

// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});
```

{% endcode %}

When you are ready, run the following command to deploy. Upon successful deployment, the smart contract address is output according to the preset log.

```
$ npx hardhat run scripts/deploy.js --network wemix_testnet
Lock with 0.001ETH and unlock timestamp 1679558487 deployed to 0x813fbbbeF30f343da37332293546dc854
```


# ERC-20 Token

This section covers how to use ERC-20 Token easily.

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

### ERC-20 Token

Ethereum Request for Comment (ERC) refers to the standard for tokens issued in the Ethereum blockchain network (referring to Token, a digital asset that is subordinated while complying with the basic conventions within the main blockchain).

ERC-20 is a token standard on Ethereum with alternative features.\
Please refer to the official [ERC-20 documention](https://eips.ethereum.org/EIPS/eip-20) for more information.

The rest of this section consists of:

1. [Write ERC-20 Contract](/en/tutorial/erc-20-token/write-erc-20-contract)
2. [Check ERC-20 Token](/en/tutorial/erc-20-token/check-erc-20-token)
3. [Send ERC-20 Token](/en/tutorial/erc-20-token/send-erc-20-token)
4. [Check ERC-20 Token API](/en/tutorial/erc-20-token/check-erc-20-token-api)
5. [Burn ERC-20 Token](/en/tutorial/erc-20-token/burn-erc-20-token)


# Write ERC-20 Contract

It is possible to proceed an ERC-20 contract deployment test using Remix.

{% hint style="danger" %}
Caution

Once deployed contracts cannot be modified or deleted. \
Please write and deploy the necessary information in the code.
{% endhint %}

Let's proceed with the contract deployment process in the order below.

* Step 1 : Access the Remix and Create a file
* Step 2 : Write ERC-20 Contract
* Step 3 : Move to SOLIDITY COMPILER tap, Set the version, and Compile
* Step 4 : Set DEPLOY & RUN TRANSACTIONS
* Step 5 : Set Gas fee and Sign at MetaMask&#x20;

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

### Step 1 : Access the Remix and Create a file

Go to <https://remix.ethereum.org>.&#x20;

<figure><img src="/files/OQm7W5YTaanwlaMAettJ" alt=""><figcaption><p>Remix Initial View</p></figcaption></figure>

Storage.sol, Owner.sol, and Ballot.sol are shown in the contracts directory. To create a new smart contract, select them to erase it and create a new file.

The figure below shows an example of creating `WEMIX_ERC20.sol` file in the contracts directory.

<figure><img src="/files/2gto5WoU0okQQvJ69Nxc" alt=""><figcaption><p>Create a File</p></figcaption></figure>

### Step 2 : Write ERC-20 Contract&#x20;

You can create the following ERC-20 contracts:

```null
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(string memory name, string memory symbol) ERC20(name, symbol) {
        // Mint 100 tokens to msg.sender
        // Similar to how
        // 1 dollar = 100 cents
        // 1 token = 1 * (10 ** decimals)
        _mint(msg.sender, 99999999 * 10**uint(decimals()));
    }
}
```

The figure below is an example of the above code in the `WEMIX_ERC20.sol.`

<figure><img src="/files/9KVvxuhHiUDaZnaEQNWR" alt=""><figcaption><p>Example Code</p></figcaption></figure>

### Step 3 : Move to SOLIDITY COMPILER tap, Set Version, and Compile

Once the code is written, compile after selecting the correct compiler version on the Solidity Compiler screen.

The compiler version of the example code provided is 0.8.19.

<figure><img src="/files/EMN4l3chG7oFSksY5nzY" alt=""><figcaption><p>Compile Example Code</p></figcaption></figure>

### Step 4 : Set DEPLOY & RUN TRANSACTIONS

On the Deploy & Run Transactions screen, select the environment to deploy smart contracts to test.&#x20;

The figure below shows an example of deploying to WEMIX3.0 Testnet using the 'Injected Provider - Metamask' provided by Remix.

<figure><img src="/files/6R1Tt0FbneGjJA5CfcNE" alt=""><figcaption><p>Setting Delpoying Envrionment</p></figcaption></figure>

If ENVIRONEMNT is selected as 'Injected Provider - MetaMask', it is connected to MetaMask, which requires the network to be 'WEMIX\_Testnet' connection.\
\
For more information about MetaMask connection, see[ Use MetaMask](/en/quick-start/account/use-metamask).

<figure><img src="/files/c9ceYTPf4dDZdecvBBYb" alt=""><figcaption><p>Connect MetaMask &#x26; WEMIX_Testnet</p></figcaption></figure>

In CONTRACT, find MyToken and type the name and symbol you want in 'string name' and 'string symbol' in the input field next to Deploy.

The figure below is an example of designating 'WTOKEN', 'WT'.

<figure><img src="/files/7ZH7zMfDEqddDnsKHclf" alt=""><figcaption><p>Setting Tokne Name &#x26; Symbol</p></figcaption></figure>

### **Step 5 : Set Gas Fee and Sign at MetaMask**

After setting on the Deploy & Run Transactions, if you select 'deploy' button, the MetaMask pop-up appears. The screen showing 'Gas Fee' based on Ethereum will be displayed as shown below.

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change t the Gas Fee.

<figure><img src="/files/OqTtFUTDXgmt2LS1jKZ8" alt=""><figcaption><p>MetaMask, default 'Gas fee'</p></figcaption></figure>

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/4w5Cd3eGvSqd5LK3nWHY" alt=""><figcaption><p>MetaMask default 'Gas Fee' setting entry screen</p></figcaption></figure>

<figure><img src="/files/YTbgUBxb0JAdb6rtzzFJ" alt=""><figcaption><p>'Gas Fee' setting</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Complete the Fee setup in the figure above and select 'Save' to be ready for deployment as shown below.

<figure><img src="/files/U8faZvDhEOAt1aWjTkyw" alt=""><figcaption><p>Confirm Example ERC-20 Deployment</p></figcaption></figure>

Select 'Confirm' in the figure above to proceed with the contract deployment.&#x20;

If a green check mark appears at the bottom of the Remix screen as shown below, the deployment is completed normally.

<figure><img src="/files/N93ONfP0uEec41xwYfZ4" alt=""><figcaption><p>Complete Example ERC-20 Deployment</p></figcaption></figure>


# Check ERC-20 Token

You can add and verify the custom token in MetaMask for ERC-20 tokens distributed using Remix.

ERC-20 contracts must be deployed in advance. Please refer to [Write ERC-20 Contract ](/en/tutorial/erc-20-token/write-erc-20-contract)for ERC-20 Contract deployment.&#x20;

We will proceed with the process of checking the ERC-20 token in the order below\..

* Step 1 :  Access MetaMask
* Step 2 : Check Token Contract Address
* Step 3 : Add Custom Token
* Step 4 : Confirm Custom Token

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

## Step 1 : Access MetaMask

You must run the MetaMask Extensions that are installed. If you do not have MetaMask Extensions installed, you must go to the [Chrome Web Store](https://chrome.google.com/webstore/category/extensions) to download and run MetaMask.

<figure><img src="/files/NMhU2tXE7SSbrut696Ns" alt=""><figcaption><p>Install MetaMask Extension</p></figcaption></figure>

Once MetaMask is running, you can now change the network from Ethereum to WEMIX3.0 Testnet as shown in the picture below.

<figure><img src="/files/D26F5hpNzm72HRqxU5Pv" alt=""><figcaption><p>Connect WEMIX_Testnet</p></figcaption></figure>

## Step 2 : Check Token Contract Address

A token contract address is required to add as a Custom Token. \
The ERC-20 Contract Address deployed through Remix can be found in [Testnet Explorer](https://explorer.test.wemix.com/).

After accessing [Testnet Explorer](https://explorer.test.wemix.com/), you can check tokens by selecting 'Token > Tokens List'.

<figure><img src="/files/sugSJ0lBoPRKOUrjbeRL" alt=""><figcaption><p>Token > Token List</p></figcaption></figure>

Find the name of the token entered when creating the ERC-20 contract, check the Contract Address, and copy it.

## Step 3 : Add Custom Token

Return to the MetaMask and select 'Import tokens' and enter 'Token contract address'. \
When entering 'Token contract address', Token symbol and Token decision are automatically entered.

<figure><img src="/files/wmrbJIm0lvOH7TSGpRet" alt=""><figcaption><p>After selecting 'Import tokens', Enter Token Contract Address and Add</p></figcaption></figure>

If you select 'Add custom token' in the picture above, a screen will be displayed to confirm whether you want to add the token finally. Select 'Import tokens' to complete token registration.

## Step 4 : Confirm Custom Token

Once the token registration is complete, you can check the ERC-20 Token deployed at the bottom of TWEMIX as shown below.&#x20;

Below is an additional example of Token with Token Name 'WT Token'.

<figure><img src="/files/8ynHpNrO4jwikTTmeXgZ" alt=""><figcaption><p>Confirm Custom Token</p></figcaption></figure>


# Send ERC-20 Token

You can send ERC-20 tokens deployed by using Remix from MetaMask.

You must have pre-registered ERC-20 tokens and the deployed ERC-20 token must be added in MetaMask.

* Deploy ERC-20 Contract Deployment : [Write ERC-20 Contract](/en/tutorial/erc-20-token/write-erc-20-contract)
* Add ERC-20 Token: : [ Check ERC-20 Token](/en/tutorial/erc-20-token/check-erc-20-token)

We will proceed with the process of sending the ERC-20 token in the order below\..

* Step 1 :  Access MetaMask
* Step 2 : Send Token
* Step 3 : Confirm Token Transfer

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

## Step 1 : Access MetaMask

You must run the MetaMask Extensions that are installed. If you do not have MetaMask Extensions installed, you must go to the [Chrome Web Store](https://chrome.google.com/webstore/category/extensions) to download and run MetaMask.

<figure><img src="/files/NMhU2tXE7SSbrut696Ns" alt=""><figcaption><p>Install MetaMask Extension</p></figcaption></figure>

Once MetaMask is running, you can now change the network from Ethereum to WEMIX3.0 Testnet as shown in the picture below.

<figure><img src="/files/D26F5hpNzm72HRqxU5Pv" alt=""><figcaption><p>Connect WEMIX_Testnet</p></figcaption></figure>

## Step 2 : Send Token

Select Custom Token that you have deployed and added.&#x20;

Select 'Send' to display a screen to enter the wallet address to send.&#x20;

Enter the wallet address of the person you want to send the token to.

<figure><img src="/files/ALSJjTKOPbtcKtm3DtZa" alt=""><figcaption><p>Enter the Wallet Address</p></figcaption></figure>

Once you enter your wallet address, make sure it's a token to send, enter the amount, and select 'Next'.

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change t the Gas Fee.

<figure><img src="/files/8BP4DUXKqdn8g768nEzT" alt=""><figcaption><p>Check Token Amount</p></figcaption></figure>

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/KoAqXIuFfReFOHe3caJh" alt=""><figcaption><p>Set Gas Fee</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Check the check box to keep the value you changed.&#x20;

Completing the Fee setup and selecting 'Save' as shown above, you are ready to send tokens. Token transfer is completed at 'Confirm' after final confirmation.

## Step 3 : Confirm Token Transfer

You can view the Send history on the 'Activity' tab of the MetaMask.&#x20;

Select the Send history you sent to view more information.

<figure><img src="/files/J92gbUtERAouQT1irbR8" alt=""><figcaption><p>Check Send Hisotry</p></figcaption></figure>

The Transaction ID also allows you to verify that the token has been sent in [Testnet Explorer](https://explorer.test.wemix.com/).

Access [Testnet Explorer](https://explorer.test.wemix.com/) and search for the Transaction ID.&#x20;

Below is an example of what Testnet Explorer has seen.

<figure><img src="/files/CGqUveTZbIfvOhIyyRZv" alt=""><figcaption><p>'Send' transaction at WEMIX3.0 Testnet Explorer</p></figcaption></figure>


# Check ERC-20 Token API

You can query the ERC-20 Token API using Postman.&#x20;

Let's proceed with the API inquiry process in the order below.

* Step 1 :  Access Postman
* Step 2 : Execute API and Check the results

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

## Step 1 : Access Postman

Go to <https://www.postman.com/> and install Postman.\
After accessing Postman, move to 'Workspaces'.

Select the 'Import' button to insert the  `WEMIX3.0 API.json` file to launch the WEMIX3.0 API.

<figure><img src="/files/5uaJVUtX761tAn5InTaQ" alt=""><figcaption><p>Postman My Workspace</p></figcaption></figure>

<figure><img src="/files/jF4xuHCCz4iMXHfnmQFX" alt=""><figcaption><p>Execute Postman WEMIX3.0 API</p></figcaption></figure>

## Step 2 : Execute API and Check the results

From the WEMIX 3.0 API list, select API > Tokens > total-supply to check the ERC-20 token you want.

#### Check Total Supply for Token

{% tabs %}
{% tab title="Testnet" %}
<https://explorerapi.test.wemix.com/v1/tokens/{contract\\_address}/total-supply>
{% endtab %}

{% tab title="Mainnet" %}
<https://explorerapi.wemix.com/v1/tokens/{contract\\_address}/total-supply>
{% endtab %}
{% endtabs %}

Enter the URI above in the input box next to 'Get'.&#x20;

You can enter the contract address you want in the {contract\_address} of the URI.&#x20;

The figure below is an example of checking the Testnet ERC-20 token.

```
https://explorerapi.test.wemix.com/v1/tokens/0x316E2e2DB3fb28e663F2F59899f98D5b925F7E53/total-supply
```

<figure><img src="/files/dMgP2bvOPh46kzZWKFfL" alt=""><figcaption><p>Execute Total Supply API</p></figcaption></figure>

If you select 'Send', you can see that the output is the same as the data found in [Testnet Explorer](https://explorer.test.wemix.com/).

<figure><img src="/files/WAhQ4BP9SPhtXYCoXLZC" alt=""><figcaption><p>Result of Total Supply API </p></figcaption></figure>

<figure><img src="/files/RMWjRyZkX9JVOtpoGQUs" alt=""><figcaption><p>WEMIX3.0 Testnet Explorer Total supply</p></figcaption></figure>


# Burn ERC-20 Token

It is possible to proceed an ERC-20 Token burning test using Remix.

There are two ways to burn ERC-20 Token.

* **Sending to a Dead Wallet Address**
* **Burning by the Administrator**

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

## **1 . Sending to a Dead Wallet Address**

First, let's proceed with the burning process by sending the ERC-20 Token to the Dead Wallet address.&#x20;

[Write ERC-20 Contract ](/en/tutorial/erc-20-token/write-erc-20-contract)and [Check ERC-20 Token](/en/tutorial/erc-20-token/check-erc-20-token) should proceed first.

### Sending to a Dead Wallet Address

Once adding the Token is completed after deploying ERC-20 Contract, select the added ERC-20 Token and proceed with 'Send' to the Dead Wallet address.

<figure><img src="/files/ya5q25CnptnDjR2P8Gcq" alt=""><figcaption><p>Send Token_WT at MetaMask</p></figcaption></figure>

Select 'Send' in the figure above. After then enter the Dead Wallet address and the quantity of Token you want to burn.

{% hint style="info" %}
**Dead Wallet Address**

0x000000000000000000000000000000000000dEaD
{% endhint %}

The figure below is the example of buring 10,000,000 WT Tokens to the Dead Wallet address.

<figure><img src="/files/3f6HAtAtmIlpMFYUxMX8" alt=""><figcaption><p>example of burning ERC-20</p></figcaption></figure>

When you select 'Next' after entering Token amount that you want to burn, a MetaMask pop-up appears and a screen showing the default 'Gas Fee' based on Ethereum appears.

<figure><img src="/files/ArGRTIGcdXrGVHjoernC" alt=""><figcaption><p>MetaMask, default 'Gas fee'</p></figcaption></figure>

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change t the Gas Fee.

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/rz435CTsQA8UZo73MzcL" alt=""><figcaption><p>MetaMask default 'Gas Fee' setting entry screen</p></figcaption></figure>

<figure><img src="/files/nKDx5GgkDJ6bY6VI2NnJ" alt=""><figcaption><p>'Gas Fee' setting</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Complete the Fee setup in the figure above and select 'Save' to be ready for burning Token as shown below.

<figure><img src="/files/S2nttnNfkDA5cpkr075T" alt=""><figcaption><p>Confirm ERC-20 Token burning </p></figcaption></figure>

Select 'Confirm' in the figure above to burn ERC-20 Token.

If a green check mark appears at the bottom of the Remix screen as shown below, the burning ERC-20 Token is completed normally.

<figure><img src="/files/JNL8YbpBt8YuzaOVNkvW" alt=""><figcaption><p>Complete ERC-20 Token burning</p></figcaption></figure>

If you select the ERC-20 Token that you created on the Token List page in [Testnet Explorer](https://explorer.test.wemix.com/)., you can confirm that the ERC-20 Token has been burned normally.

<figure><img src="/files/ozvAi7VDxTbqz5ppMGJB" alt=""><figcaption><p>WEMIX3.0 Testnet Explorer </p></figcaption></figure>

## **2 . Burning by the Administrator**

Second, we will proceed with the burning ERC-20 Token process by the Administrator in Remix.

[Write ERC-20 Contract ](/en/tutorial/erc-20-token/write-erc-20-contract)and [Check ERC-20 Token](/en/tutorial/erc-20-token/check-erc-20-token) should proceed first.

### Burning ERC-20 Token directly

You can see the contents of the deployed contract in the "Deployed Contracts" section of the screen where the ERC-20 Contract was deployed.&#x20;

Select 'burn' to enter account and amount. \
In account, enter the deployed address, and in account, enter the quantity you want to burn.

The figure below shows an example of burning 999 WBT Token after deploying WEMIX BurnToken Contract.

<figure><img src="/files/Rebia51euw5lFYClHlYH" alt=""><figcaption><p>example of buring ERC-20</p></figcaption></figure>

When 'transact' is selected after entering the account and amount, a MetaMask pop-up appears as shown below, and a screen showing the default "Gas Fee" based on Ethereum appears.

<figure><img src="/files/DAaNJ6XOy8uGIQjEP5pt" alt=""><figcaption><p>MetaMask, default 'Gas fee'</p></figcaption></figure>

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change t the Gas Fee.

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/Jxdhp9xY8yjsQxcWFImJ" alt=""><figcaption><p>MetaMask default 'Gas Fee' setting entry screen</p></figcaption></figure>

<figure><img src="/files/oDQdonS8F76pcu6lqZaS" alt=""><figcaption><p>'Gas Fee' setting</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Complete the Fee setup in the figure above and select 'Save' to be ready for deployment as shown below.

<figure><img src="/files/NqvrPal5asDPrxHntagw" alt=""><figcaption><p>Confirm Example ERC-20 burning</p></figcaption></figure>

Select 'Confirm' in the figure above to proceed with the contract deployment.&#x20;

If a green check mark appears at the bottom of the Remix screen as shown below, the deployment is completed normally.

<figure><img src="/files/WBUWfgljrCzr1Xv3UbF2" alt=""><figcaption><p>Complete Example ERC-20 burning</p></figcaption></figure>

If you select the ERC-20 Token that you created on the Token List page in [Testnet Explorer](https://explorer.test.wemix.com/), you can confirm that the ERC-20 Token has been burned normally.

<figure><img src="/files/Qf1tfrzDEnEg2i9n4iNu" alt=""><figcaption><p>WEMIX3.0 Testnet Explorer </p></figcaption></figure>


# ERC-721 Token

This section covers how to use ERC-721 Token easily.

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

### ERC-721 Token

Ethereum Request for Comment (ERC) refers to the standard for tokens issued in the Ethereum blockchain network (referring to Token, a digital asset that is subordinated while complying with the basic conventions within the main blockchain).

ERC-721 is an NFT standard on Ethereum with irreplaceable features.\
Please refer to the official [ERC-721 documentation](https://eips.ethereum.org/EIPS/eip-721) for more information.

The rest of this section consists of:

1. [Write ERC-721 Contract](/en/tutorial/erc-721-token/write-erc-721-contract)
2. [Minting ERC-721](/en/tutorial/erc-721-token/minting-erc-721-token)
3. [Check ERC-721 Token API](/en/tutorial/erc-721-token/check-erc-721-token-api)
4. [Burn ERC-721 Token](/en/tutorial/erc-721-token/burn-erc-721-token)


# Write ERC-721 Contract

It is possible to proceed an ERC-721Let's proceed with the contract deployment process in the order below. contract deployment test using Remix.

{% hint style="danger" %}
Caution

Once deployed contracts cannot be modified or deleted. \
Please write and deploy the necessary information in the code.
{% endhint %}

Let's proceed with the contract deployment process in the order below.

* Step 1 : Access the Remix and Create a file
* Step 2 : Write ERC-721 Contract
* Step 3 : Move to SOLIDITY COMPILER tap, Set the version, and Compile
* Step 4 : Set DEPLOY & RUN TRANSACTIONS
* Step 5 : Set Gas fee and Sign at MetaMask&#x20;

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

### Step 1 : Access the Remix and Create a file

Go to <https://remix.ethereum.org>.&#x20;

<figure><img src="/files/EE6QBA0qIqZSEYIO8YmF" alt=""><figcaption><p>Remix Initial View</p></figcaption></figure>

Storage.sol, Owner.sol, and Ballot.sol are shown in the contracts directory. To create a new smart contract, select them to erase it and create a new file.

The figure below shows an example of creating`MyNFT.sol` file in the contracts directory.

<figure><img src="/files/06PxHh9kHoaqRrlfK1oP" alt=""><figcaption><p>Create a File</p></figcaption></figure>

### Step 2 : Write ERC-721 Contract

You can create the following ERC-721 contracts:

```
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";

contract MyNFT is ERC721URIStorage, Ownable {
    using Counters for Counters.Counter;
    Counters.Counter private _tokenIds;

    constructor() public ERC721("Name", "Symbol") {}

    function mintNFT(address recipient, string memory tokenURI) public onlyOwner returns (uint256){
    
        _tokenIds.increment();

        uint256 newItemId = _tokenIds.current();
        _mint(recipient, newItemId);
        _setTokenURI(newItemId, tokenURI);

        return newItemId;
    }
}
```

You can specify the Token Name, Token Symbol that you want.&#x20;

In the code below, you can enter the name and Symbol you want in the 'Name' and 'Symbol'.

```
    constructor() public ERC721("Name", "Symbol") {}
```

The figure below is an example of designating 'WMNFT', 'NFT'.

<figure><img src="/files/wK3769o33zysOTGKZec3" alt=""><figcaption><p>Example Code</p></figcaption></figure>

### Step 3 : Move to SOLIDITY COMPILER tap, Set Version, and Compile

Once the code is written, compile after selecting the correct compiler version on the Solidity Compiler screen.

The compiler version of the example code provided is 0.8.10, and you must select the compiler version that is lower than that version.

<figure><img src="/files/ElyRrPLSW90mfv8pJ5Zs" alt=""><figcaption><p>Compile Example Code</p></figcaption></figure>

### Step 4 : Set DEPLOY & RUN TRANSACTIONS

On the Deploy & Run Transactions screen, select the environment to deploy smart contracts to test.&#x20;

The figure below shows an example of deploying to WEMIX3.0 Testnet using the 'Injected Provider - Metamask' provided by Remix.

If ENVIRONEMNT is selected as 'Injected Provider - MetaMask', it is connected to MetaMask, which requires the network to be 'WEMIX\_Testnet' connection.\
\
For more information about MetaMask connection, see[ Use MetaMask](broken://pages/lcW7vMWroYdYoNa8ss2D).

<figure><img src="/files/TFUqde94gwh5gga4kxIh" alt=""><figcaption><p>Setting Delpoying Envrionment</p></figcaption></figure>

### **Step 5 : Set Gas Fee and Sign at MetaMask**

After setting on the Deploy & Run Transactions, if you select 'deploy' button, the MetaMask pop-up appears. The screen showing 'Gas Fee' based on Ethereum will be displayed as shown below.

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change t the Gas Fee.

<figure><img src="/files/dtVluo2hzjIQ2fJM8w9g" alt=""><figcaption><p>MetaMask, default 'Gas fee'</p></figcaption></figure>

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/IEdN7qPLF1U77oTUHxaq" alt=""><figcaption><p>MetaMask default 'Gas Fee' setting entry screen</p></figcaption></figure>

<figure><img src="/files/w6eO1qtJvzCxRIu58UE4" alt=""><figcaption><p>'Gas Fee' setting</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Complete the Fee setup in the figure above and select 'Save' to be ready for deployment as shown below.

<figure><img src="/files/CCWJBqvLgXNLWU57ZCHG" alt=""><figcaption><p>Confirm Example ERC-721 Deployment</p></figcaption></figure>

Select 'Confirm' in the figure above to proceed with the contract deployment.&#x20;

If a green check mark appears at the bottom of the Remix screen as shown below, the delpoyment is completed normally.

<figure><img src="/files/stn2wCx0LBjfZdfYYnWo" alt=""><figcaption><p>Complete Example ERC-721 Deployment</p></figcaption></figure>


# Minting ERC-721 Token

It is possible to proceed a Minting ERC-721 using Remix.

ERC-721 contracts must be deployed in advance. Please refer to [Write ERC-721 Contract](/en/tutorial/erc-721-token/write-erc-721-contract) for ERC-721 Contract deployment.&#x20;

{% hint style="danger" %}
Caution

Once deployed contracts cannot be modified or deleted. \
Please write and deploy the necessary information in the code.
{% endhint %}

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

### Minting

You can see the contents of the deployed contract in the 'Deployed Contracts' section on the screen where the ERC-721 contact has been deployed.&#x20;

Select 'mintNFT' to enter the recipient, token URL.

<figure><img src="/files/Y2d671y2EfkP0QHOvBmF" alt=""><figcaption><p>mintNFT</p></figcaption></figure>

{% hint style="info" %}
**Exmaple of token URL**

<https://2865074520-files.gitbook.io/\\~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlgX3Uok5fQZcz5UtMhgi%2Fuploads%2Fb0lcXNM4MjmcQgY1kn1K%2Fgyeongbok\\_palace.png?alt=media\\&token=4bbc41b2-b7df-40f3-9fbc-e028268034b5>
{% endhint %}

When you select 'transact' after entering recipient and token URL, a MetaMask pop-up appears and a screen showing the default 'Gas Fee' based on Ethereum appears.

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change the Gas Fee.

<figure><img src="/files/R04VKkLQvbnyb7bhCB0d" alt=""><figcaption><p>MetaMask, default 'Gas fee'</p></figcaption></figure>

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/h0Zhs14A1Z2aEOU3iYcx" alt=""><figcaption><p>MetaMask default 'Gas Fee' setting entry screen</p></figcaption></figure>

<figure><img src="/files/flFLjkOD2KQj4nCVvFWc" alt=""><figcaption><p>'Gas Fee' setting</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Complete the Fee setup in the figure above and select 'Save' to be ready for Minting as shown below.

<figure><img src="/files/dJTAdbW2aTwzn47Zlggd" alt=""><figcaption><p>Confirm Minting ERC-721</p></figcaption></figure>

Select 'Confirm' in the figure above to complete Minting ERC-721 Token.&#x20;

If a green check mark appears at the bottom of the Remix screen as shown below, the Minting ERC-721 Token is completed.

<figure><img src="/files/AYUVKMjypvuIbwQSx37b" alt=""><figcaption><p>Complete Minting ERC-721</p></figcaption></figure>

Copy the transaction hash that appears as a result of the run, and search in [Testnet Explorer](https://explorer.test.wemix.com/), to confirm that the NFT has been issued in [Testnet Explorer](https://explorer.test.wemix.com/).

The figure below is an example of what [Testnet Explorer](https://explorer.test.wemix.com/) has seen.

<figure><img src="/files/ofApX9JRMMtoKb3yWkTF" alt=""><figcaption><p>Check TxHash at WEMIX3.0 Testnet Explorer</p></figcaption></figure>

Selecting a deployed NFT name on the 'NFT List' page of the NFTs tab in [Testnet Explorer](https://explorer.test.wemix.com/) will take you to the NFT Details page.&#x20;

Select the 'Inventory' tab on the screen to see the Minted Wallet address and token URL.

<figure><img src="/files/GfpFo0zyA2LkM0hT9Tvj" alt=""><figcaption><p>WEMIX3.0 Testnet Explorer Token Inventory</p></figcaption></figure>


# Check ERC-721 Token API

You can query the ERC-721 Token API using Postman.&#x20;

Let's check the inventory for Contract Address in the ERC-721 API in the following order.

* Step 1 : Access Postman
* Step 2 : Execute API and Check the results

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

### Step 1 : Access Postman

Go to <https://www.postman.com/> and install Postman.\
After accessing Postman, move to 'Workspaces'.

Select the 'Import' button to insert the  `WEMIX3.0 API.json` file to launch the WEMIX3.0 API.

<figure><img src="/files/oHZMv8LmtMOzIC0jRz35" alt=""><figcaption><p>Postman My Workspace</p></figcaption></figure>

<figure><img src="/files/39LgMDCsMsRErpjMERxF" alt=""><figcaption><p>Execute Postman WEMIX3.0 API</p></figcaption></figure>

### Step 2 : Execute API and Check the result

Select the WEMIX 3.0 ERC-721 API to view the ERC-721 token you want.

#### **Check the Inventory for Contract**

{% tabs %}
{% tab title="Mainnet" %}
<https://explorerapi.wemix.com/v1/tokens/{contract\\_address}/inventory>
{% endtab %}

{% tab title="Testnet" %}
<https://explorerapi.test.wemix.com/v1/tokens/{contract\\_address}/inventory>
{% endtab %}
{% endtabs %}

Enter the URI above in the input box next to 'Get'.&#x20;

You can enter the contract address you want in the {contract\_address} of the URI.&#x20;

The figure below is an example of checking the Testnet ERC-721 token.

```
https://explorerapi.test.wemix.com/v1/tokens/0x3DDeE3714160A49573285473f40452cec67114B4/inventory
```

<figure><img src="/files/kc9Tc0ovWyikFaWXgnrl" alt=""><figcaption><p>Execute API to Check Inventory for Contract</p></figcaption></figure>

If you select 'Send', you can see that the output is the same as the data found in [Testnet Explorer](https://explorer.test.wemix.com/).

<figure><img src="/files/iDtdoRsHNJ1GEBBSVByl" alt=""><figcaption><p>Check Inventory for Contract</p></figcaption></figure>

<figure><img src="/files/Wko2hY0YrNZf8gECBcx7" alt=""><figcaption><p>WEMIX3.0 Testnet Explorer Token Inventory</p></figcaption></figure>


# Burn ERC-721 Token

It is possible to proceed an ERC-721 Token burning test using Remix.

{% hint style="info" %}
All examples are based on WEMIX3.0 Testnet.
{% endhint %}

Let's proceed with the ERC-721 token burning process.

[Write ERC-721 Contract](/en/tutorial/erc-721-token/write-erc-721-contract) and [Minting ERC-721 Token](/en/tutorial/erc-721-token/minting-erc-721-token) should proceed first.

## Burn ERC-721 Token

To burn a Minted ERC-721 Token, enter the issued TokenID. After then, the ERC-721 Token will be burned.&#x20;

You can see the deployed contracts in the Deployed Contracts section of the ERC-721 Contract Deployment and Minting screen.&#x20;

Select 'burn' to enter TokenID.&#x20;

The figure below shows an example of Token ID 1 being burned.

<figure><img src="/files/nCHV82N6SD6RxuwiQpo3" alt=""><figcaption><p>Burning Token ID 1</p></figcaption></figure>

When you select 'transact' after entering TokenID, a MetaMask pop-up appears and a screen showing the default 'Gas Fee' based on Ethereum appears.

<figure><img src="/files/uZjNPs42kCTLJqJnDkjd" alt=""><figcaption><p>MetaMask, default 'Gas fee'</p></figcaption></figure>

WEMIX has a different fee policy than Ethereum, so press the 'Site suggested' button to change t the Gas Fee.

Selecting 'Advanced' on the screen below allows the user to set 'Max priority fee (GWEI)' and 'Max fee (GWEI)' manually.

<figure><img src="/files/atQ6uB2TGZHJQMgl6wFY" alt=""><figcaption><p>MetaMask default 'Gas Fee' setting entry screen</p></figcaption></figure>

<figure><img src="/files/yFxWgrCmECMQvEYmj40n" alt=""><figcaption><p>'Gas Fee' setting</p></figcaption></figure>

Currently, WEMIX is using a fixed 'Max priority fee (GWEI)' and the value is 100.&#x20;

Max fee is a user-defined value and the minimum value is MaxPriorityFee+BASE\_FEE.&#x20;

BASE\_FEE in WEMIX is variable according to EIP-1559. Therefore, for a transaction to be successfully created, it is recommended to set it as follows.

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

Complete the Fee setup in the figure above and select 'Save' to be ready for burning Token as shown below.

<figure><img src="/files/lPxoFygiE5boqZki9IsP" alt=""><figcaption><p>Confirm ERC-721 Token burning </p></figcaption></figure>

Select 'Confirm' in the figure above to burn ERC-721 Token.

If a green check mark appears at the bottom of the Remix screen as shown below, the burning  ERC-721 Token is completed normally.

<figure><img src="/files/UwY9VZLAuldXrrzX0arb" alt=""><figcaption><p>Complete ERC-721 Token burning</p></figcaption></figure>

Copy the transaction hash that appears as a result of the run, and search in [Testnet Explorer](https://explorer.test.wemix.com/), to confirm that the ERC-721 Token has been burned.

The figure below is an example of what [Testnet Explorer](https://explorer.test.wemix.com/) has seen.

<figure><img src="/files/Xuvo833SKAlE0nPl4kUI" alt=""><figcaption><p>Before burning TokenID 1</p></figcaption></figure>

<figure><img src="/files/lxhcawtp4bKjLYCwmmTM" alt=""><figcaption><p>After burning TokenID 1</p></figcaption></figure>


# Use Fee Delegation

Fee Delegation Transaction is a service where the feePayer pays the fee for the transaction that the Sender wants to execute. This is done by adding the feePayer's signature to the existing transaction information signed by the Sender and sending it.

Fee Delegation Transaction only supports the DynamicFeeTxType among the existing transactions signed by the Sender and does not support LegacyTxType or AccessListTxType.

<table><thead><tr><th width="294">Tx Type</th><th>Tx Type supported with fee delegation</th></tr></thead><tbody><tr><td>LegacyTxType</td><td>No</td></tr><tr><td>AccessListTxType</td><td>No</td></tr><tr><td>DynamicFeeTxType</td><td>Yes</td></tr></tbody></table>

### Examples using CURL command

Firstly, create raw data of DynamicFeeTxType(0x02) transaction using personal\_signTransaction method.

```
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"personal_signTransaction","params":[{"from":"0xc3e44aac2d0457942baffa1dc3be313bc8d65627","to":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f","nonce":"0x1c","value":"0xDE0B6B3A7640000","maxPriorityFeePerGas":"0x174876E801","maxFeePerGas":"0x174876E801","gas":"0x5208"},""],"id":1}' http://127.0.0.1:8588

result: {"jsonrpc":"2.0","id":1,"result":{"raw":"0x02f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f","tx":{"type":"0x2","nonce":"0x1c","gasPrice":null,"maxPriorityFeePerGas":"0x174876e801","maxFeePerGas":"0x174876e801","gas":"0x5208","value":"0xde0b6b3a7640000","input":"0x","v":"0x0","r":"0xb4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32c","s":"0x82427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f","to":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f","chainId":"0x458","accessList":[],"hash":"0x80411634325036fe33e49104b1689f8d3ed92e2521ecfd058b26275b51471d70"}}}
```

Secondly, create raw data of fee delegation transaction using personal\_signRawFeeDelegateTransaction method (which is added to support fee delegation transaction).

```
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"personal_signRawFeeDelegateTransaction","params":[{"feePayer":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f"},"0x02f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f","test"],"id":1}' http://127.0.0.1:8588

result: {"jsonrpc":"2.0","id":1,"result":{"raw":"0x16f8d0f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f94db8408bb47bf5e745fed00fc2c99e2f4e1a9270f80a0ba376dff9a2a4344a570367c94eeee2434a0e44ccf2da900f54becc6adaf0b5ca077b7d15ab7ba7213b5189094ca1bd41c7a48390767e4acb14c98f3442e561abb","tx":{"type":"0x17","nonce":"0x1c","gasPrice":null,"maxPriorityFeePerGas":"0x174876e801","maxFeePerGas":"0x174876e801","gas":"0x5208","value":"0xde0b6b3a7640000","input":"0x","v":"0x0","r":"0xb4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32c","s":"0x82427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f","to":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f","chainId":"0x458","accessList":[],"hash":"0x19b5e90deb03cd4b87aca41ca09dcfed5e7c7ad33e6579f30f7efba722c54424","feePayer":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f","fv":"0x0","fr":"0xba376dff9a2a4344a570367c94eeee2434a0e44ccf2da900f54becc6adaf0b5c","fs":"0x77b7d15ab7ba7213b5189094ca1bd41c7a48390767e4acb14c98f3442e561abb"}}}
```

Finally, send signed fee delegation transaction to blockchain.

```
curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0x17f8d0f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f94db8408bb47bf5e745fed00fc2c99e2f4e1a9270f80a0ba376dff9a2a4344a570367c94eeee2434a0e44ccf2da900f54becc6adaf0b5ca077b7d15ab7ba7213b5189094ca1bd41c7a48390767e4acb14c98f3442e561abb"],"id":1}' http://127.0.0.1:8588

result: {"jsonrpc":"2.0","id":1,"result":"0x19b5e90deb03cd4b87aca41ca09dcfed5e7c7ad33e6579f30f7efba722c54424"}
```

#### personal\_signRawFeeDelegateTransaction method

* parameters

```
fee delegation data : {"feePayer":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f"},

DynamicFeeTxType raw data : "0x.....",

feePayer wallet passwd : "test"
```

* result

```
fee delegation transaction raw data : "0x..."
```

### Examples using gwemix console

Firstly, create raw data of DynamicFeeTxType(0x02) transaction using personal.signTransaction function.

```
$ bin/gweimx.sh console
> personal.signTransaction({"from":"0xc3e44aac2d0457942baffa1dc3be313bc8d65627","to":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f","nonce":"0x1c","value":"0xDE0B6B3A7640000","maxPriorityFeePerGas":"0x174876E801","maxFeePerGas":"0x174876E801","gas":"0x5208"})

{
  raw: "0x02f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f",
  tx: {
    accessList: [],
    chainId: "0x458",
    gas: "0x5208",
    gasPrice: null,
    hash: "0x80411634325036fe33e49104b1689f8d3ed92e2521ecfd058b26275b51471d70",
    input: "0x",
    maxFeePerGas: "0x174876e801",
    maxPriorityFeePerGas: "0x174876e801",
    nonce: "0x1c",
    r: "0xb4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32c",
    s: "0x82427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f",
    to: "0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f",
    type: "0x2",
    v: "0x0",
    value: "0xde0b6b3a7640000"
  }
}
```

Secondly, create raw data of fee delegation transaction using personal.signTransaction function (which is added to support fee delegation transaction).

```
$ bin/gweimx.sh console
> personal.signRawFeeDelegateTransaction({"feePayer":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f"},"0x02f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f","test")

{
  raw: "0x16f8d0f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f94db8408bb47bf5e745fed00fc2c99e2f4e1a9270f80a0ba376dff9a2a4344a570367c94eeee2434a0e44ccf2da900f54becc6adaf0b5ca077b7d15ab7ba7213b5189094ca1bd41c7a48390767e4acb14c98f3442e561abb",
  tx: {
    accessList: [],
    chainId: "0x458",
    feePayer: "0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f",
    fr: "0xba376dff9a2a4344a570367c94eeee2434a0e44ccf2da900f54becc6adaf0b5c",
    fs: "0x77b7d15ab7ba7213b5189094ca1bd41c7a48390767e4acb14c98f3442e561abb",
    fv: "0x0",
    gas: "0x5208",
    gasPrice: null,
    hash: "0x19b5e90deb03cd4b87aca41ca09dcfed5e7c7ad33e6579f30f7efba722c54424",
    input: "0x",
    maxFeePerGas: "0x174876e801",
    maxPriorityFeePerGas: "0x174876e801",
    nonce: "0x1c",
    r: "0xb4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32c",
    s: "0x82427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f",
    to: "0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f",
    type: "0x16",
    v: "0x0",
    value: "0xde0b6b3a7640000"
  }
}
```

Finally, send signed fee delegation transaction to blockchain using eth.sendRawTransaction function.

```
$ bin/gweimx.sh console
> eth.sendRawTransaction('0x16f8d0f8768204581c85174876e80185174876e80182520894db8408bb47bf5e745fed00fc2c99e2f4e1a9270f880de0b6b3a764000080c080a0b4dc96b4580bd1d3f090b953ea3612625dd834af8e7cc6146def84a0c137b32ca0082427bf3a4589ffe79bebad9151ece587790462cd44abdd810abe0016134b8f94db8408bb47bf5e745fed00fc2c99e2f4e1a9270f80a0ba376dff9a2a4344a570367c94eeee2434a0e44ccf2da900f54becc6adaf0b5ca077b7d15ab7ba7213b5189094ca1bd41c7a48390767e4acb14c98f3442e561abb')

0x19b5e90deb03cd4b87aca41ca09dcfed5e7c7ad33e6579f30f7efba722c54424
```

#### personal.signRawFeeDelegateTransaction() RPC

* parameters

```
fee delegation data : {"feePayer":"0xdb8408bb47bf5e745fed00fc2c99e2f4e1a9270f"},

DynamicFeeTxType raw data : "0x.....",

feePayer wallet passwd : "test"
```

* result

```
fee delegation transaction raw data : "0x..."
```

### Examples using JavaScript

To send fee delegation transaction, we provide two utility modules (FeeDelegateDecode.js and FeeDelegateEncode.js). And these will need web3.js and ethereumjs-util.js libraries.

Firstly, install node js.\
<https://nodejs.org/ko/download>

Secondly, install web3.js and ethereumjs-util.js using npm.

```
npm install web3; npm install ethereumjs-util;
```

Thirdly, save FeeDelegateDecode.js,FeeDelegateEncode.js and FeeDelegateSampleCode.js in same directory.

Finally, execute FeeDelegateSampleCode.js using node command.

{% hint style="danger" %}
**Caution**

You must prepare available wallet address and private key, and deposit corresponding amount of WEMIX in advance.
{% endhint %}

```
$ node FeeDelegateSampleCode.js

{
  messageHash: '0x6ab99cdbd98c40435e3b5a3d6626f9ca7af8921ffd6e9641b445a3e1dcf0b660',
  v: '0x1',
  r: '0x3ede6c943ae3ef85fac0cfedb084bc809188af4568eadc910c890d8d4019ce86',
  s: '0x4816f2b9de89beb71d58d364cc39ebd134fbff2e96652aa6a9343c33aa7d22e5',
  rawTransaction: '0x02f8718204588085174876e80185174876e801830186a09482667998ae5fd9e4f4637fc805e97740c673c51782010080c001a03ede6c943ae3ef85fac0cfedb084bc809188af4568eadc910c890d8d4019ce86a04816f2b9de89beb71d58d364cc39ebd134fbff2e96652aa6a9343c33aa7d22e5',
  transactionHash: '0xef161a11f427548a0866e83860dd9f9d181a19cf53f1172ab327ae15fabba763'
}
decodeRLP= 0x02
Unsigned FDDTx= {
  chainId: 1112,
  nonce: 0,
  maxPriorityFeePerGas: '0x174876e801',
  maxFeePerGas: '0x174876e801',
  gas: '0x0186a0',
  to: '0x82667998ae5fd9e4f4637fc805e97740c673c517',
  value: '0x0100',
  data: '0x',
  accessList: [],
  v: <Buffer 01>,
  r: <Buffer 3e de 6c 94 3a e3 ef 85 fa c0 cf ed b0 84 bc 80 91 88 af 45 68 ea dc 91 0c 89 0d 8d 40 19 ce 86>,
  s: <Buffer 48 16 f2 b9 de 89 be b7 1d 58 d3 64 cc 39 eb d1 34 fb ff 2e 96 65 2a a6 a9 34 3c 33 aa 7d 22 e5>,
  feePayer: '0xab046cC2e871aF34898DD45C5B7F3754B76470BC'
}
....
....
```

Please refer to the following for details.

* sample code : FeeDelegateSampleCode.js
* git : <https://github.com/wemixarchive/feedelegation-js>
* go-wemix : <https://github.com/wemixarchive/go-wemix>


# Manual

This section covers how to use WEMIX 3.0 Explorer and WEMIX Wallet.

## Explorer

WEMIX3.0 Explorer is an explorer for checking block information on a WEMIX3.0 network. By monitoring the block and transaction status of the WEMIX3.0 network, you can check the information and status that occurs in the blockchain. You can also check information about tokens, NFTs, and Balance.

* WEMIX3.0 Mainnet Explorer: [https://explorer.wemix.com](https://explorer.wemix.com/)
* WEMIX3.0 Testnet Explorer: <https://explorer.test.wemix.com/>

### What is WEMIX3.0 Explorer?

WEMIX3.0 Explorer is a block explorer for the WEMIX3.0 blockchain. Explorer is essentially a search engine that allows users to easily check, see and validate transactions that occur on the WEMIX3.0 blockchain. Our mission is to promote blockchain transparency by allowing all transactions in the WEMIX3.0 blockchain to be indexed and searched in the most transparent and accessible manner. WEMIX3.0 Explorer is not a wallet service provider, does not store your private key, and cannot control transactions occurring over the WEMIX3.0 network. It also provides a load-balanced API services that can be used to build distributed applications or use as data feeds for WEMIX3.0 blockchain information.

### WEMIX3.0 Explorer Information <a href="#about-wemix-explorer" id="about-wemix-explorer"></a>

With WEMIX3.0 Explorer, users can obtain a variety of information related to transactions with specific blockchain and wallet addresses. If you look at the details, you can see the amount, transaction status, the sending address of the funds, and the receiving address associated with a typical transaction. WEMIX 3.0 Explorer acts as a search engine that displays information about the status of the blockchain to date. Explorer helps users easily see all transactions on the WEMIX3.0 blockchain. It also provides easy access to information related to blocks, transactions, and wallets (accounts). Here are the key reasons for using WEMIX3.0 Explorer.

1. Transparency can be provided by allowing users to check balances and expenditures of smart contract addresses.&#x20;
2. You can validate your wallet address before sending your cryptocurrency.&#x20;
3. You can check whether the transaction was properly transferred to the recipient.&#x20;
4. You can view information about transactions in processing / confirmed / failed.

### WEMIX3.0 Explorer Features <a href="#wemix-explorer-features" id="wemix-explorer-features"></a>

WEMIX3.0 Explorer provides the following features. &#x20;

* WEMIX3.0 transaction history &#x20;
* Search and Check a Block
* Search and Check a Transaction
* Token Information
* NFT Information
* WEMIX Balance
* Open API
* Verify Message Signature
* Verify Contract Code
* Broadcast Raw Transaction &#x20;

## Wallet

WEMIX Wallet is a decentralized wallet based on WEMIX3.0 blockchain. As the sole owner of the wallet, your valuable assets are managed safely and transparently.

### What is WEMIX Wallet?

WEMIX Wallet is a secure and transparent decentralized wallet that can manage cryptocurrencies issued by WEMIX3.0 blockchain. WEMIX Wallet allows users to manage the private key of the wallet as the main subject and can be used directly by connecting with various services in the WEMIX ecosystem. It manages various tokens in the ecosystem and provides checking and transferring service for the tokens you have.

### WEMIX Wallet Features <a href="#wemix-explorer-features" id="wemix-explorer-features"></a>

WEMIX App Wallet provides the following features. &#x20;

* Create and Restore Wallet
* Check Coin/Token Information
* Send and Exchange Coin/Token
* Check Transaction History
* Check and Send NFT
* Connect Wallet, Transfer Coin/Token, Approval of Signature Request

WEMIX Web Wallet provides the following features. &#x20;

* Manage Account and Key    &#x20;
* Manage Assets(Tokens)
* WEMIX Faucet of WEMIX3.0 Testnet


# Explorer

## Home Screen

### Description

This is the main screen of WEMIX Explorer. You can check block, transaction, node operation, WEMIX price information, etc.

<figure><img src="/files/CWoOMYHKENUE9DOy2qjZ" alt=""><figcaption><p>Home screen</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.

STEP 2: The WEMIX Explorer Dashboard is displayed on the home page.

### How to use

The main screen contains information about the height of the block, the total number of transactions, the number of wallet creations, the node operation status, transaction details, average TPS, average block creation time, and WEMIX price.

* WEMIX Price: Current WEMIX Price
* WEMIX$ Price: Current WEMIX$ Price
* Market Cap(WEMIX) : Total Market value of a WEMIX’s circulating supply
* Volume 24h(WEMIX) : WEMIX 24hour volume(CoinMarketCap+WEMIXFi)
* Total Supply(WEMIX3.0): WEMIX Total Supply
* Current Circulating(WEMIX): WEMIX Current Circulating
* Total Blocks: Block height
* Total Transactions: Total number of transactions
* Total Address: Total number of wallet address
* Total Nodes: The state of 40 nodes generating blocks
* Gas Price: Current gas price
* Avg TPS: Average TPS
* Avg Block Time: Average block creation time
* Latest Blocks: Recent blocks
* Latest Transactions: Recent transactions

## **Lookup for block** <a href="#lookup-for-block" id="lookup-for-block"></a>

### Description <a href="#description-1" id="description-1"></a>

This feature allows user to search for block by block's height.

<figure><img src="/files/q7AlvSW9Bo1fH0FYX5Ey" alt=""><figcaption><p>Home screen (block lookup)</p></figcaption></figure>

### **How to access** <a href="#how-to-access-1" id="how-to-access-1"></a>

STEP 1: Open WEMIX Explorer.

STEP 2: Search block information using the search engine at the top left corner.

### How to use <a href="#how-to-use-1" id="how-to-use-1"></a>

STEP 1: Copy height of block.

STEP 2: Paste height of block to the search box.

STEP 3: Web UI will redirect to the search result page.

<figure><img src="/files/MnNzOc7RlqvZeaFJfPjS" alt=""><figcaption><p> a block already exists in blockchain</p></figcaption></figure>

<figure><img src="/files/x9RQQKfe1k2gEXEmT8tt" alt=""><figcaption><p>Otherwise</p></figcaption></figure>

## **View blocks**

### Description

This feature allows users to view all blocks with matching URL.

<figure><img src="/files/uju1RFf9mePFMQesRehQ" alt=""><figcaption><p>Block list</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.

STEP 2: Click on Blocks in the Web UI navigation.

STEP 3: Web UI will redirect to Blocks.

### How to use

This web UI shows a table of blocks on WEMIX sorted by time. At the top of the table, a title shows the selected block's height and the total blocks matching the URL filter. The table shows 25 records by default. Each record is a WEMIX block. This table has nine columns:

* Height: The position of this block in WEMIX Blockchain.
* Age: The time when the block was introduced.
* Txn: The number of transactions in this block.
* Miner: The address of miner that completed mining process and introduce this block.
* GasUsed: Total amount of Gas that used for mining this block.
* GasLimit: Total amount of Gas that provided for mining this block.
* Base Fee: Block's base fee.
* PMR: PMR(Permanent Minting Reward) is WEMIX, newly minted as a reward for every block.
* Priority Fees: Priority fees are charges that determine the priority of transaction processing.
* Burnt Fees: Total amount of fees burned in the block.

## **Block details**

### Description

This feature allows users to view the details of the block.

<figure><img src="/files/FXoYWcRZlCdMb9zLOUVi" alt=""><figcaption><p>Details Block information</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.

STEP 2: Click on Blocks in the Web UI navigation.

STEP 3: Web UI will redirect to Blocks.

STEP 4: Click on {block's height}.

STEP 5: Web UI will redirect to the Block details.

### How to use

This Web UI shows information of blocks with matching URL id param. Each block contains 14 fields:

* Height: The position of this block in WEMIX Blockchain.
* Age: The time when this block was introduced.
* Transactions: The number of transactions in this block.
* Hash: The hash of this block.
* Parent Hash: The hash of the previous block.
* Mined By: The address of miner that completed mining process and introduce this block.
* Size: The size of this block in data storage.
* Gas Used: Total amount of Gas that used for mining this block.
* Gas Limit: Total amount of Gas that provided for mining this block.
* Base Fee Per Gas: Block's base fee.
* Priority Fees: Priority fees are charges that determine the priority of transaction processing.
* Burnt Fees: Total amount of fees burned in the block.
* Nonce: This blocks's nonce.
* PMR: PMR(Permanent Minting Reward) is WEMIX, newly minted as a reward for every block.
* Block Reward: Amount of WEMIX reward for miner who introduces this block.
* Extra Data: This blocks's extra data.

## **Lookup for transaction** <a href="#lookup-for-transaction" id="lookup-for-transaction"></a>

### Description <a href="#description-4" id="description-4"></a>

This feature allows users to search transactions by transaction hash.

<figure><img src="/files/lxSqEZbEPFOCOnLZIa9p" alt=""><figcaption><p>Home Screen (transaction lookup)</p></figcaption></figure>

### **How to access** <a href="#how-to-access-4" id="how-to-access-4"></a>

STEP 1: Open WEMIX Explorer.

STEP 2: Search transaction information using the search engine at the top.

### How to use <a href="#how-to-use-4" id="how-to-use-4"></a>

STEP 1: Copy your transaction.

STEP 2: Paste transaction to the search box.

STEP 3: Web UI will redirect to the search result page.

<figure><img src="/files/tEfiXO0V6eLsZTHuMAm2" alt=""><figcaption><p>If a transaction already exists in blockchain</p></figcaption></figure>

<figure><img src="/files/zt5sq5eY9eFZ2gTN5vpR" alt=""><figcaption><p>Otherwise</p></figcaption></figure>

## **View transactions**

### Description

This feature allows users to view all transactions with matching URL.

<figure><img src="/files/Bh0nVLVIs8zW4lrtJLat" alt=""><figcaption><p>Transaction list</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.

STEP 2: Click on Transactions and "View Txns" in the Web UI navigation.

STEP 3: Web UI will redirect to TRANSACTION page.

### How to use

This Web UI shows a table of transactions on WEMIX transactions sorted by time. At the top of the table, a title shows the total transactions matching the URL filter. The table shows 50 records by default. Each record is a WEMIX transaction. This table has seven columns:

* TxHash: This is transaction's hash.
* Block: The height of block which this transaction belongs to.
* Age: The time when this transaction was appeared on the WEMIX Network.
* From: The address that performed this transaction.&#x20;
* To: The address that received this transaction's value.
* Value: The value transfer in this transaction.
* TxFee: Remittance fee

## **Transaction details**

### Description

This feature allows users to view the details of the transaction.

<figure><img src="/files/hZfaAApeVi5QulYVK1kS" alt=""><figcaption><p>Transaction details</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.

STEP 2: Click on Transactions and "View Txns" in the Web UI navigation.

STEP 3: Web UI will redirect to TRANSACTIONS.

STEP 4: Click on {TxHash}.

STEP 5: Web UI will redirect to the Transaction details.

### How to use

This web UI shows information of transactions with matching URL id param. Each transaction contains 15 fields:

* TxHash: The hash of the transaction's data.
* TxReceipt Status: The status of the transaction.
* Block Height: The height of block which this transaction belongs to.
* TimeStamp: The first time when this transaction was appeared on the WEMIX Network.
* From: The address that performed this transaction.
* To: The address that received this transaction's value.
* Value: The value transfer in this transaction.
* Gas Limit: Total amount of Gas that provided for confirming this transaction.
* Gas Used By Txn: Total amount of Gas that used for confirming this transaction.
* Gas Price: The Gas price used for confirming this transaction.
* Gas Fees: Base fee | Fee paid | Rewards for Miners.
* Burnt & Txn Savings Fees: Amount of WEMIX burned | Quantity of WEMIX excluding fees.
* Actual Tx Cost/Fee: Remittance fee
* Nonce & Position: This transaction's nonce and the position of this transaction in block.
* Input Data: This transaction's input data.

## **View Token list**

### Description

The Updated Tokens tab displays a list of tokens with token information entered through "Updated Token Information". Other tokens can be viewed on the Not Updated Tokens tab.

<figure><img src="/files/LqMdiROD6FY0yZWC4HRm" alt=""><figcaption><p>Token list</p></figcaption></figure>

<figure><img src="/files/SpU0ESXX7e76kf65Pfu1" alt=""><figcaption><p>Otherwise</p></figcaption></figure>

### **How to access**

STEP 1: Connect to WEMIX Explorer.

STEP 2: Click Tokens tab and select "Token list" from the Web UI navigation.

STEP 3: Select Updated Tokens tab or Not Updated Tokens tab.

STEP 4: The Web UI will be redirected to the selected page.

### How to use

The Web UI displays information of tokens issued on the WEMIX Blockchain. Each token has 6 data fields.

* \#: Token sorting order
* Name: Name of token
* Symbol: Symbol of token
* Contract Address: Registered token contract address
* Total Supply: Total supply of the token
* Total Transfers: The total amount of the tokens transferred

## **View Token transfers**

### Description

This feature allows users to view the transactions of tokens.

<figure><img src="/files/sDGLfnmAuhOPeqpBZSWk" alt=""><figcaption><p>Token Transfer</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer

STEP 2: Click on Tokens and "Token Transfer" in the Web UI navigation.

STEP 3: Web UI will redirect to TOKENS.

### How to use

This Web UI displays all transaction information for tokens issued by the WEMIX blockchain. Each transaction has seven fields.

* TxHash: Transaction hash
* Block: The height of the block to which the transaction belongs
* Age: The time the transaction was displayed on the WEMIX network
* From: Address where the transaction was made
* To: Address where the value of the transaction was received
* Token: The type of token generated in the transaction
* Value: The value transfer in this transaction.

## **View NFT list**

### Description

The Updated NFTs tab displays a list of NFTs with token information entered through "Updated Token Information". Other NFTs can be viewed on the Not Updated NFTs tab.

<figure><img src="/files/XsFYgSAU0OGsP2nkHgU3" alt=""><figcaption><p>NFT list(Updated NFTs)</p></figcaption></figure>

<figure><img src="/files/tGKATILten821DNdIxz9" alt=""><figcaption><p>Otherwise</p></figcaption></figure>

### **How to access**

STEP 1: Connect to the WEMIX Explorer.

STEP 2: Click the NFTs tab and select "NFT List" in the Web UI navigation.

STEP 3: Select Updated NFTs tab or Not Updated NFTs tab.

STEP 4: The Web UI will be redirected to the selected page.

### How to use

This Web UI displays all the NFT information published by the WEMIX blockchain. Each NFT has 6 fields.

* \#: NFT sort order
* Name: NFT name
* Symbol: NFT symbol
* Contract Address: Registered NFT contract address
* Total Transfers: Total transfer amount of the corresponding NFT

## **View NFT transfers**

### Description

This feature allows users to view all transactions in the NFT transfer.

<figure><img src="/files/ch81o8oIoLILgNAELALZ" alt=""><figcaption><p>NFT transfer list</p></figcaption></figure>

### **How to access**

STEP 1: Connect to the WEMIX Explorer.

STEP 2: Click the NFTs tab and select "NFT Transfer" in the Web UI navigation.

STEP 3: Web UI redirects to NFT transaction page

### How to use

This Web UI displays all transaction information for NFTs issued by the WEMIX blockchain. Each transaction has seven fields.

* TxHash: Transaction hash
* Block: The height of the block to which the transaction belongs
* Age: The time the transaction was displayed on the WEMIX network
* From: Address where the transaction was made&#x20;
* To: Address where the value of the transaction was received
* TokenID: NFT token ID
* Token: The type of NFT that occurred in the transaction

## **Lookup for address**

### Description

The feature allows user can search for address.

<figure><img src="/files/uH1RKXbn4ittfzq7XsIZ" alt=""><figcaption><p>Home screen(address lookup)</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.&#x20;

STEP 2: The search box for address searching in top of Web UI.

### How to use

STEP 1: Copy your address.

STEP 2: Enter your address to the search box.

STEP 3: Web UI will redirect to the search result page.

<figure><img src="/files/IUMfxpDuooMHhANaBKsJ" alt=""><figcaption><p>If a address already exists in blockchain</p></figcaption></figure>

<figure><img src="/files/kfdKZNmOcmPPQdDetxAq" alt=""><figcaption><p>Otherwise</p></figcaption></figure>

## **View addresses**

### Description

The feature allows user can view all addresses include contract address, external account addresses.

<figure><img src="/files/OrrYBO1N6QPqYiplhB12" alt=""><figcaption><p>Address list(Allowed Addresses)</p></figcaption></figure>

<figure><img src="/files/Dlxu3utqKOrwAtsd3khC" alt=""><figcaption><p>Otherwise</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.

STEP 2: Click to Address tab in the navigation of Web UI.

STEP 3: Select Allowed Addresses tab or Addresses tab.

STEP 4: The Web UI will be redirected to the selected page.

### How to use

In this Web UI, we provide a table that shows all WEMIX addresses and sort by amount of WEMIX that address holds. In the top of the table, a title will show you how many accounts was found and a total of WEMIX in the WEMIX Blockchain Network. You will see 50 records by default, each record is a WEMIX address. The address can be a contract address with contract icon. Otherwise it's a external account address. This table has 4 columns.

* Rank: Rank of this address.
* Address: It's this address's hash, you can click to refer to the address details.
* Balance: The number represents the amount of this address's WEMIX.
* TxCount: The number of transactions that related to this address.

## **Address details**

### Description

The feature allows user can see address details.

<figure><img src="/files/IUMfxpDuooMHhANaBKsJ" alt=""><figcaption><p>Details address</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.&#x20;

STEP 2: Click to Address tab in the navigation of Web UI.

STEP 3: Web UI will redirect to the Address page.

STEP 4: Click to {address hash}.

STEP 5: Web UI will redirect to the Address details page.

### How to use

In this Web UI, we show all information of address that it's hash match with URL id param. Each address contains 6 fields.

* Type: The type of this address - Contract or External account.
* Name Tag: Address Name.
* Balance: The number represents the amount of this address's WEMIX.
* Appear date: The first time when this address was appeared on the WEMIX Network.
* Transactions: The number of transactions that performed by this address.
* Token: All Tokens held by this address

In this Web UI, we also list all Transactions, Internal Transactions and Event Logs that belong to this address.

## **View contract internal transactions**

### Description

The feature allows user can view all internal transactions of a contract address.

<figure><img src="/files/8N3QlS3ugGPnH5Ad95QO" alt=""><figcaption><p>Contract internal transactions list</p></figcaption></figure>

### **How to access**

STEP 1: Open WEMIX Explorer.&#x20;

STEP 2: Click on Transactions and "View Contract Internal Txns” in the Web UI navigation.

STEP 3: Web UI will redirect to Contract Internal TRANSACTION page.

### How to use

In Internal Transactions tab, we provide a table that shows all WEMIX internal transactions that belongs to an address and sort by latest blocks. In the top of the table, a title will show you a total of internal transactions that match URL filter. You will see 50 records by default, each record is a internal transaction. This table has 7 columns.

* Block: The height of block which this transaction belongs to.
* Age: The time when the block was introduced on the WEMIX Network.
* Parent TxHash: The hash of transaction which this internal transaction belongs to.
* Type: The trace's type and the order of trace excuting to extract this internal transactions.
* From: The address that performed this internal transaction - the sender.
* To: The address that received this internal transaction's value.
* Value: The value transfer in this internal transaction.

## **View message signatures**

### Description

The feature allows user can view all message signatures which saved in the WEMIX block explorer system.

<figure><img src="/files/CTdU3yfCkYIuPDW5fB3t" alt=""><figcaption><p>list of message signatures</p></figcaption></figure>

### **How to access**

Step 1: Open WEMIX website.

Step 2: Click to More tab then choose "Verify Message Signature" in the navigation of Web UI.

Step 3: Web UI will redirect to the List of Message Signatures page.

### **How to use**

In this Web UI, we provide a table that shows all WEMIX messages and sort by latest saved time. In the top of the table, a title will show you how many message signatures was found, but we show only the first 500K records. You will see 50 records by default, each record is a WEMIX message signatures that user verified and saved to the system. This table has 4 columns:

* ID: Rank of this address. If you click to the View \[#ID], you would see the message signature in details.
* Address: It's hash of address that signed this message.
* Message: The number represents the amount of this address's WEMIX.
* TimeStamp: The age of message from the time it was saved.

## **Verify message signatures**

### **Description**

The feature allows user verify their message signature.

<figure><img src="/files/xNNTWf1UziSb8uAfwkGX" alt=""><figcaption><p>Verify new message signature</p></figcaption></figure>

### **How to access**

Step 1: Open WEMIX website.

Step 2: Click to More tab then choose "Verify Message Signature" in the navigation of Web UI.

Step 3: Web UI will redirect to the List of Message Signatures page.

Step 4: In List of Message Signatures page, click to Verify New Signature.

Step 5: Web UI will redirect to the Verify New Message Signature page.

### **How to use**

In this Web UI, we provide provides a form for you to enter the values needed to authenticate your message signature.

* "Step 1: Address": Paste your address which signed the message.
* "Step 2: Message Signature Hash": Paste hash of the message.
* "Step 3: Enter the original message that was signed": Paste the original message.
* "Step 4: Public/Private Setting": Set up for private or public your message signature.

Then click to *Verify this message* and wait the response from server. If the response is *"Message Signature Verified. Pass (1)!"*, it's mean you have a right message signature information.

## **Verify contract code**

### **Description**

The feature allows contract owner can verify their contract code.

<figure><img src="/files/ySZwOMhjrmpLh38nks93" alt=""><figcaption><p>Verify contract code</p></figcaption></figure>

### **How to access**

Step 1: Open WEMIX website.

Step 2: The search box for address searching in top of Web UI.

Step 3: Enter your contract address to the search box.

Step 4: Web UI will redirect to the contract details page.

Step 5: Open Code tab, then click to Verify And Publish.

Step 6: Web UI will redirect to the Verify Contract Code page.

### **How to use**

The reason for verifying contracts is to increase transparency and avoid fraud in the blockchain network. Before starting to verify and publish contract source code, please make sure:

* If your contract have multi files, you must to have the code concatenated into one file as we do not support "imports" in separate files. You can try using the Blockcat solidity-flattener or SolidityFlattery.
* If your contract compiles correctly at Remix Browser Solidity, it should also compile correctly here.
* We do not support contract verification for contracts created by another contract.
* There is a timeout of up to 45 seconds for each contract compiled. If your contract takes longer than this we will not be able to verify it.

If you make sure that have done everything above, then follow these below steps:

Step 1: If there is no contract address, you must enter your contract address.

Step 2: Set up your contract's name.

Step 3: Select version of solidity compiler.

Step 4: Select "Yes" in Optimization option if when deploy contract you enable Optimization. Otherwise, you must set it's value to "No".

Step 5: Enter your Contract Source Code.

Step 6: See the optional parameters sections, you might need to provide depending your contract.

* Provide Runs (Optimizer) if you have Runs configuration in Optimization when setting up for contract deployment.
* Provide *Constructor Arguments ABI-encoded* if your contract accept constructor parameters.
* Provide Contract Library Address which includes name of the library & corresponding address of this library in the WEMIX network, if your contract use libraries. Note that we just support up to 5 libraries.

Step 7: Please check to "Not a robot" then click to *Verify and Publish*.

If your contract source code is match, Web UI would redirect to Contract details page and open Code tab. You can see a small green tick icon on top of Code label.

## Verify Address

### **Description**

This feature allows user to set the name of the address.

<figure><img src="/files/CvjCuBUQmf3fy7MlrCsQ" alt=""><figcaption><p>Verify Address</p></figcaption></figure>

### How to access

Step 1: Open WEMIX Explorer.&#x20;

Step 2: Enter your address to the search box.

Step 3: Web UI will redirect to the address details page.

Step 4: In Address Information section, click to *Verify Address*.

Step 5: Web UI will redirect to the Verify Address page.

### How to use

Before starting to verify address, please make sure you are address owner and installed Metamask.

If you make sure that have done everything above, then follow these below steps:

Step 1: Enter the name of the address.

Step 2: Click to *Connect to Web3*. You sign the message by using Metamask. We need to make sure you are address owner.

Step 3: Select whether to display the entered name tag.

Click *Verify Address* to save your information on the server.

## **Update token information**

### **Description**

The feature allows contract owner can update the token information. This information will be saved on the WEMIX block explorer server.

<figure><img src="/files/hCS7dhESMMmVm28x0yZJ" alt=""><figcaption><p>Token information</p></figcaption></figure>

You can update token info only if you are contract owner and your contract code is verified.

### **How to access**

Step 1: Open WEMIX website.

Step 2: The search box for address searching in top of Web UI.

Step 3: Enter your contract address to the search bo&#x78;**.**

Step 4: Web UI will redirect to the contract details page.

Step 5: In Address Information section, click to *Update token info*.

Step 6: Web UI will redirect to the Update Token Information page.

### **How to use**

Before starting to 2 steps to update token info, please make sure you are contract owner and installed Metamask.

If you make sure that have done everything above, then follow these below steps:

Step 1: Click to *Connect to Web3*. We need to make sure you are contract owner. After you have signed message by using Metamask, click to Next to Step 2.

<figure><img src="/files/wdW8gb47yGVVtzafAqqM" alt=""><figcaption></figcaption></figure>

Step 2: If you are contract owner, Web UI will redirect to Step 2 then you must fill your token information in a form. The fields are as follows:

* Token's description
* Ico Start Date
* Ico End Date&#x20;
* Ico USD Price&#x20;
* Official Contact Email&#x20;
* Official Site URL&#x20;
* Link to download a 32x32png icon logo&#x20;
* Link to White paper&#x20;
* Link to CoinMarketCap&#x20;
* Link to Github
* Link to Blog
* Link to Twitter
* Link to Facebook
* Link to Reddit
* Link to Wechat
* Link to Slack
* Link to Slack
* Link to Telegram
* Link to Bitcointalk

Click *Submit* to save your information on the server.


# Wallet

## App Wallet

Provides the features of App Wallet and detailed instructions on how to use the App Wallet.

App Wallet has the features to send and exchange tokens after creating an wallet account on the user\`s mobile. The main features include managing and transferring token, exchanging among tokens, verifying transaction history, connecting with WEMIX services, and supporting contract execution. App Wallet can restore your wallet account with a secret phrase. Only you can check and manage the secret phrase, so keep it in a safe place and never share it with others.

{% embed url="<https://docs.wemix.com/v/wallet-en/manual/app-wallet>" %}

## Web Wallet

Provides the features of Web Wallet and detailed instructions on how to use the Web Wallet.

WEMIX Web Wallet allows developers to create a new account or see the information from existing accounts directly through a web browser without having to run the WEMIX node locally. WEMIX Web Wallet allows users to transfer WEMIX or tokens to another account for testing purposes.

{% embed url="<https://docs.wemix.com/v/wallet-en/manual/web-wallet>" %}


# FAQ

## What is WEMIX3.0?

WEMIX3.0 Mainnet is based on Ethereum Virtual Machine (EVM) in the Stake Base Proof of Authority (SPoA) consensus algorithm. WEMIX3.0 is a platform-centric and service-oriented open Mainnet that is developed based on leading experience. It has core requirements for blockchain networks such as decentralization, security, and scalability. It also operates reliably and efficiently through technical and business cooperation with 40 proven global node council partners, 40 WONDERS.

## What is WEMIX Coin?

WEMIX coins are virtual assets used in WEMIX3.0 Blockchain. You can send and receive WEMIX through the deposit/withdrawal function by using the wallet supported by WEMIX.

## What is Difference from WEMIX Classic?

WEMIX Classic (formerly WEMIX Token) is a digital asset issued by Klaytn Mainnet.

Since the release of WEMIX3.0 Mainnet, WEMIX Token has been renamed WEMIX Classic and is not available for WEMIX3.0 Mainnet-based services.

## What is WEMIX Wallet?

WEMIX Wallet is a secure and transparent decentralized wallet that can manage cryptocurrency issued by WEMIX3.0 Blockchain. WEMIX Wallet allows users to manage the private key of the wallet as the main subject and can be used directly by connecting with various services in the WEMIX ecosystem. It is a service that manages various tokens in the ecosystem and enables checking and transferring the token NFT you have. For more FAQ about Wallet, please refer to the  [Wallet Support Center](https://wemixwallet.zendesk.com/hc/ko).

## Lost the Private Key of the Wallet

Wallets used in WEMIX3.0 are decentralized wallets that are not owned or managed by the enterprise. Only the user can know the private key of the created wallet, and if it is lost, it cannot be recovered, so be careful not to lose it.

## Sent an asset that was not supported in WEMIX Wallet

WEMIX Wallet does not support any network other than WEMIX3.0 Mainnet.&#x20;

Incoreect tranfer of the WEMIX Classic, KLAY, and KLEVA token from the external exchange/wallet to the WEMIX wallet can be recovered through the Metamask if you have the private key of the WEMIX wallet.

**Finding a incorrectly transferred token through Metamask (Klaytn-based token incorrectly transferred)**

1. Check and copy the private key of the WEMIX Wallet via the path below.\
   WEMIX Wallet > Setting > Security Settings > Check your Private Key
2. Import the account into the Metamask via the private key of the WEMIX Wallet.\
   Metamask > Import Account > Enter your WEMIX Wallet Private Key\
   *\*Please refer to* [*the link*](https://support.metamask.io/hc/en-us/articles/360015489531-Getting-started-with-MetaMask) *for installing a meta mask and creating a wallet.*
3. Add a Klaytn network to that account.\
   Metamask > Add Network > Add Klaytn Network\
   *\*Please refer*[ *to the link* ](https://medium.com/klaytn/how-to-add-klaytn-to-metamask-b3bdd970c0e8)*for adding Klaytn network or connect Klayton Support Service (such as Klay Swap) to add network.*
4. Add WEMIX Classic, KLEVA token (Skipped for KLAY)\
   **Add WEMIX Classic Token Contract** \
   Select Token Import Menu at the bottom of MetaMask > Token Contract Address > Enter `0x5096db80b21ef45230c9e423c373f1fc9c0198dd` (`Token symbol: WEMIX`, `Token decimal: 18` are automatically enterd.) > Add Custom Token > Import Token\
   **Add KLEVA Classic Token Contract** \
   Select Token Import Menu at the bottom of MetaMask > Token Contract Address > Enter `0x5fff3a6c16c2208103f318f4713d4d90601a7313`(`Token symbol: KLEVA`, `Token decimal: 18` are automatically enterd.) > Add Custom Token > Import Token
5. Check the amount of WEMIX Classic, KLAY, and KLEVA tokens added and select Send.
6. Send WEMIX Classic, KLAY, and KLEVA by entering the wallet address that supports the Klaytn network to send. (There will be a fee to KLAY for remittance.)

## What is the Consensus Method of WEMIX3.0 Blockchain?

You can only participate in the WEMIX3.0 blockchain with agreement of the consent of Authority members who have been previously approved as a Stake Base Proof of Authority (SPoA). Also, you must stake a certain amount to participate as an Authority member.&#x20;

Leader election among Authority members is elected by the Reliable and Fault Tolerant (RAFT) algorithm. For more information, please refer to [Consensus](/en/design/consensus).

## Can I participate in WEMIX3.0 blockchain as a node?

Yes. Anyone can participate by installing a blockchain node. If you want to serve as a WEMIX3.0 network endpoint, you can join a node by installing an End Node (EN). For more information about installing End Node (EN) for node participation, please refer to [Install Guide](/en/install-and-operation/end-node/install-guide).

## Can I use Ethereum-based Tokens?

Yes. Smart contracts running on the WEMIX3.0 blockchain are implemented in Ethereum-based solidity languages. Due to the use of solidity, a Turing full-formed computer language, there are no restrictions on the logic you want to implement, because it has almost similar grammar to JavaScript, and a high degree of freedom in programming is given. For instructions on how to use it, please refer to [Smart Contract](/en/dapp-developer/smart-contract).

## Is there a Wallet that I can use on the Web?

Yes. It supports web wallets as well as app wallets, and can manage and transfer WEMIX or tokens issued by WEMIX3.0 blockchain. To learn how to configure and use WEMIX wallets, see our WEMIX Wallet documentation.

The WEMIX Web Wallet is intended for developers, not for users. The user's private key is stored on local storage in the browser, so it is vulnerable to security. Saving and transferring WEMIX and tokens via a web wallet can be dangerous.

## Is there a place where I can get a test WEMIX?

[Here](/en/quick-start/testnet-faucet) you can get Test WEMIX for development and testing purposes. Recommended for development and testing purposes only.

WEMIX received through Testnet Faucet, cannot use in WEMIX3.0 Mainnet.\
WEMIX that can use in WEMIX3.0 Mainnet need to buy in the crypto exchange.

### Help & Feedback

E-mail: <hi_there@wemix.com>


# Introduction

## WEMIX3.0 개요 <a href="#wemix3.0-overview" id="wemix3.0-overview"></a>

위메이드는 조금 다른 시각으로 세상을 봅니다: 시대가 바뀜에 따라 그에 맞게 시장을 바라보고 분석하여 실행으로 옮길 수 있는 계획을 만들어 냅니다. 그리고, 실제로 실행을 하고 결과를 만들어 내면서 궁극적으로는 위메이드가 간 길을 다른 추종자들이 따라오게 만듭니다. WEMIX1.0 & 2.0 시대를 거치면서 균형 잡힌 생태계를 만들기 위해 노력한 결과로 우리는 광범위한 지식, 데이터 그리고 경험을 획득할 수 있었습니다. 그리고 이런 것들이 위메이드가 업계와 마켓을 다시 한 번 혁신하는데 중요한 역할을 하고 있습니다. WEMIX3.0은 다가올 미래의 dApp, 게임, DAO, DeFi, NFT 등을 지원할 수 있도록 설계된 진정한 블록체인 생태계 그 자체입니다.&#x20;

* EVM-compatible Public Chain
* Stake-based Proof of Authority(SPoA) Consensus
* 40 Highly Qualified Node Council Partners(Authorities)
* Max 4,000 TPS Throughput
* PMR(Permanent Minting Reward): 0.5 WEMIX per Block&#x20;

## WEMIX3.0 생태계 <a href="#wemix3.0-ecosystem" id="wemix3.0-ecosystem"></a>

WEMIX3.0 메인넷은 SPoA(Stake-based Proof of Authority) 합의알고리즘에 EVM(Ethereum Virtual Machine)을 기반으로 합니다. 새로운 메인넷은 40개의 Node Council Partners(NCP)를 통해 탈중앙화 On-Chain Governance 기반으로 한 최상의 Security를 제공하되, 동시에 빠른 TPS를 보장합니다. USDC를 담보로 하는 WEMIX$는 dApp 생태계의 중요한 재화로서 토큰의 예측하기 힘든 가격변동성과 그로 인한 불안감을 해소하는 역할을 합니다. WEMIX$를 통해 통화의 안정성을 제공하고 그로 인해 다양한 dApp들은 생태계 내에 좀 더 안정적으로 자리잡을 수 있게 됩니다. 가격 변동에 대한 불안감을 해소하면서 WEMIX3.0은 오픈 플랫폼의 가장 이상적인 형태를 취하게 됩니다. WEMIX3.0의 중심에는 세가지 중요한 서비스가 자리 잡고 있습니다. 블록체인 게이밍 플랫폼인 WEMIX PLAY, Neith 프로토콜 기반 DAO 서비스 NILE 그리고 탈중앙화 금융서비스를 지원합니다.

## 면책조항 <a href="#disclaimer" id="disclaimer"></a>

WEMIX 블록체인은 이더리움에서 분기(fork)되었으며, 다양한 이더리움 오픈소스 프로젝트 기술들을 참고하였습니다. 실행되는 스마트 컨트랙트는 이더리움 기반의 솔리디티 언어로 구현되어, 튜링완전 형태의 컴퓨터 언어로서 자바스크립트와 유사한 문법을 가지고 있기 때문에 구현에 제약이 없고 높은 자유도를 갖는 프로그래밍이 가능합니다.

WEMIX 블록체인의 기술 스택은 기존 이더리움을 준용하여 개발되었으며, 이더리움과 동등한 EVM 및 라이브러리를 지원합니다. WEMIX의 개선 제안은 WEMIX 생태계의 구성에 따라 이더리움 개선 제안(EIP)을 충분히 수용하였으며, 일부 마이그레이션을 통한 채택이 이루어졌습니다. 이는 이더리움과 유사한 생태계를 구성함으로서 WEMIX 생태계에 참여하는 구성원이 WEMIX 블록체인에 대한 참여를 용이하게 합니다.

본 문서에 제시된 claims, contents, algorithms, roadmaps등은 본 프로젝트의 노력의 결과물이며 이 결과물로 본 소프트웨어를 사용하는 사람은 이에 적용된 모든 라이선스에 구속되고 준수하는 데 동의한 것으로 간주합니다.


# Blockchain Basics

본 장에서는블록체인에 대한 개념을 설명합니다.

* [What is Blockchain?](/ko/introduction/blockchain-basics/what-is-blockchain)
* [Consensus Algorithm](/ko/introduction/blockchain-basics/consensus-algorithm)
* [Transactions](/ko/introduction/blockchain-basics/transactions)
* [Gas](/ko/introduction/blockchain-basics/gas)
* [Account](/ko/introduction/blockchain-basics/account)

## Glossary

<figure><img src="/files/ZQh56UayXySl0yo2MKVy" alt=""><figcaption></figcaption></figure>


# What is Blockchain?

## 블록체인이란 무엇입니까?

블록체인이란 제 3자 없이도 데이터의 정합성을 수학적으로 담보할 수 있는(위·변조가 불가능한) 분산화된 공개 거래장부입니다. 분산 데이터베이스 기술로 구성되어 있으며, 합의 알고리즘에 따라 다수의 참여자 투표를 거처 의사결정을 진행합니다. 또한 해시값으로 구성된 블록들이 체인으로 연결되어 있으므로 데이터를 위·변조 하는 것은 거의 불가능에 가깝습니다.

{% hint style="success" %}

#### 블록체인에 대한 기본 메커니즘

트랜잭션 기록 → 합의(블록생성) → 이전 블록과 체인 연결  → 원장 공유
{% endhint %}

## 블록체인의 주요 특징

### 탈중앙화

* 블록체인의 기본적인 특징으로, 중앙화 되어 있는 집단이 없고 '제 3자 신뢰 기관'이 존재하지 않습니다.
* 블록체인은 다수의 참가자가 데이터를 저장하고, 증명하기 때문에 중앙 관리자가 존재하지 않습니다.
* 중앙 관리자 대신에 '스마트 컨트랙트' 라는 전자계약을 통해 개인 간 거래가 가능합니다.

### 확장성

* 공개된 소스로 인해 네트워크 참여자는 누구나 구축하고 연결 또는 확장할 수 있습니다.
* 네트워크를 통해서 데이터 공유가 필요한 시스템 간의 확장이 쉽고, API를 통한 기존 시스템과의 확대도 고려할 수 있습니다.

### 투명성

* 블록체인에 연결된 모든 거래 기록은 공개적으로 접근할 수 있습니다.
* 거래 양성화 및 보안, 감독, 규제 비용 절감이 가능합니다.

### 무결성

* 데이터가 블록에 담기고 그 블록이 체인에 연결되면 데이터를 변경하는 것은 사실상 불가능합니다.
* 블록체인에 연결된 블록들은 암호학적으로 이전 블록과 특정한 관계를 맺고 있어, 변경하고자 하는 블록 이전의 모든 블록을 변경해야만 하기 때문입니다.

## 블록체인 핵심 구성 요소

### 분산 원장

분산 원장은 블록체인에서 발생하는 모든 내역이 서로 공유되어 저장되는 데이터베이스입니다. 기존 데이터베이스에서는 데이터를 등록한 후 수정, 삭제할 수 있었지만, 블록체인에서는 한번 기록된 내역은 삭제할 수 없습니다.

### 스마트 컨트랙트

스마트 컨트랙트는 제 3의 기관 없이 코드로만 계약이 이루어질 수 있도록 하는 기술입니다. 기존 비트코인에서는 입출금 내역(UTXO: Unspent Transaction Outputs)만으로 동작하였기 때문에 단순 거래만 가능할 뿐 계약이 불가능했습니다. 하지만 스마트 컨트랙트가 등장하면서 거래뿐만 아니라 계약을 기반으로 다양한 코드가 생성됨에 따라 블록체인 생태계가 확장될 수 있었습니다.

### PKI

PKI (Public Key Infrastructure)는 보통 높은 수준의 신원 인증 시스템이라고 생각합니다. 하지만, 인증 기관 (Certificate Authority)에 따른 중앙집권적 특성으로 인해 종종 데이터 소유권 및 신뢰성에 대한 문제가 발생합니다. 그 결과, 많은 사람은 인증 기관을 신뢰할 수밖에 없습니다.

블록체인에서는 인증 기관이 존재하지 않습니다. 프라이빗 키는 사용자가 보관하고, 퍼블릭 키는 블록체인에 저장함으로써 거래할 때사용자가 소유하고 있는 프라이빗 키로 서명하고 블록체인에서는 해당 서명이 유효한지 판단합니다.


# Consensus Algorithm

## 합의 알고리즘 종류

합의 알고리즘은 참여자들이 의사결정을 통해 통일된 결정을 내리기 위한 알고리즘입니다. 블록체인에서 합의 알고리즘은 합의 모델, 합의 방식, 합의 메커니즘, 합의 프로토콜이라고도 불리며, 의사결정을 중재하는 중앙기관이 존재하지 않습니다. 이는 블록체인 데이터가 참여자 모두 동시에 같은 데이터를 가지고 있으므로 위·변조가 되지 않을 것이라는 확신에서 비롯합니다. 다른 악의적인 누군가가 데이터에 대한 위·변조를 시도한다면, 막대한 금액을 지급하면서 이전에 있던 블록에 대한 정보를 바꾸어야 합니다. 합의 알고리즘은 다수의 노드가 데이터를 상호 검증하고, 합의에 따라 올바른 블록을 생성하도록 알고리즘을 제공합니다.

### PoW (Proof of Work)&#x20;

PoW는 작업 증명 방식으로 비트코인에서 사용되는 대표적인 합의 알고리즘입니다. 채굴자가 보상을 얻기 위해서는 채굴을 통하여 블록을 생성해야 합니다. 블록 생성은 해시파워를 기준으로 판단하며, 해시파워는 빠른 시간 안에 문제를 풀 수 있는 계산 능력이 어느 정도인지 판단하는 기준입니다. 블록 생성은 가장 높은 해시파워를 제공한 노드가 블록을 생성할 수 있는 권한을 획득합니다.

### PoS (Proof of Stake)

PoS는 지분 증명 방식으로 지분을 많이 가지고 있는 노드가 블록을 생성할 수 있는 권한을 가집니다. PoW의 작업이 아닌 지분에 비례하여 블록 생성에 대한 권한이 부여됩니다. PoW의 경우 블록이 생성되는 시점에 보상이 지급되는 반면, PoS는 지분에 대한 이자로 보상받게 됩니다. 또한 지분 증명 방식은 악의적인 의도의 블록 생성을 방지하기 위해 잘못된 블록을 생성하는 경우 페널티를 부여합니다. 지분에 해당하는 코인만 있다면, 누구나 블록체인 네트워크에 참여할 수 있으므로 분산화된 환경에서 더 많은 노드가 합의 과정에 참여할 수 있습니다.

### DPoS (Delegated Proof of Stake)

DPoS는 위임 지분 증명 방식으로 지분을 가진 노드들이 투표를 통해 블록 생성자를 결정합니다. 즉, 모든 노드가 블록 생성 권한을 가지지 않고, 투표를 통해 상위 노드를 선출하여 권한을 위임하는 방식입니다. 합의된 소수의 상위 노드가 블록을 생성하기 때문에 빠른 성능과 확장성을 갖고 있습니다.


# Transactions

## 트랜잭션이란 무엇입니까?

블록체인에서 블록이 거래장부라면, 트랜잭션은 거래장부에 기록된 거래내역이라고 볼 수 있습니다. 트랜잭션은 블록체인에서 발생한 모든 거래의 기록입니다. 트랜잭션에는 거래 시간, 송수신 주소, 거래 자산, 수수료 정보 등이 기록됩니다.

## 트랜잭션 원리

트랜잭션을 발생시키더라도 즉시 거래가 이루어지는 것은 아닙니다. 블록체인에서는 검증자의 승인이 필요합니다.

<figure><img src="/files/d0wevMPlX26TYYyAMcYz" alt=""><figcaption></figcaption></figure>

Bob이 50 WEMIX(수수료 포함)를 Alice에게 전송한다고 가정해 보겠습니다. Bob은 Alice에게 50 WEMIX를 전송한다는 트랜잭션을 보냅니다. Bob의 주소에 전송할 수 있는 수량이 있는지 확인합니다. 전송할 수 있는 수량이 없다면 트랜잭션은 실패하지만, 전송 가능한  수량이 있다면 블록 생성자가 블록을 생성할 때까지 기다립니다. 블록이 생성되었을 때 Bob이 보낸 트랜잭션이 정상적으로 기록되었다면, 해당 트랜잭션을 수행합니다. Bob의 주소에 있던 100 WEMIX 중 50 WEMIX가 Alice의 지갑 주소로 전송됩니다.


# Gas

## Gas란 무엇입니까?

'Gas(가스)'는 블록체인 네트워크에서 트랜잭션을 수행하거나 스마트 컨트랙트를 실행하기 위해 지불하는 일종의 수수료입니다. 블록체인 네트워크에서 수행하는 모든 행동은 가스비용이 발생합니다. 가스비용은 컨트랙트의 복잡도와 수행 속도에 따라 달라집니다. 트랜잭션을 빨리 수행하고 싶은 경우 기본 가스비용보다 더 많은 가스비용을 지불할 수 있고, 천천히 수행해도 괜찮은 경우 기본 가스비용만 지급할 수도 있습니다.

가스비용이 중요한 이유는 네트워크에 제출된 트랜잭션이 **적절한 수수료를 지급하도록 도와주기 때문입니다.** 트랜잭션이 수행하는 각 작업에 대해 비용을 지불하도록 요구함으로써(또는 계약이 수행되도록 함으로써) 네트워크가 누구에게도 가치가 없는 집중적인 작업을 많이 수행하여 수렁에 빠지지 않도록 합니다.

## Gwei

가스비용의 단위는 Gwei로 1 WEMIX = 10억 Gwei로 계산됩니다. 트랜잭션이 발생할 때 내 가스비용은 Gwei 단위로 높을수록 블록에 먼저 기록되고, 블록 생성자가 수수료를 보상으로 받게 됩니다. 블록체인에서 최소 단위는 wei로 1 WEMIX = 10^18wei로 계산됩니다. wei의 자릿수가 많으므로 Gwei 단위로 표현하고 있습니다.&#x20;

<figure><img src="/files/CAux825aezSLOOCxHzoe" alt=""><figcaption><p>이더리움 기본 gas fee</p></figcaption></figure>

<figure><img src="/files/MqAJfcdWHyesHIftWzim" alt=""><figcaption><p>WEMIX gas fee 설정</p></figcaption></figure>

## Base Fee

Base Fee는 기본 수수료로 최소 지급해야 할 비용입니다. 이 비용은 고정적이지 않고 이전 블록의 트랜잭션이 많이 발생하였다면 최소 지급해야 할 비용이 올라가고, 반대로 트랜잭션이 적게 발생하였다면 비용이 낮아지게 됩니다. Base Fee는 기존에는 블록 생성자에게 보상으로 지급되었지만, EIP-1559 반영 이후에는 소각되고 있습니다.

## Gas Limit

가스비용을 제한하기 위하여 한도가 지정되어 있습니다. 가스비용이 트랜잭션을 수행하기에 부족하다면, 트랜잭션은 실패하게 됩니다. 따라서 적정량의 가스비용을 지급하는 것이 바람직합니다. 만약 가스비용이 한도를 넘어서게 되면, 블록 생성 후 초과한 수수료는 반환됩니다.


# Account

WEMIX3.0 블록체인에서의 계정은 외부 소유 계정(EOA: External Owned Accounts)과 컨트랙트 계정(CA: Contact Accounts)이 존재합니다.&#x20;

## EOA

EOA는 단순히 사용자 계정입니다. 지갑을 통해 프라이빗 키를 생성하고, 프라이빗 키를 통해 ECDSA 알고리즘을 이용하여 퍼블릭 키를 생성합니다. EOA는 사용자가 가지고 있는 프라이빗키에 의해 권한을 행사하게 됩니다.

## CA

CA는 컨트랙트 코드에 의해 권한을 행사합니다. 따라서 CA는 프라이빗 키가 없습니다. 트랜잭션을 생성하기 위해서는 전자 서명이 필요하며, 프라이빗 키로 서명합니다. EOA는 프라이빗 키를 소유하고 있으므로 트랜잭션 생성이 가능하지만, CA는 자체적으로 트랜잭션 생성이 불가능합니다. CA는 단지 다른 계정의 요청에 의한 내부 트랜잭션만을 수행할 수 있습니다.


# Design

본 장에는 WEMIX3.0 블록체인에 대한 핵심 기술 설명이 포함되어 있습니다.

* [Architecture](/ko/design/architecture)
* [Consensus](/ko/design/consensus)
* [Governance](/ko/design/governance)
* [Minting](/ko/design/minting)
* [EIP1559](/ko/design/eip1559)
* [Fee Delegation](/ko/design/fee-delegation)
* [Roadmap](/ko/design/roadmap)


# Architecture

## WEMIX3.0 Client Network

WEMIX 클라이언트는 각 블록의 모든 트랜잭션을 검증하여 네트워크 데이터를 안전하고 정확하게 유지하는 WEMIX3.0의 구현체입니다. Phase1의 WEMIX3.0은 Go 언어를 기반으로 Go-ethereum Version 1.10.16을 포킹하여 만들어졌으며 London HF까지 적용되었습니다. Phase2의 WEMIX3.0의 경우 Version 1.10.18까지 반영되어 있으며 계속 코드 최신화가 진행될 예정입니다.

![WEMIX3.0 Client Architecture Stack](https://lh5.googleusercontent.com/b2N2tBXyib72Kk9VSzaPvZ_-GYcbFP6zwGTvtNUhZyXhdENcb6tolBl06vwqPd1hzsVRYxUz45V-YiEcQngmsmWrFxB1Zq9WbFHauS_mLlowwTQTfDqUuqA9KOh1r-2ZYPjqBQ)

WEMIX3.0 Client는 위의 그림과 같은 Layering 시스템으로 되어있으며 Go-ethereum에서 Governance, Consensus, Network Protocol 부분을 수정하여 고성능 실시간성을 달성하였습니다.

## WEMIX3.0 Network Structure

WEMIX 블록체인 네트워크는 세 종류의 논리적 네트워크로 구성되어 있으며, BP, BN, EN은 각각 블록 생성자 네트워크(BPN), 브릿지 노드 네트워크(BNN), 엔드 노드 네트워크(ENN)을 구성합니다. 아래 그림은 WEMIX 메인넷의 전반적인 토폴로지를 보여줍니다. 엔드 노드 네트워크(ENN)은 직접 브릿지 노드 네트워크(BNN)에 연결된 주변 네트워크로 볼 수 있습니다.

![WEMIX Blockchain Network Structure](https://lh3.googleusercontent.com/zDuVBkdoB50T5bSIZqxpOkLqyYFh8tUtTI3yXdn6YCHdbyKtXdCOx92_m6fnRY7bcKfdZ16QpsTNDZIHYdaJapvYhYccUM_0ng5dR44XVInAxykl5lc_uPAQdXECkYbcP2ZLdQ)

### Block Producer Network(BPN)

BPN은 네트워크에서 RAFT를 적용하므로 각 BP는 충분한 성능 수준으로 RAFT 합의 과정을 수행하기 위해 하드웨어 및 네트워크 리소스 요구사항을 엄격하게 충족해야 합니다. 고성능 실시간 서비스를 지원하기 위해서 BP의 기술적 운영은 40개의 신뢰할수있는 NCP들이 담당하는 구조입니다.

### Bridge Node Network(BNN)

BNN 네트워크는 1차적으로 BPN 네트워크를 외부의 직접적인 공격으로부터 물리적으로 보호하는 기능을 가집니다. 주요 기능은 ENN으로부터 전파된 유효한 Transaction을 검증하여 합의 노드로 전송하고 반대로 BPN으로부터 전파된 유효한 Block을 검증하여 ENN으로 전파하는 역할을 수행합니다. 또한 BNN에 존재하는 Bridge Node중 일부는 Boot Node의 기능을 제공합니다. BP노드를 제외한 모든 신규 노드는 블록체인 네트워크에 참여하기 위해서 P2P네트워크에 연결된 이웃노드로부터 지금까지 생성된 모든 블록데이터를 다운로드 받아야 합니다. Boot Node는 네트워크에 참여한 신규 노드가 무조건 P2P Hand Shaking을 진행하여 P2P 네트워크에 연결시키는 Bootstrapping 서비스를 제공하는 항시 Online 상태에 존재하는 서비스 노드입니다. 해당 네트워크의 운영은 WEMIX에서 진행합니다.

### End Node Network(ENN)

가장 바깥쪽 서브 네트워크인 ENN은 WEMIX 네트워크의 엔드포인트로서 사용자의 서비스를 처리하는 역할을 직접적으로 수행하는 블록체인 End Node들로 구성되어 있으며 누구나 블록체인 노드를 설치하여 운영하는 것이 가능합니다.


# Consensus

합의 메커니즘(알고리즘)은 신뢰가 없는 주체들 간 합의에 도달하는 방법입니다. 블록체인 기술에서는 블록이 유효한지 아닌지에 대한 합의에 도달하는 데 사용됩니다. 블록체인 네트워크의 성능은 선택된 합의 메커니즘의 성능에 의존하며, 블록체인 애플리케이션의 사용성에 상당한 영향을 미칩니다. 이 문서에서 우리는 WEMIX가 어떻게 고성능 합의 프로세스를 구현했는지 살펴볼 것입니다.

## RAFT(Reliable And Fault Tolerant) Algorithm

RAFT는 선출된 리더에 의하여 클러스터의 모든 노드에 있는 데이터 저장소의 일관성을 보장하게 하는 합의 방식입니다. RAFT에 참여하는 노드들은 리더(Leader), 추종자(Follower) 중 하나이며, 리더 선출 중엔 누구나 후보자(Candidate)가 될 수 있습니다. 리더는 추종자들에게 동기화할 데이터를 생성해서 공유 해야 합니다. 리더는 보통 하트비트 메시지를 모든 추종자들에게 주기적으로 전송함으로써 리더의 존재를 알립니다. 각 추종자들은 리더의 하트비트에 대해 타임아웃 값을 랜덤하게 선택하고, 타임아웃 기간 동안 하트비트를 수신하면 타임아웃을 다시 리셋합니다. 반면에 타임아웃 동안 하트비트를 받지 못할 경우, 추종자는 후보자로 상태를 바꾸고 리더 선출에 참여하게 됩니다. 여러 노드가 동시에 리더 선출에 참여하면 충돌이 발생하기 때문에 타임아웃은 랜덤 백오프 로직 따라 결정하게 됩니다.

## WEMIX3.0 합의 메커니즘 <a href="#wemix3.0-consensus-mechanism" id="wemix3.0-consensus-mechanism"></a>

### SPoA(Stake base Proof of Authority)

WEMIX 블록체인은 고성능 실시간 서비스를 지향하는 퍼블릭 블록체인으로 블록 생성은 사전에 허가받은 Authority Member들에 의해서만 가능합니다. 따라서 기본 합의 알고리즘은 PoA를 따릅니다. 하지만, 선출된 Authority Member의 오동작 또는 악의적인 행동에 대한 물리적인 페널티를 On-Chain 상에서 부여하기 위하여 WEMIX를 특정량 이상 Staking 하도록 강제하였습니다. 이러한 WEMIX 블록체인의 합의 방식을 SPoA라고 정의합니다.

### Authority

WEMIX 블록체인의 합의 알고리즘에 참여하는 Authority는 Bitcoin/Ethereum 등의 합의 알고리즘 PoW의 마이너와 같은 역할을 수행하는 컨소시움을 의미합니다. WEMIX 블록체인에서 Authority에 포함되거나 삭제되는 과정은 기존 Authority Member들의 Voting에 의해서 결정됩니다. Authority Member가 되기 위한 조건 및 절차는 아래와 같습니다.

1. 명확한 신원 확인
2. 오프라인에서 법적 효력이 있는 계약을 WEMIX 파운데이션과 체결
3. 기본 신상 정보의 공개
4. 사전 정의된 WEMIX를 시스템 레지스트리 컨트랙트에 등록된 Staking 컨트랙트에 전송

이후 Staking이 확인되면 기존 Authority Member 중 누구라도 멤버 추가 제안을 거버넌스 컨트랙트에 제안하고 기존 Authority Member들의 50% 이상의 찬성이 있으면 새로운 Authority Member로 등록됩니다.&#x20;

Authority Member들은 사용자들이 생성한 거래 내역을 검증하여 검증이 통과된 거래들을 Mempool에 임시로 저장합니다. Authority Member는 Miner로 선출되었을 때 이전 블록의 해시 정보를 포함한 블록을 생성합니다. 이 과정은 소프트웨어를 통해 자동적으로 이루어지며  Authority Member가 지속적으로 네트워크의 상태를 모니터링 할 필요는 없습니다. 하지만 Authority Member는 블록을 생성하는 컴퓨터가 악의적으로 사용되지 않도록 방화벽 및 어카운트의 개인키 관리에 책임을 져야합니다.&#x20;

On-Chain 거버넌스 컨트랙트에서 처리 가능한 투표는 현재 dApp으로 구현된 찬반 투표로 추후 다양한 종류의 투표를 지원할 예정입니다. 투표의 가중치는 Phase 1에서는 Staking한 WEMIX의 양에 비례하고, Phase2에서는 Staking한 WEMIX의 양에 상관없이 동일한 가중치가 적용됩니다. 악의적인 행동이 감지되면 Authority Member들의 투표에 의해 당사자는 Authority 자격을 강제로 박탈당할 수 있고 Staking한 WEMIX가 몰수되어 블록생성 보상을 받을수 없게 됩니다.&#x20;

이와 같이 Staking과 Reward 시스템을 구성한 이유는 참여하는 모든 Authority Member들이 합의된 프로토콜에 의해 동작해야만 하는 당위성을 만들고 WEMIX 블록체인 네트워크의 건전성을 자율적으로 유지하게 하도록 하기 위함 입니다.

### Miner Selection

Bitcoin의 PoW를 예로 들자면, 프로토콜에 의해 계산된 Difficulty를 만족하는 블록헤더 해시를 생성한 마이너가 블록생성과 블록전파를 할 수 있도록 되어있습니다. 블록생성의 권한이 따로 존재하지 않기 때문에 상호 경쟁에 의해 블록을 생성하게 됩니다. 이러한 이유로 블록생성 경쟁을 위해 자원이 낭비될 수 밖에 없으며 Difficulty 조건을 만족하는 Work를 증명해야만 하므로 블록생성 시간에 물리적인 제약(평균 비트코인 10분/ 이더리움 15초)을 주게됩니다. 결과적으로 PoW는 확장성 트릴레마를 가지고 있으며 이를 해결하기 위한 현실적인 방안으로 PoS의 도입 또는 샤딩(Sharding) 등이 제안되어 연구되고 있으나, 아직까지는 완전하게 분산화된 방식으로 PoS로 운영되는 퍼블릭 블록체인은 존재하지 않습니다.

WEMIX3.0은 PoW나 PoS같은 방식을 사용해서는 원하는 서비스를 퍼블릭 도메인에서 제공하는 것이 불가능하다고 판단하였습니다. 초기에는 DPoS, PoA, PBFT등의 합의 방식이 고려되었으나 WEMIX 블록체인은 가장 적합한 합의 알고리즘으로 DPoS와 PoA의 장점을 차용한 새로운 컨소시움 합의 알고리즘인 SPoA를 고안하였습니다. SPoA는 기본적으로 투명한 신원 정보 및 법률 계약을 통하여 Authority를 구성하고 참여한 Authority Member들의 부적절한 행동을 막기위해 Staking 개념을 도입하고 있습니다.

WEMIX 블록체인은 블록을 생성하는 마이너를 선정하기 위하여 마이너 선정 알고리즘으로 RAFT의 구현체인 etcd를 사용하고 있습니다. etcd는 분산 시스템에 필요한 중요한 정보를 보관하고 관리하는데 사용되는 오픈 소스 분산 key-value 저장소입니다. 마이너는 Lock이 가능한 토큰을 etcd 분산시스템에 저장하고 블록을 생성합니다. 라운드 로빈과 같이 효율이 극대화된 마이너 선정 기법을 사용하지 않는 이유는 분산 시스템에 존재하는 합의노드 네트워크의 분기를 막기 위해서 입니다. etcd는 책임과 권한이 명확한 다수(40개 이상)의 허가받은 Authority Member 들의 즉각적인 완결성(Finality)을 제공해야하는 시스템에 효율적인 방법입니다.

### Reward Distribution

기존의 블록체인 합의 알고리즘은 종종 블록 생성을 담당하는 블록 생성자에게 블록보상(Block Reward)과 권한을 집중시키는 문제점을 가지고 있습니다. 이는 공정한 블록 생성 권한 분배가 중요한 DPoS(위임 지분 증명) 및 PoA(권한 증명)와 같은 비경쟁 시스템에서 특히 문제가 될 수 있습니다. 동등한 기회를 보장하기 위해 블록 생성자가 자주 바뀌게 된다면, 블록 처리 과정에서 발생하는 메시지가 증가하고 트래픽이 queue에 쌓이면서 최상의 성능을 달성하지 못하는 문제가 발생할 수 있습니다.

WEMIX3.0은 이러한 문제점을 해결하기 위해 SPoA(스테이크 기반 권한 증명) 합의 메커니즘을 도입했습니다. SPoA는 블록 생성자와 상관없이 각 authority member가 스테이킹한 WEMIX 양에 비례하여 블록 보상을 분배하는 방식입니다. 이를 통해 모든 블록 생성자들이 지속적으로 참여하도록 유도하면서 동시에 네트워크 보안을 유지할 수 있습니다. 또한, 블록 생성자는 블록 헤더에 투명한 보상 분배 정보를 포함해야 하며, 미리 정해진 규칙을 위반하면 다른 authority member들로부터 블록 생성 권한을 박탈당할 수 있습니다.

WEMIX3.0은 공정하고 지속 가능한 보상 분배를 위해 블록 보상과 성능 수익 배분을 모두 고려하는 듀얼 토큰노믹스 구조를 사용합니다. 초기에는 모든 참여자가 블록 민팅을 통해 블록 보상의 일부를 받도록 합니다. 시간이 지남에 따라 시스템은 블록 민팅 보상 비율을 점차 감소시키고, 트랜잭션 수수료와 직결된 성능 수익 배분 비율을 증가시켜 나갑니다. 이러한 변화는 최대 5억 9천만 개의 WEMIX 최대 발행량에 도달할 때까지 채굴 속도를 점차 줄이는 블록 채굴 반감기 메커니즘을 통해 이루어집니다. 최대 발행량에 도달하면 블록 채굴은 완전히 중단되고, 이후에는 성능 수익만이 유일한 보상 방식이 됩니다.

<figure><img src="/files/7lpmk2xD8qzb4IRtORKM" alt=""><figcaption></figcaption></figure>

| 반감횟수                  | 0   | 1     | 2      | 3       | ⋯ | 16         |
| --------------------- | --- | ----- | ------ | ------- | - | ---------- |
| 민팅                    | 1   | 0.5   | 0.25   | 0.125   | ⋯ | 0.000015   |
| <p>트랜잭션</p><p>수수료</p> | α   | α     | α      | α       | ⋯ | α          |
| 블록 리워드                | 1+α | 0.5+α | 0.25+α | 0.125+α | ⋯ | 0.000015+α |

블록 민팅 보상이 감소함에 따라, 트랜잭션 수수료의 일부가 성능 수익 배분으로 할당되는 비율이 증가하여 이를 상쇄합니다. 이러한 전략적 변화는 모든 참여자에게 균형되고 공정한 보상 분배를 보장하여 장기적인 네트워크 성장과 지속 가능성을 촉진합니다. 꼼꼼하게 설계된 이중 보상 구조는 합리적이고 지속 가능한 보상 시스템을 제공하면서 WEMIX3.0이 최고의 상업적 블록체인으로 발돋움하려는 목표를 달성하는 데 기여합니다. WEMIX3.0은 트랜잭션 수수료의 일부 또는 전체를 소각할 수  있습니다.

각 참여자는 하나의 계정을 보유하며, 투표를 통해 보상을 받는 계정이 등록됩니다. 다만 거버넌스 계약에 최초 시스템 컨트랙트를 배포하는 거버넌스 계정은 예외입니다. 블록을 생성하는 authority member는 계정의 잔액 상태를 업데이트하며, 계산 결과는 Patricia Trie의 루트 해시 값에 반영됩니다.

<figure><img src="/files/yiOrpM9BAMIFfPyySHC5" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/yOLlgGRiEa9cpWD80EeX" alt=""><figcaption></figcaption></figure>

### Block Generation

WEMIX 블록체인의 블록생성 간격은 거버넌스 컨트랙트에 설정되어 있습니다. Mempool에 거래의 존재 유무와 상관없이 Liveness와 Block Finality를 보장하기 위해 BP는 정해진 시간마다 (최초 설정값 1초) 블록을 생성하는 로직을 가지고 있습니다. 블록생성 간격은 Authority의 투표에 의해 변경 가능한 변수값입니다.

### Block Verification

마이너에 의해 생성된 블록이 P2P 네트워크를 통해 전파되면 이를 수신한 각각의 풀 노드(Authority Member 포함)는 블록의 유효성을 스스로 검증하고 판단하여야 합니다. 마이너가 아닌 Authority 노드들은 스스로 검증하여 거버넌스 컨트랙트에 기록된 멤버 중 마이너로 선정된 멤버가 생성한 블록인지 확인하고 보상이 정상적으로 분배되어 있으며 거래 내역이 전체 시스템의 상태(State)에 반영되었다고 판단되면 해당 블록을 이웃 노드들에게 전파하게 됩니다.&#x20;

이를 전달받은 Non-Authority 풀 노드는 헤더에 포함된 멤버들의 서명이 올바른지를 확인하고 거래내역을 검증한후 블록에 기록된 거래가 정확한 룰에 따라 생성되었다고 판단되면 블록을 로컬 디스크에 저장하고 이웃 노드에게 전파합니다.&#x20;

전파되는 블록을 검증하기 위해 위의 과정을 진행하기 전에 모든 풀 노드가 먼저 검증해야 하는 것이 두 가지 있는데 이는 Miner\_Limit과 Max\_Consecutive\_Blocks입니다.&#x20;

Miner\_Limit은 아래와 같이 정의되는데 RAFT에서 특정 멤버가 마이너로 결정되면 블록을 생성할 수 있는 Epoch가 주어지는데, 이 Epoch가 연속으로 주어질 수 없도록 하는 것을 목적으로 합니다. 즉, 모든 블록은 아래의 Miner\_Limit을 만족하는 경우에만 유효합니다.&#x20;

Miner\_Limit = floor(SIGNER\_COUNT / 2) + 1 (Number of consecutive epochs out of which a miner may only occupy one)&#x20;

Max\_Consecutive\_Blocks는 한 Epoch에서 동일 마이너가 최대 연속으로 생성할수있는 블록의 개수입니다. 이값은 만약 멤버 노드의 해킹으로 네트워크가 분기될때 분기된 블록이 생성할 수 있는 높이를 제한하기 위하여 도입된 변수입니다. WEMIX3.0에서 Max\_Consecutive\_Blocks는 1입니다.

위의 두가지 값은 블록 완결성을 보장하기 위한 방법이며 악의적으로 행동하는 Authority Member가 네트워크에 줄 수 있는 피해를 최소화하기 위하여 고안되었습니다.


# Governance

## DAO(Decentralized Autonomous Organization)

### On-Chain Governance

#### **Staking**

Authority Member가 되기 위해서는 WEMIX Staking이 선결 조건 중 하나입니다. Staking 방법은 시스템 레벨에서 알려져있는 Governance Contract에 Pre-Define된 함수를 호출하면서 WEMIX를 전송하면 가능합니다. Staking은 Governance dApp을 통해서만 할 수 있으며, Staking 가능한 Minimum 양은 Voting에 의해 변경 가능합니다. Voting Power는 Lock된 WEMIX Staking양과는 상관없이 모두 동일한 가중치가 적용되며, Staking된 WEMIX의 Lock / Unlock 여부는 Voting의 결과에 따라 결정됩니다. 한번 Lock 처리가 된 WEMIX는 기본 Locking Period가 지난 후에 Voting에 의해 Unlock 처리하여 회수 할 수 있으며, Locking Period가 끝나기 전에 Authority로서의 권한을 포기하거나 악의적 행위의 적발로 Authority의 권한이 박탈 되는 경우, 해당 Authority의 Locked WEMIX는 Eco Fund로 몰수됩니다. Phase 1에서는 참여하는 모든 Authority들의 Minimum / Maximum은 1,500,000WEMIX로 고정이었고, 모든 Authority들은 동일한 Voting Power를 가졌습니다. Phase 2에서는 Staking Minimum은 1,500,000WEMIX로 유지되지만 Staking Maximum의 제약은 제거됩니다. 즉, NCP들은 추가적인 WEMIX staking으로 Reward를 증가시키는것이 가능합니다.

#### Voting

WEMIX 블록체인 Governance Contract는 기본적으로 Voting에 의해 변경 가능한 시스템 변수들을 저장하고 있으며, Authority Member의 참여, 탈퇴, 교체와 관련된 기능을 수행하는 함수들을 가지고 있습니다. Phase 1에서는 각각의 Authority는 Staking한 양에 비례하여 Voting Power를 가지게 되며, Phase 2에서는 모든 Authority가 Staking한 양과는 무관하게 동일한 Voting Power를 가집니다. 각 Voting은 Voting Duration(1일\~7일)동안 Staking된 WEMIX 전체 총량의 50% 이상의 찬성표를 획득하게 될 시 통과됩니다.

Authority Member만이 아래의 Voting을 신청을 할 수 있습니다. 신청 시 Voting Duration을 최소/최대값 범위 안에서 정할 수 있고 미지정시 최소값으로 지정됩니다. Voting의 시작과 끝은 신청 목록에서 Member가 처음 투표할때부터 시작되어 최대 Voting Duration 동안 진행 됩니다. Voting Duration 이내라 해도 50% 초과의 찬반 의견이 나올 경우, Voting은 종료 되고, 후속 작업이 진행이 됩니다. 기본적으로 한번에 하나의 Voting만 진행되므로 기존에 진행 중인 Voting이 있을 경우, 새로운 Voting을 시작 할 수는 없습니다.

Voting 결과는 Block Number를 기준으로 반영되는데 Block number N에서 완료된 Voting의 결과는 Block Number N`+1`부터 유효합니다.

현재 버전에서 지원하는 Voting 종류는 다음과 같습니다.

* Authority member 추가: Authority member 추가를 위한 Voting이 과반 이상의 찬성으로 통과 시 해당 Member의 Staking 양에 Lock을 걸고 Authority Member에 포함시킵니다.
* Authority Member 탈퇴: Authority Member 탈퇴(패널티) 처리를 위한 Voting으로 통과 시 신청 시 지정된 수량 만큼 Unlock 되며 나머지는 Eco Fund로 보냅니다.
* Authority Member 교체(Address Change): 기존 Authority Member 를 교체 하거나 Node 정보 변경을 위한 Voting으로 통과 시 동일한 Address이면 노드 정보 변경을, 다른 Address이면 신규 Member의 Staking에  Lock을 걸고, 기존 Member Staking 은 Unlock을 진행합니다. 단, Staking한 계정으로 본인 계정의 node 정보(Voting 주소 포함)를 변경하는 경우에는 Voting 없이 바로 변경이 이루어집니다.
* Governance Contract Address 변경: 기존 Governance Contract을 업그레이드 하기 위한 Voting으로 통과 시 해당 Address로 변경 처리합니다.&#x20;
* Voting Duration 최소값: 최소 Voting 기간값을 변경하기 위한 Voting으로 기본값은 1일 입니다. 통과 시 최소 Voting 기간값을 변경 합니다.
* Voting Duration 최대값: 최대 Voting 기간값을 변경하기 위한 Voting으로 기본값은 7일 입니다. 통과 시 최대 Voting 기간값을 변경 합니다.&#x20;
* Authority Member Staking 최소값: Member 참여 시 Staking 할 수 있는 최소 WEMIX 수량을 변경하는 Voting으로 통과 시 최소 Staking WEMIX 수량값을 변경합니다.&#x20;
* Authority Member Staking 최대값: Member 참여 시 Staking 할 수 있는 최대 WEMIX 수량을 변경하는 Voting으로 통과 시 최대 Staking WEMIX 수량값을 변경합니다.&#x20;
* 블록생성시간: 블록생성 시간을 변경하기 위한 Voting으로 기본값은 1초입니다. 통과 시 블록생성시간이 변경됩니다.&#x20;
* 블록리워드 분배 방식: Transaction Fee와 신규생성된 WEMIX의 분배율을 결정하기 위한 Voting으로 기본값은 50% 블록생성자, 0% 스테이킹보상, 25% 생태계, 25% 유지보수 입니다. 통과 시 분배율과 생태계 및 유지보수 분배주소가 변경됩니다.&#x20;
* MaxPriorityFeePerGas: MaxPriorityFeePerGas의 변경을 위한 Voting 입니다. 통과 시 MaxPriorityFeePerGas가 변경됩니다. 기본값은 100Gwei입니다.
* Gas Limit & baseFee: Gas Limit, baseFee 변경 범위, baseFee 증가율 변경을 위한 Voting입니다.

{% hint style="danger" %}
**주의**

Authority member 삭제후 다시 같은 노드의 추가를 진행할 경우, {data\_directory}/etcd 디렉토리를 삭제한 후 gwemix를 restart시켜야 합니다.
{% endhint %}

### **Off-Chain Governance**

위와 같이 미리 정해져있는 종류의 설정 변경을 제외한 '프로토콜의 변경'과 같이 Hard Fork가 필요하고 Council의 명시적인 합의가 필요하다면, 재단에서 <https://snapshot.org/> 같은 Off-Chain 서비스를 사용하여 NCP의 합의과정을 진행합니다. 해당 서비스는 Off-Chain Governance이지만 과반이상의 Council의 Signature를 수신하여 Voting을 진행하므로 재단은 명시적인 Council의 합의를 기반으로 블록체인 프로토콜의 변경이 가능합니다.


# Minting

Permanent Minting Reward(PMR)에 대한 설명입니다.

WEMIX3.0 메인넷의 코인 WEMIX는 생태계 내에서 주요 거래 및 결제 수단으로 기능합니다. '브리오슈' 하드포크 도입으로 WEMIX 토큰 경제는 지속 가능하고 가치 중심의 생태계를 만들기 위한 중요한 변화를 거치게 되었습니다. 이 하드포크는 WEMIX의 가치와 안정성을 유지하기 위해 최대 공급량을 5억 9천만 WEMIX로 영구적 으로 설정하였습니다.

브리오슈 하드포크를 통해 도입된 '블록 민팅 반감기'는 'PMR(Permanent Minting Reward)'이라고 불리는 블록당 WEMIX 민팅 속도를 점차 줄이도록 설계되었습니다. 이전에는 블록당 1 WEMIX씩 총 1일 86,400 WEMIX, 1년 31,536,000 WEMIX의 속도로 발행되었습니다. 첫 번째 반감기를 통해 연간 공급량은 약 1,500만 WEMIX로 감소했습니다. 이러한 체계적인 감소는 63,115,200 블록 주기로 지속되어 채굴되는 토큰 수를 점진적으로 줄이고 보다 안정적이고 발전된 토큰 경제 구조를 뒷받침합니다.

감소된 최대 공급량과 블록 민팅 반감기 외에도 WEMIX의 분배 방식은 생태계 성장과 발전을 지원하기 위해 업데이트되었습니다. 재단 보유분은 이제 필수적인 기능별로 분류되며, 남은 토큰 상당 부분은 소각됩니다. 이 전략적 이동은 토큰 공급량을 효과적으로 관리하고 지배 구조에 대한 인식을 없애며 더 많은 참여와 소유권을 유도하는 보다 포괄적인 생태계를 육성합니다.

WEMIX는 ERC-20 표준 (Ethereum Request for Comment-20)을 기반으로 하여 다른 EVM 체인과의 브리징을 통한 이전성과 호환성을 보장합니다. 이 기반 기술은 WEMIX 생태계의 견고하고 다양한 특성을 뒷받침합니다.


# EIP1559

WEMIX3.0에 적용된 EIP1559 동적 거래수수료 조정 메커니즘에 대한 설명입니다.

기존 이더리움 거래수수료 정책은 단순한 경매 메커니즘입니다. 즉, 사용자는 가스비용을 예측하여 거래를 생성하여 전송하고, 채굴자들은 가장 높은 가스비용으로 전송된 거래들을 선택하여 블록을 생성하는 방식입니다.

이러한 방식은 비트코인과 이더리움과 같이 한정된 자원을 경매를 통하여 획득해야하는 시스템에서는 유효하지만 거래수수료가 급격하게 변하는 상황에서는 사용자가 합리적인 수준 이상의 거래수수료를 지불해야하거나 거래가 확정되기 위해서 예상보다 긴시간을 기다려야 하는 문제점이 있습니다.

EIP1559는 이더리움 London HF에 적용된 동적 거래수수료 조정 메커니즘으로 일시적인 네트워크 혼잡을 효율적으로 처리하기 위해 블록별로 거래수수료의 일부를 소각하고, 블록의 사용가능한 가스총량을 이전 블록대비 1/1024 만큼 확장 및 축소할수있도록 고안된 알고리즘입니다.

WEMIX3.0은 대용량 고속처리가 가능한 합의 알고리즘인 SPoA를 사용하고 있으며, 블록사이즈는 이더리움의 3.5배(기본 블록가스제한은 105,000,000), 블록생성시간은 이더리움의 1/12(기본 1초)까지 지원 가능합니다. 따라서, WEMIX3.0에서는 이더리움과는 달리 거버넌스에 의해 결정된 고정가스비 정책을 사용하는 것도 합리적인 선택일 수 있습니다.

하지만, 고정가스비 정책은 네이티브 코인인 WEMIX의 가격 변동성에 따라 네트워크의 DDoS 공격을 제어하기 위한 가스비도 따라서 변경되게 되는 문제점을 가지고 있습니다. 물론 On-Chain Governance에 의해 고정가스비의 변경이 가능하지만 빠른 대처가 불가능하여 네트워크의 안전을 저해할 위험을 내포하고 있습니다.

따라서, WEMIX3.0에서는 DDoS 공격 및 봇의 과도한 거래 생성으로부터 네트워크를 보호할 목적으로 아래의 조건을 가진 EIP1559 프로토콜을 적용하였습니다.

WEMIX3.0에 적용된 EIP1559의 `BaseFee`, `CurrentGasTarget`은 다음의 공식들에 의해서 매블록마다 실시간으로 계산됩니다.

![BaseFee 계산공식](https://lh5.googleusercontent.com/2tIDcFT4AOfJNjB4DSIcPw45iMQvs3wYLWBLOMH4syPyj2JJJrjEJOUaOKrdD3pFESa1gLmCbQLkYpQy2BwVk7JUZudjgYnJnQm2KH3eqb-6JuVSsknwLIJjJzO6AWBQaSSGk17lIRoGJyyLu1M)

위의 공식에서 `baseFeeMaxChangeRate`(기본값 55%)는 거버넌스 투표에 의해 변경될 수 있으나, 고정값입니다.

또한, `BaseFee`가 무한정 커져서 선의의 사용자의 모든 WEMIX가 거래수수료로 사용되는 것을 막기 위해서, BaseFee의 최대값인 `maxBaseFee`(기본값 50,000Gwei)가 정해져있으며, 이 값은 거버넌스 투표에 의해 변경될 수 있습니다.

![BaseFee 가능범위](https://lh6.googleusercontent.com/GWC0MxTHa6RhVFH_QlzcCVlLxagVsk_C-x3alDiWBdGDHy2KZCffgowZHsdBOju-Zoz2TN5ryTph9jLn0VGrjYA8dLuSpRrXs_unWuSTyHAJG-GUsbBLJJ2NRuyebBl6jRYKXXwK3eE5A8_G2uo)

아래의 공식에서 `gasTargetPercentage`(기본값 30%)과 `PreviousGasLimit`(기본값 105,000,000)는 거버넌스 투표에 의해 변경될 수 있으나 거버넌스에 의해 변경되지 않는한 항상 동일합니다.

![GasTarget 계산공식](https://lh3.googleusercontent.com/WWXd7x4zOq05_1Tmql9ChU-cLBNjBNJbJSf91B1wvQ6ar3Tye9cQfdh_nFGWTtw1UiP9yQcK5sQFgW52ovsxz2b7nsrlyxN3gDZwIBFthGdbAy_fL2R9ZSQBh0y_PFLWjILMRcymlEoJGM17YVQ)

WEMIX3.0 사용자는 고정 가스가격인 `maxPriorityFeePerGas`(기본값 100Gwei)값과 최신 블록에 기록된 가변 가스가격인 `BaseFee`(기본값 1Gwei)값을 사용하여 거래를 생성할 수 있으며, 해당 알고리즘은 기존의 EIP1559를 지원하는 모든 지갑과 호환됩니다.


# Fee Delegation

WEMIX3.0에 적용된 Fee Delegation에 대한 설명입니다.

WEMIX3.0의 Applepie HF에 적용된 메커니즘인 Fee Delegation은 Sender가 실행하고자 하는 Transaction에 지불되는 수수료를 FeePayer가 대신 지불하는 기능입니다.

Fee Delegation Transaction은 Sender가 서명한 기존 Transaction에 FeePayer 정보를 포함하여 FeePayer가 서명한 서명 정보를 추가하여 전송 함으로써 이루어집니다.

<figure><img src="/files/PHJBvf7Jx0REk1wFlyH2" alt=""><figcaption><p>Fee Delegation</p></figcaption></figure>

#### Fee Delegation Transaction

{% code overflow="wrap" %}

```
DynamicFeeTxType Transaction(with signature of Sender) + FeePayer address + signature of FeePayer
```

{% endcode %}

Fee Delegation Transaction은 기존 Transaction 중 DynamicFeeTxType만 지원하며 LegacyTxType이나 AccessListTxType은 지원하지 않습니다.

<figure><img src="/files/XNrJ5SifLxKbdcxFdIPK" alt=""><figcaption></figcaption></figure>

Fee Delegation Transaction 구현을 위해 중요 변경 내용은 아래와 같으며 자세한 변경 내용은 공개된 소스를 참조하시기 바랍니다.

#### Fee Delegation Transaction Type (transaction.go)

```go
const (
  LegacyTxType = iota
  AccessListTxType
  DynamicFeeTxType
  FeeDelegateDynamicFeeTxType = 22 //fee delegation
)
```

#### Fee Delegation Transaction 구조(transaction.go)

```go
type FeeDelegateDynamicFeeTx struct {
  SenderTx DynamicFeeTx
  FeePayer *common.Address rlp:"nil"

  // Signature values
  FV *big.Int json:"fv" gencodec:"required" // feePayer V
  FR *big.Int json:"fr" gencodec:"required" // feePayer R
  FS *big.Int json:"fs" gencodec:"required" // feePayer S
}
```

#### 서명을 위한 Fee Delegation Transaction Hash 함수(transaction\_signing.go)

```go
func (s feeDelegateSigner) Hash(tx *Transaction) common.Hash {
  senderV, senderR, senderS := tx.RawSignatureValues()
  return prefixedRlpHash(
    tx.Type(),
    []interface{}{
      []interface{}{
        s.chainId,
        tx.Nonce(),
        tx.GasTipCap(),
        tx.GasFeeCap(),
        tx.Gas(),
        tx.To(),
        tx.Value(),
        tx.Data(),
        tx.AccessList(),
        senderV,
        senderR,
        senderS,
      },
      tx.FeePayer(),
    })
}
```

{% hint style="danger" %}
**주의**

Fee Delegation Transaction은 Sender가 생성한 DynamicFeeTxType Transaction의 수수료 설정값(gas, maxFeePerGas, maxPriorityFeePerGas)에 의해 수수료를 대납하기 때문에 FeePayer는 반드시 Transaction의 수수료가 적정한지 검증하는 절차를 가져야 합니다.
{% endhint %}

{% hint style="danger" %}
**주의**

FeePayer가 서명한 Fee Delegation Transaction은 sender의 nonce에 따라 즉시 사용되지 않을 수 있으므로, 사용자가 요청한 Transaction의 nonce가 현재 sender의 nonce보다 차이가 큰 경우에 대해서 주의해야 할 필요가 있습니다.
{% endhint %}


# Eco Fund

본 장에는 WEMIX3.0 블록체인에서 발생하는 PMR(Permanent Minting Reward)의 25%으로 할당된 EcoFund와 생태계 활성화 및 네트워크 확장을 촉진시키기 위한 다양한 프로그램들에 대한 설명이 포함되어 있습니다.

## PoET

PoET 프로그램은 위믹스 생태계와 네트워크의 건강한 성장을 위해 생태계의 발전에 기여하는 빌더와 이용자를 위한 블록 보상 분배 프로그램으로, 2023년 9월 1일부터 시행되었습니다.

PoET 프로그램은 운영 기간 동안 빌더와 유저의 적극적인 참여로 위믹스 생태계의 성장에 크게 기여했습니다. 하지만, 향후 위믹스 생태계를 더욱 활성화하기 위한 전략적 방향성을 모색하고, 이에 따른 재정비를 진행하기 위해 2024년 4월 19일부로 종료하게 되었습니다.

### PoET 프로그램 종료 후 주요 사항

* PoET 프로그램 종료 이후 PoET 리워드 분배는 중단됩니다.
* 기존에 쌓인 PoET 리워드는 2024년 4월 19일 이후에도 클레임 기능을 통해 수령 가능합니다.

### PoET 정책 업데이트

<table><thead><tr><th width="166">적용일자</th><th width="328">내용</th><th>비고</th></tr></thead><tbody><tr><td>2023년 9월 1일</td><td>프로그램 런칭</td><td>-</td></tr><tr><td>2023년 9월 18일</td><td>PoET 분배 정책 업데이트</td><td>-</td></tr><tr><td>2024년 3월 7일</td><td>PoET 분배 단계 및 빌더/유저 분배 비율 변경</td><td>-</td></tr><tr><td>2024년 4월 19일</td><td>프로그램 종료</td><td>-</td></tr></tbody></table>


# Roadmap

탈중앙화된 기술, 민주화된 거버넌스

탈중앙화 설계를 기반으로 개발된 WEMIX3.0 메인넷은 위임된 스테이킹 모듈 도입을 통해, 커뮤니티가 40개의 검증된 노드 거버넌스 구조에 영향을 미치는 민주적 거버넌스를 단계적으로 도입할 것입니다.

이것이 메인넷 로드맵을 관통하는 근본적인 원칙이며, 동시에 금권주의 시스템를 도입하여 생태계 기여도를 바탕으로 진정한 민주화를 실현하는 방법이기도 합니다.

### Phase 01

WONDERS라 불리는 Node Council Partners는 WEMIX3.0 메인넷의 검증노드를 운영을 위해 선정된 40명의 구성원들입니다.

40 WONDERS는 WEMIX3.0의 안전한 운영과 혁신에 기여하는 기술적 스폰서와 WEMIX3.0을 통해 온/오프체인 생태계를 통해 생성되는 경험 주기 구축에 기여하는 에코시스템 스폰서로 구성됩니다.

각 NCP는 150만 WEMIX를 스테이킹해야 하며, PMR(Permanent Minting Reward)은 NCP(40%), 스테이커(10%), 에코펀드(25%), 유지보수(25%)에 자동으로 분배됩니다.

커뮤니티는 PMR을 통해 할당된 10%를 스테이킹 보상을 제공하는 WEMIX Grand Staking에 참여할 수 있습니다. 그러나 WEMIX Grand Staking 참가자들은 Phase 02 전까지 스테이킹을 취소하거나 스테이킹 풀에서 자산을 회수할 수 없습니다.

### Phase 02 <mark style="background-color:purple;">(Current)</mark>

안정적인 출범 이후에, NCP의 적극적인 생태계 기여를 장려하기 위해 150만 WEMIX 고정 스테이킹이 폐지되고 경쟁 스테이킹으로 전환됩니다.

WEMIX Grand Staking 참여자들에게 지급되던 10%의 PMR이 폐지되고 NCP 보상이 40%에서 50%로 증가함에 따라 초기의 PMR 배분 비율이 변경됩니다.

이 과정에서 WEMIX Holder들은 누구나 40개 검증노드들 중 특정 노드를 선택해 스테이킹 할 수 있습니다. 이를 통해 선택한 노드의 총 스테이킹 지분을 검증노드들의 스테이킹 중간값보다 높게 증가시킴으로써 노드와 커뮤니티 구성원들은 각자 보상을 받을 수 있습니다.

### Phase 03

최종 단계인 Phase 03에서는 기존의 40 WONDERS의 독점적 노드 운영이 종료되고, 스테이킹 규모에 따라 누구나 노드 운영에 참여 가능한 오픈형 자율 거버넌스 모델로 전환됩니다.

WEMIX 스테이킹 수량을 기준으로 40개의 노드가 주기적으로 선정되어 거래를 검증하게 되며 이에 따라 합의 알고리즘은 SPoA모델에서 PoS 모델로 전환됩니다.

또한 공정한 노드 운영을 위해 삭감(slashing) 정책이 시행됨에 따라 생태계의 이익에 반하는 의도적 부정행위 및 노드 운영 오류가 발생한 노드에게 페널티가 적용됩니다. 해당 정책에 의거해 귀책사유가 인정된 노드들은 스테이킹된 자산의 전부 또는 일부를 영구적으로 몰수 당하게 됩니다.

이 단계를 거쳐 민주화된 거버넌스가 완성되며, 메인넷은 WEMIX4.0으로 업그레이드 될 예정입니다. 정확한 시점은 추후 결정될 예정입니다.


# Quick Start

소프트웨어 응용 프로그램이 WEMIX 블록체인과 상호작용하려면(블록체인 데이터를 읽거나 네트워크에 트랜잭션을 전송하여) WEMIX 블록체인 노드에 연결해야 합니다.

WEMIX 블록체인 네트워크와 연결하기 위해서는 WEMIX3.0 Node(i.e., `gwemix`)를 시작하고 이웃 노드로부터 Block Sync를 완료하여야 합니다.&#x20;

Block Sync가 완료되면 사용자는 새로운 계정을 생성할 수 있으며 Test Coin Faucet을 통하여 테스트용 `TWEMIX`(Testnet WEMIX)를 전송 받으면 개발을 위한 준비가 완료됩니다.

* [노드 시작하기](/ko/quick-start/start-node)
* [이웃노드 연결하기 ](/ko/quick-start/connect-node)
* [계정 생성 ](/ko/quick-start/account)
* [테스트 WEMIX 받기](/ko/quick-start/testnet-faucet)


# Start Node

누구나 도커 환경에서 사전에 빌드된 WEMIX3.0 노드 바이너리를 다운로드 받아 본인이 관리하는 리눅스 머신에서 직접 실행할 수 있습니다. 하지만 모든 사용자가 노드를 운영할 필요는 없으며, 예를들어 dApp 개발자의 경우 무료로 24시간 서비스를 제공하는 Open API RPC 서버를 이용하여 WEMIX 블록체인에 접근하는 것도 가능합니다.

* [바이너리 사용하기](/ko/quick-start/start-node/use-binary)
* [공개 RPC 서버 연결하기](/ko/quick-start/start-node/use-public-api-server-rpc)

{% hint style="info" %}
**Build**

WEMIX에서 제공하는 바이너리를 이용하지 않고 직접 빌드를 진행할 개발자는 [Install Guide](/ko/install-and-operation/end-node/install-guide)를 참고해 주세요.
{% endhint %}

{% hint style="info" %}
**Spec**

WEMIX3.0 노드 바이너리가 실행될 리눅스 머신의 [하드웨어 스펙](/ko/install-and-operation/end-node/system-requirements)을 참고해주세요.
{% endhint %}


# Use Binary

[다운로드 사이트](/ko/install-and-operation/download)에서 WEMIX3.0 노드 Binary를 다운로드 받을 수 있습니다.

WEMIX 블록체인 네트워크를 사용하는 경우 다음과 같은 명령어를 사용하여 실행합니다. `gwemix`의 기본 RPC 포트는 8588이고 P2P 포트는 8589이고, geth와 마찬가지로 `--datadir`를 통하여 `chaindata`가 저장되는 폴더를 지정할 수 있으며 이 값이 생략되는 경우 `~/.wemix`가 데이터 디렉터리가 됩니다.&#x20;

{% tabs %}
{% tab title="Mainnet" %}
*gwemix --syncmode full --datadir {data\_folder} --http --http.addr 0.0.0.0*
{% endtab %}

{% tab title="Testnet" %}
*gwemix --wemix-testnet --syncmode full --datadir {data\_folder} --http --http.addr 0.0.0.0*
{% endtab %}
{% endtabs %}

{% hint style="info" %}
**명령줄 옵션**

[명령줄 옵션](/ko/quick-start/start-node/use-binary/command-line-option)을 이용하면 설정값을 지정하여 `gwemix를` 실행하는 것이 가능합니다.&#x20;
{% endhint %}


# Command-line Option

```
NAME:
   gwemix - the go-wemix command line interface

   Copyright 2013-2022 The go-ethereum / go-metadium / go-wemix Authors

USAGE:
   gwemix [options] [command] [command options] [arguments...]

VERSION:
   0.9.8-stable-afed9ee5

COMMANDS:
   account                            Manage accounts
   attach                             Start an interactive JavaScript environment (connect to node)
   console                            Start an interactive JavaScript environment
   db                                 Low level database operations
   dump                               Dump a specific block from storage
   dumpconfig                         Show configuration values
   dumpgenesis                        Dumps genesis block JSON configuration to stdout
   export                             Export blockchain into file
   export-preimages                   Export the preimage database into an RLP stream
   import                             Import a blockchain file
   import-preimages                   Import the preimage database from an RLP stream
   init                               Bootstrap and initialize a new genesis block
   js                                 Execute the specified JavaScript files
   license                            Display license information
   makecache                          Generate ethash verification cache (for testing)
   makedag                            Generate ethash mining DAG (for testing)
   removedb                           Remove blockchain and state databases
   show-deprecated-flags              Show flags that have been deprecated
   snapshot                           A set of commands based on the snapshot
   version                            Print version numbers
   version-check                      Checks (online) whether the current version suffers from any known security vulnerabilities
   wallet                             Manage Ethereum presale wallets
   wemix                              Wemix helper commands
   help, h                            Shows a list of commands or help for one command

ETHEREUM OPTIONS:
  --config value                      TOML configuration file
  --datadir value                     Data directory for the databases and keystore (default: "/home/nxt/.wemix")
  --datadir.ancient value             Data directory for ancient chain segments (default = inside chaindata)
  --datadir.minfreedisk value         Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)
  --keystore value                    Directory for the keystore (default = inside the datadir)
  --usb                               Enable monitoring and management of USB hardware wallets
  --pcscdpath value                   Path to the smartcard daemon (pcscd) socket file (default: "/run/pcscd/pcscd.comm")
  --networkid value                   Explicitly set network id (integer, 1111=WemixMainnet , 1112=WemixTestnet)(For testnets: use --wemix-testnet --ropsten, --rinkeby, --goerli instead) (default: 1111)
  --mainnet                           Ethereum mainnet
  --wemix-testnet                     Wemix test network: pre-configured wemix test network
  --goerli                            Görli network: pre-configured proof-of-authority test network
  --rinkeby                           Rinkeby network: pre-configured proof-of-authority test network
  --ropsten                           Ropsten network: pre-configured proof-of-work test network
  --sepolia                           Sepolia network: pre-configured proof-of-work test network
  --syncmode value                    Blockchain sync mode ("snap", "full" or "light") (default: snap)
  --exitwhensynced                    Exits after block synchronisation completes
  --gcmode value                      Blockchain garbage collection mode ("full", "archive") (default: "full")
  --txlookuplimit value               Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain) (default: 2350000)
  --ethstats value                    Reporting URL of a ethstats service (nodename:secret@host:port)
  --identity value                    Custom node name
  --lightkdf                          Reduce key-derivation RAM & CPU usage at some expense of KDF strength
  --whitelist value                   Comma separated block number-to-hash mappings to enforce (<number>=<hash>)

LIGHT CLIENT OPTIONS:
  --light.serve value                 Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100) (default: 0)
  --light.ingress value               Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.egress value                Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited) (default: 0)
  --light.maxpeers value              Maximum number of light clients to serve, or light servers to attach to (default: 100)
  --ulc.servers value                 List of trusted ultra-light servers
  --ulc.fraction value                Minimum % of trusted ultra-light servers required to announce a new head (default: 75)
  --ulc.onlyannounce                  Ultra light server sends announcements only
  --light.nopruning                   Disable ancient light chain data pruning
  --light.nosyncserve                 Enables serving light clients before syncing

DEVELOPER CHAIN OPTIONS:
  --dev                               Ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
  --dev.period value                  Block period to use in developer mode (0 = mine only if transaction pending) (default: 0)
  --dev.gaslimit value                Initial block gas limit (default: 11500000)

ETHASH OPTIONS:
  --ethash.cachedir value             Directory to store the ethash verification caches (default = inside the datadir)
  --ethash.cachesinmem value          Number of recent ethash caches to keep in memory (16MB each) (default: 2)
  --ethash.cachesondisk value         Number of recent ethash caches to keep on disk (16MB each) (default: 3)
  --ethash.cacheslockmmap             Lock memory maps of recent ethash caches
  --ethash.dagdir value               Directory to store the ethash mining DAGs (default: "/home/nxt/.ethash")
  --ethash.dagsinmem value            Number of recent ethash mining DAGs to keep in memory (1+GB each) (default: 1)
  --ethash.dagsondisk value           Number of recent ethash mining DAGs to keep on disk (1+GB each) (default: 2)
  --ethash.dagslockmmap               Lock memory maps for recent ethash mining DAGs

TRANSACTION POOL OPTIONS:
  --txpool.locals value               Comma separated accounts to treat as locals (no flush, priority inclusion)
  --txpool.nolocals                   Disables price exemptions for locally submitted transactions
  --txpool.journal value              Disk journal for local transaction to survive node restarts (default: "transactions.rlp")
  --txpool.rejournal value            Time interval to regenerate the local transaction journal (default: 1h0m0s)
  --txpool.pricelimit value           Minimum gas price limit to enforce for acceptance into the pool (default: 1)
  --txpool.pricebump value            Price bump percentage to replace an already existing transaction (default: 10)
  --txpool.accountslots value         Minimum number of executable transaction slots guaranteed per account (default: 100000)
  --txpool.globalslots value          Maximum number of executable transaction slots for all accounts (default: 500000)
  --txpool.accountqueue value         Maximum number of non-executable transaction slots permitted per account (default: 100000)
  --txpool.globalqueue value          Maximum number of non-executable transaction slots for all accounts (default: 500000)
  --txpool.lifetime value             Maximum amount of time non-executable transaction are queued (default: 3h0m0s)

PERFORMANCE TUNING OPTIONS:
  --cache value                       Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode) (default: 1024)
  --cache.database value              Percentage of cache memory allowance to use for database io (default: 50)
  --cache.trie value                  Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode) (default: 15)
  --cache.trie.journal value          Disk journal directory for trie cache to survive node restarts (default: "triecache")
  --cache.trie.rejournal value        Time interval to regenerate the trie cache journal (default: 1h0m0s)
  --cache.gc value                    Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25)
  --cache.snapshot value              Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode) (default: 10)
  --cache.noprefetch                  Disable heuristic state prefetch during block import (less CPU and disk IO, more time waiting for data)
  --cache.preimages                   Enable recording the SHA3/keccak preimages of trie keys

ACCOUNT OPTIONS:
  --unlock value                      Comma separated list of accounts to unlock
  --password value                    Password file to use for non-interactive password input
  --signer value                      External signer (url or path to ipc file)
  --allow-insecure-unlock             Allow insecure account unlocking when account-related RPCs are exposed by http

API AND CONSOLE OPTIONS:
  --ipcdisable                        Disable the IPC-RPC server
  --ipcpath value                     Filename for IPC socket/pipe within the datadir (explicit paths escape it)
  --http                              Enable the HTTP-RPC server
  --http.addr value                   HTTP-RPC server listening interface (default: "localhost")
  --http.port value                   HTTP-RPC server listening port (default: 8588)
  --http.api value                    API's offered over the HTTP-RPC interface
  --http.rpcprefix value              HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --http.corsdomain value             Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --http.vhosts value                 Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --ws                                Enable the WS-RPC server
  --ws.addr value                     WS-RPC server listening interface (default: "localhost")
  --ws.port value                     WS-RPC server listening port (default: 8598)
  --ws.api value                      API's offered over the WS-RPC interface
  --ws.rpcprefix value                HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.
  --ws.origins value                  Origins from which to accept websockets requests
  --graphql                           Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.
  --graphql.corsdomain value          Comma separated list of domains from which to accept cross origin requests (browser enforced)
  --graphql.vhosts value              Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")
  --rpc.gascap value                  Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite) (default: 0)
  --rpc.evmtimeout value              Sets a timeout used for eth_call (0=infinite) (default: 5s)
  --rpc.txfeecap value                Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 0)
  --rpc.allow-unprotected-txs         Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC
  --jspath loadScript                 JavaScript root path for loadScript (default: ".")
  --exec value                        Execute JavaScript statement
  --preload value                     Comma separated list of JavaScript files to preload into the console

NETWORKING OPTIONS:
  --bootnodes value                   Comma separated enode URLs for P2P discovery bootstrap
  --discovery.dns value               Sets DNS discovery entry points (use "" to disable DNS)
  --port value                        Network listening port (default: 8589)
  --maxpeers value                    Maximum number of network peers (network disabled if set to 0) (default: 25)
  --maxpendpeers value                Maximum number of pending connection attempts (defaults used if set to 0) (default: 0)
  --nat value                         NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any")
  --nodiscover                        Disables the peer discovery mechanism (manual peer addition)
  --v5disc                            Enables the experimental RLPx V5 (Topic Discovery) mechanism
  --netrestrict value                 Restricts network communication to the given IP networks (CIDR masks)
  --nodekey value                     P2P node key file
  --nodekeyhex value                  P2P node key as hex (for testing)

MINER OPTIONS:
  --mine                              Enable mining
  --miner.threads value               Number of CPU threads to use for mining (default: 0)
  --miner.notify value                Comma separated HTTP URL list to notify of new work packages
  --miner.notify.full                 Notify with pending block headers instead of work packages
  --miner.gasprice value              Minimum gas price for mining a transaction (default: 1000000000)
  --miner.gaslimit value              Target gas ceiling for mined blocks (default: 8000000)
  --miner.etherbase value             Public address for block mining rewards (default = first account) (default: "0")
  --miner.extradata value             Block extra data set by the miner (default = client version)
  --miner.recommit value              Time interval to recreate the block being mined (default: 3s)
  --miner.noverify                    Disable remote sealing verification

GAS PRICE ORACLE OPTIONS:
  --gpo.blocks value                  Number of recent blocks to check for gas prices (default: 20)
  --gpo.percentile value              Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60)
  --gpo.maxprice value                Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo (default: 500000000000)
  --gpo.ignoreprice value             Gas price below which gpo will ignore transactions (default: 2)

VIRTUAL MACHINE OPTIONS:
  --vmdebug                           Record information useful for VM and contract debugging

LOGGING AND DEBUGGING OPTIONS:
  --fakepow                           Disables proof-of-work verification
  --nocompaction                      Disables db compaction after import
  --verbosity value                   Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3)
  --vmodule value                     Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4)
  --log.json                          Format logs with JSON
  --log.backtrace value               Request a stack trace at a specific logging statement (e.g. "block.go:271")
  --log.debug                         Prepends log messages with call-site location (file and line number)
  --pprof                             Enable the pprof HTTP server
  --pprof.addr value                  pprof HTTP server listening interface (default: "127.0.0.1")
  --pprof.port value                  pprof HTTP server listening port (default: 6060)
  --pprof.memprofilerate value        Turn on memory profiling with the given rate (default: 524288)
  --pprof.blockprofilerate value      Turn on block profiling with the given rate (default: 0)
  --pprof.cpuprofile value            Write CPU profile to the given file
  --trace value                       Write execution trace to the given file

METRICS AND STATS OPTIONS:
  --metrics                              Enable metrics collection and reporting
  --metrics.expensive                    Enable expensive metrics collection and reporting
  --metrics.addr value                   Enable stand-alone metrics HTTP server listening interface (default: "127.0.0.1")
  --metrics.port value                   Metrics HTTP server listening port (default: 6060)
  --metrics.influxdb                     Enable metrics export/push to an external InfluxDB database
  --metrics.influxdb.endpoint value      InfluxDB API endpoint to report metrics to (default: "http://localhost:8086")
  --metrics.influxdb.database value      InfluxDB database name to push reported metrics to (default: "geth")
  --metrics.influxdb.username value      Username to authorize access to the database (default: "test")
  --metrics.influxdb.password value      Password to authorize access to the database (default: "test")
  --metrics.influxdb.tags value          Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost")
  --metrics.influxdbv2                   Enable metrics export/push to an external InfluxDB v2 database
  --metrics.influxdb.token value         Token to authorize access to the database (v2 only) (default: "test")
  --metrics.influxdb.bucket value        InfluxDB bucket name to push reported metrics to (v2 only) (default: "geth")
  --metrics.influxdb.organization value  InfluxDB organization name (v2 only) (default: "geth")

WEMIX OPTIONS:
  --consensusmethod value             Wemix consensus method (integer, 1=PoW, 2=PoA, 3=ETCD, 4=PBFT) (default: 2)
  --fixeddifficulty value             Fixed difficulty to disable PoW (default: 1)
  --fixedgaslimit value               Fixed gas limit to control block size better (default: 0)
  --maxidleblockinterval value        Interval to generate empty block (default: 600)
  --blocksperturn value               Number of blocks per turn for PoA (default: 100)
  --noncelimit value                  Nonce limit for non-governing accounts (default: 0)
  --userocksdb value                  LevelDB (0) or RocksDB (1) (default: 1)
  --prefetchcount value               Transaction prefetch count for faster db read (default: 0)
  --log value                         Rotating log file: <file-name>,<count>,<size> (default: "log,5,10M")
  --maxtxsperblock value              Max # of transactions in a block (default: 5000)
  --hub value                         Id of message hub
  --wemix.block.interval value        Block generation interval in seconds (default: 1)
  --wemix.block.timeadjblocks value   Block interval to ajdust timestamp (default: 120)
  --wemix.block.minbuildtime value    Minimum block generation time in ms (default: 300)
  --wemix.block.minbuildtxs value     Minimum txs in a block with pending txs (default: 2500)
  --wemix.block.trailtime value       Time to leave for block data transfer in ms (default: 300)

ALIASED (deprecated) OPTIONS:
  --nousb                             Disables monitoring for and managing USB hardware wallets (deprecated)

MISC OPTIONS:
  --snapshot                                Enables snapshot-database mode (default = enable)
  --bloomfilter.size value                  Megabytes of memory allocated to bloom-filter for pruning (default: 2048)
  --help, -h                                show help
  --override.arrowglacier value             Manually specify Arrow Glacier fork-block, overriding the bundled setting (default: 0)
  --override.terminaltotaldifficulty value  Manually specify TerminalTotalDifficulty, overriding the bundled setting (default: 0)


COPYRIGHT:
   Copyright 2013-2022 The go-ethereum / go-metadium / go-wemix Authors
```


# Use Public API Server(RPC)

직접 WEMIX3.0 Client를 설치 및 관리하고 싶지 않을 경우 무료로 24시간 서비스를 제공하는 RPC 서버를 이용하는 것이 가능합니다.&#x20;

개발자는 공개된 네트워크 엔드포인트인 RPC 서버를 활용하여 온체인 데이터와 상호 작용하고 다양한 유형의 트랜잭션을 네트워크에 보낼 수 있습니다. API는 JSON-RPC 표준을 따르며, JSON-RPC는 블록체인 네트워크와 상호 작용할 때 일반적으로 사용되는 상태 비저장 경량 RPC(Remote Procedure Call) 프로토콜입니다.

{% hint style="info" %}
**JSON-RPC calls**

[WEMIX3.0 JSON-RPC API](/ko/dapp-developer/json-rpc)는 표준 Web3 [Ethereum JSON-RPC API](https://eth.wiki/json-rpc/API)와 100% 호환됩니다.
{% endhint %}

{% tabs %}
{% tab title="Mainnet" %}
HTTP(HTTPS) server endpoint

* [https://api.wemix.com](https://api.wemix.com/)

WS(WSS) server endpoint

* [wss://ws.wemix.com](wss://ws.wemix.com/)
  {% endtab %}

{% tab title="Testnet" %}
HTTP(HTTPS) server endpoint

* <https://api.test.wemix.com>

WS(WSS) server endpoint

* <wss://ws.test.wemix.com>
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}
**속도제한**

속도제한이란 Incoming Connection에 대한 Rate를 제한하는 기능입니다. 예를 들어 너무 많은 Connection이 동시에 발생해 Server에 부담이 가는 경우, 정의한 Rate Limit을 초과한 Connection은 Reject 할 수 있습니다

RPC Server는 악의적인 공격을 막고 보다 많은 사용자에게 신뢰할 수 있는 서비스를 제공하기 위하여 IP별로 속도제한을 두고 있습니다.
{% endhint %}


# Connect Node

## 노드 연결 <a href="#node-connection" id="node-connection"></a>

로컬에 설치한 `gwemix` RPC 웹서버를 통해서 연결하는 방법은 아래와 같습니다.

```
gwemix attach rpc:http://localhost:8588
```

로컬에 설치한 `gwemix` IPC 파일을 통해서 연결하는 방법은 다음과 같습니다.

```
gwemix attach {data_folder}/gwemix.ipc
```

바이너리를 다운로드 받아서 {data\_folder}에서 압축을 풀면 bin 디렉토리 아래 `gwemix.sh`라는 쉘스크립트파일을 찾을 수 있습니다. `gwemix.sh`를 이용하여 IPC 파일을 통해서 노드에 연결하는 방법은 다음과 같습니다.

```
{data_folder}/bin/gwemix.sh console
```

## 노드 설정 <a href="#node-settings" id="node-settings"></a>

`gwemix.sh`를 사용할 경우 {data\_folder}에 `.rc`라는 파일을 생성하여 노드 실행 옵션을 미리 설정하는 것이 가능합니다.&#x20;

```
PORT=8588
DISCOVER=1        # 1 for enable discovery mode, 0 for disable discovery mode
TESTNET=1         # 1 for Testnet or remove this line for Mainnet
SYNC_MODE=full
GWEMIX_OPTS="--rpc.allow-unprotected-txs"
```

위와 같이 설정하고 `gwemix`를 실행하면 `gwemix` 는 아래와 같은 실행줄 옵션을 가지고 실행되게 됩니다.

```
gwemix --http.port 8588 --wemix-testnet --syncmode full --rpc.allow-unprotected-txs 
```


# Account

WEMIX3.0 계정은 WEMIX 블록체인에서 트랜잭션을 보낼 수 있는 WEMIX 잔액이 있는 개체입니다. 본 장에서는 사용자가 직접 제어하는 EOA (Externally-Owned Account) 생성 및 잔고확인 방법에 대해 설명합니다.

## 계정 생성 <a href="#create-account" id="create-account"></a>

계정 파일은 keystore 디렉토리에 생성됩니다. 새로운 계정을 생성하기 위해서는 다음과 같은 명령을 사용합니다.

```
gwemix wemix new-account --out <account-file-name>
```

{% hint style="info" %}
MetaMask를 이용하면 `gwemix`를 직접 설치하지 않고도 편리하게 새로운 계정을 생성할 수 있습니다. [MetaMask 사용하기](/ko/quick-start/account/use-metamask)를 통하여 지갑생성 및 WEMIX3.0 네트워크 설정이 가능합니다.
{% endhint %}

## 계정 가져오기 <a href="#import-account" id="import-account"></a>

외부에서 생성한 계정파일도 keystore 디렉토리에 복사하여 사용할 수 있습니다.&#x20;

```
mkdir {data_directory}/keystore
chmod 700 {data_directory}/keystore
cp <account-file-name> {data_directory}/keystore
```

## 계정 잔고 확인 <a href="#check-account-balance" id="check-account-balance"></a>

gwemix console에 접속하여 다음의 명령을 실행하면 잔고를 확인할 수 있습니다.

```
eth.getBalance('{your_address}')
```

gwemix console은 JavaScript console이므로 keystore에 있는 모든 주소의 잔고를 읽어오는 JavaScript 함수를 이용하면 모든 잔고를 하나의 함수로 읽어올 수 있습니다.

```
function checkAllBalances() { 
var i = 0; 
eth.accounts.forEach( function(e){
     console.log("eth.accounts["+i+"]: " + e + " \tbalance: " + web3.fromWei(eth.getBalance(e), "ether") + " ether"); 
i++; 
})
};
```


# Use MetaMask

MetaMask를 이용한 WEMIX3.0 지갑 만들기

MetaMask는 WEMIX3.0 메인넷/테스트넷에서 코인, FT, NFT의 send/receive 기능을 수행할 수 있는 일반 사용자용 지갑입니다. 또한, 개발자는 MetaMask를 통하여 REMIX IDE를 연결하여 스마트 컨트렉트를 배포하고 동작 테스트를 진행하는 것도 가능합니다.&#x20;

아래의 순서로 설치에서 사용까지의 과정을 진행해 보도록 하겠습니다.&#x20;

* Step 1 : MetaMask 설치하기
* Step 2 : MetaMask 실행하기
* Step 3 : WEMIX3.0 네트워크 정보 추가하기
* Step 4 : WEMIX 코인 전송하기

## Step 1 : MetaMask 설치하기 <a href="#installing-metamasks" id="installing-metamasks"></a>

웹 사용자는 [크롬 웹스토어](https://chrome.google.com/webstore/) 및 [모질라 에드온](https://addons.mozilla.org/en-US/firefox/)에서 MetaMask를 다운로드 받아 설치할 수 있으며, 모바일 사용자의 경우 애플 앱스토어 및 구글플레이 스토어를 이용하는 것이 가능합니다.&#x20;

사용자는 MetaMask의 [다운로드 페이지](https://metamask.io/download/)로 이동하여 원하는 플랫폼을 선택하고 기기의 설치 방법을 따릅니다.&#x20;

진행 과정은 모든 플랫폼이 거의 동일하므로 본 장에서는 맥컴퓨터의 크롬 웹스토어를 통하여 설치한 MetaMask를 기준으로 설명하도록 하겠습니다.

![](https://lh4.googleusercontent.com/RnF-mLqD4aRsnSh0jguxs55TE_1Lijq8ZFZ9VcsPT-I4IYFUWAVeBbfAmaDkSgShSKBUzvVeQCfjCgUvqxb37pgZeOqsndl_JOpxjWGGjV8irjwwWkbGDZQ1I0Y6-HW6mvjbtA)

## Step 2 : MetaMask 실행하기 <a href="#running-metamask" id="running-metamask"></a>

MetaMask가 성공적으로 설치되면 오른쪽 상단의 Extensions tab에 보이게 됩니다. 아래의 그림에서 MetaMask를 누르면 MetaMask 시작화면으로 이동합니다.

![](https://lh4.googleusercontent.com/1CrLrcodMobrBIikw1vWUviujur6twBWa9zOroyVTahX31s1LhR1y-XI9JUgiVcawdrjxLhlp8DZjB_ffjPhFxda2lDzJVPpZn2z5lWrZwKvwckKJdRYWrXU6OxnLNOB_8xSBQ)

기존에 MetaMask를 이용하여 지갑을 생성해본 사용자는 'Import Wallet'을 선택한 후, 백업해 둔 Secret Recovery Phrase를 이용하여 지갑을 복구할 수 있습니다. 반면에 처음 사용하는 사용자는 'Create a Wallet'을 누릅니다.&#x20;

다음은 'Create a Wallet'을 선택한 경우를 기준으로 설명하도록 하겠습니다.&#x20;

우선 아래의 그림과 같이 'Password'를 등록해야 합니다. 해당 패스워드는 서버에 저장되는 것이 아니라 사용자가 반드시 기억해야 하는 정보이니 주의해서 관리해 주세요. 절대 쉽게 노출될 수 있는 곳에 보관하지 마십시오.

![](https://lh5.googleusercontent.com/bPYjUVo4xUS9afKNBKq-c2m8gW-cBobqMmbfvBHIflw2Pv4NgLs9R8ITYTJDjuGeXJzqk8h7oLJQwouccAD3q5pEQ5nJOEuZKgwrNUFqqknKLqIlK68uQBcL14v8ae_-JO5YBg)

위의 그림에서 'Create'를 누르면 12개의 시드 문구 (Secret Recovery Phrase)가 생성됩니다. 이 12개의 시드 문구는 여러 자산들을 저장하는 지갑의 '비밀키'입니다. 명심하세요. 해당 정보는 절대 인터넷에 연결된 장치에는 보관해서는 안됩니다.&#x20;

해당 문구가 없으면 기기가 고장 나거나 기기를 분실할 경우, 여러분의 지갑과 자금을 복구할 수 없습니다. 다음 페이지에서 이를 '적어두었음'을 확인합니다.

![](https://lh3.googleusercontent.com/RprVBTl3qctcSEPaVwQHrfupaUJYjDGp7THklZnCv5TQX3bl0138tfCmz-n-hkN78mPQzCJJ0P-peCxTJdlGhwamSSAwHUlZGMKovakPp-fxRvXjZszN1c022MpOJI5UejggLg)

## Step 3 : WEMIX3.0 네트워크 정보 추가하기 <a href="#adding-wemix-network-information" id="adding-wemix-network-information"></a>

위의 절차를 통해서 MetaMask가 실행되면 아래의 화면을 볼 수 있습니다.

<figure><img src="/files/4HetXUldxRkvexPDlH93" alt=""><figcaption></figcaption></figure>

MetaMask는 기본적으로 이더리움 지갑을 지원하고 있다라는 것을 확인할 수 있습니다. 이러한 설정에서는 WEMIX 지갑으로 사용할 수 없습니다.&#x20;

이제 네트워크를 이더리움에서 WEMIX3.0 메인넷/테스트넷으로 변경하는 작업을 진행해 보겠습니다. 설정(Settings)에서 WEMIX3.0 블록체인 노드와 MetaMask 지갑을 연결해 보겠습니다.

<figure><img src="/files/LZAgLcSAkIfarOeKXVTV" alt=""><figcaption></figcaption></figure>

아래의 그림에서 보면 Settings화면에서 'Networks' 메뉴로 이동합니다. 그 후 'Add a Network'를 클릭하고 수동으로 WEMIX3.0 메인넷 혹은 테스트넷 추가합니다.

<figure><img src="/files/JvD9glt9VWr7lPPA1TkG" alt=""><figcaption><p>WEMIX3.0 테스트넷 네트워크 추가</p></figcaption></figure>

<figure><img src="/files/sJG4vgWrB0iwi5CLEUpG" alt=""><figcaption><p>WEMIX3.0 메인넷 네트워크 추가</p></figcaption></figure>

각 네트워크를 위해 입력해야 하는 매개 변수는 다음과 같습니다.

{% hint style="info" %}

#### 테스트넷

Network Name: WEMIX\_Testnet&#x20;

New RPC URL: <https://api.test.wemix.com/>

ChainID: 1112

Symbol: tWEMIX

Block Explorer URL: <https://explorer.test.wemix.com/>
{% endhint %}

{% hint style="info" %}

#### 메인넷

Network Name: WEMIX\_Mainnet&#x20;

New RPC URL: <https://api.wemix.com/>

ChainID: 1111

Symbol: WEMIX

Block Explorer URL: <https://explorer.wemix.com/>
{% endhint %}

MetaMask를 사용해 WEMIX 또는 TWEMIX 전송하기 위해서는 메인넷과 테스트넷 두 가지를 모두 추가해 주시면 됩니다. 해당 네트워크를 저장(Save)하고 메인 화면으로 돌아오면, 네트워크가 입력한 정보로 자동으로 변경되고 단위 표시가 더 이상 ETH가 아닌 WEMIX로 표시됩니다.

<figure><img src="/files/YrKruoqWK7vPpnUaz095" alt=""><figcaption></figcaption></figure>

## Step 4 : WEMIX 코인 전송하기  <a href="#send-wemix-coins" id="send-wemix-coins"></a>

WEMIX 코인을 전송하기 위해서는 우선 'Send' 버튼을 클릭합니다. 그러면 받을 주소(Send to)를 입력하는 창이 나옵니다.

받을 주소를 입력하고 보낼 금액을 'Amount' 항목에 기록합니다.

<figure><img src="/files/hQb8sdG8hC7YuxxuBZzk" alt=""><figcaption></figcaption></figure>

받을 주소와 금액을 입력하고 'Next'를 선택하면 아래와 같이 이더리움을 기반으로 기본 설정된 'Gas fee'를 보여주는 화면이 나옵니다.&#x20;

WEMIX는 이더리움과는 다른 Fee 정책을 가지고 있으므로 반드시 'Market' 을 선택하여 Gas fee를 변경해야 합니다.

<figure><img src="/files/WxUOIpr2Yu4OlRADZ7lU" alt=""><figcaption></figcaption></figure>

위 화면에서 'Advanced'를 선택하면 사용자가 'Max priority fee (GWEI)'와 'Max fee(GWEI)'를 수동으로 설정 할 수 있습니다.

<figure><img src="/files/eDBxE06Lc57TAyRtr6ca" alt=""><figcaption></figcaption></figure>

현재 WEMIX는 고정 'Max priority fee(GWEI)'를 사용하고 있으며 값은 100입니다.&#x20;

Max fee는 사용자가 정의하는 값으로 최소값은 MaxPriorityFee+BASE\_FEE입니다.&#x20;

WEMIX의 BASE\_FEE는 EIP-1559를 따라 가변입니다. 따라서, Transaction이 성공적으로 만들어지기 위해서는 아래와 같이 설정해 주시기를 권장 드립니다.&#x20;

1. Max base fee (GWEI) = 101
2. Max priority fee (GWEI) = 100&#x20;

체크박스를 선택하면 변경한 값이 유지됩니다.

위 그림에서 Fee 설정을 완료하고 'Save'를 선택하면 출금 준비가 완료됩니다.

'Confirm'을 선택하면 WEMIX 전송 거래가 생성되고 WEMIX Block Producer들에 의해 확정되면 블록에 포함되고 전송이 완료됩니다.


# Testnet Faucet

## Testnet Faucet

**WEMIX3.0의 Testnet Faucet**은 블록체인 네트워크에서 스마트 컨트랙트를 개발하고 실험하기 위한 자금을 제공하는 무료 웹 서비스로, 개발자들은 메인넷에서 WEMIX를 구매하지 않고도 tWEMIX와 tWEMIX$를 얻어 위믹스 생태계의 다양한 기능을 테스트할 수 있습니다.

현재, Testnet Faucet은 tWEMIX와 tWEMIX$를 지원하며, tWEMIX는 테스트넷의 네이티브 코인으로, 가스비 지불 등을 위해 반드시 필요합니다. tWEMIX$는 공식 테스트 스테이블코인으로, WEMIX.Fi나, PNIX DEX나 Kurrency와 같은 스테이블코인과 관련된 기능을 실험하는 데 사용할 수 있습니다.

{% hint style="danger" %}
Testnet Faucet을 통해 제공되는 tWEMIX와 tWEMIX$는 개발 및 테스트 목적으로만 사용 가능하며, 메인넷에서 사용할 수 없습니다.
{% endhint %}

## Testnet Faucet 사용하기 <a href="#how-to-get-twemix" id="how-to-get-twemix"></a>

Testnet Faucet은 별도의 웹 페이지를 통해 제공되며, 사용자의 MetaMask 지갑 주소로 테스트 자금을 받을 수 있습니다. tWEMIX 혹은 tWEMIX$를 선택하여 지갑 주소를 입력하면 약 10초 이내 자금이 전송됩니다. Faucet 사용 시 1회당 10 tWEMIX와 100 WEMIX$가 제공됩니다. Faucet은 1회당 지원되는 자금을 모두 사용해야 다시 사용할 수 있습니다.

{% embed url="<https://wallet.test.wemix.com/faucet>" %}

{% hint style="info" %}
Testnet Faucet의 자세한 사용법은 [Test Coin](/ko/tutorial/test-coin) 받기에서 확인할 수 있습니다.
{% endhint %}


# Install & Operation

본 장은 gwemix의 설치 및 운영에 대한 설명을 포함합니다.&#x20;

개발자는 최소 사양 이상의 리눅스 머신이 준비되면 gwemix 공식 git repository에서 binary를 다운로드 받거나 소스코드를 다운로드하여 설치하는 것이 가능합니다.&#x20;

아래의 설명을 따라서 wemix client를 직접 설치해보세요.

* [End Node](/ko/install-and-operation/end-node)
* [Block Producer Node](/ko/install-and-operation/block-producer-node)
* [Download](/ko/install-and-operation/download)
* [Operation Guide](/ko/install-and-operation/operation-guide)


# End Node

## 사용대상

* 본 장에 포함된 내용은 직접 WEMIX3.0 블록체인 앤드 노드를 설치하고 [JSON-RPC API](https://docs.wemix.com/ko/install-and-operation/pages/v0rv3ntLeeKevFTmPAQA#wemix3.0-json-rpc-api) 메서드를 통하여 블록체인에 직접 데이터를 읽고 쓰는 작업이 필요한 사용자를 위한 것입니다.
* 일반 dApp 개발자 혹은 테스트를 원하는 경우 블록체인 앤드 노드를 직접 설치하는 대신, 무료로 제공하는 [공개 RPC 서버](/ko/quick-start/start-node/use-public-api-server-rpc)를 이용하시면 됩니다.
* 블록체인 앤드노드의 설치 및 운영이 필요한 경우는 일반적으로 다음과 같습니다.
  1. 거래소 운영사
  2. 고성능 dApp 개발사

## 역할 및 기능

* 수신한 블록 데이터 검증&#x20;
* 블록 데이터 및 상태정보 동기화
* RPC, WS 요청 처리
* 수신한 거래를 연결된 BN(Bridge Node)에 전달




---

[Next Page](/llms-full.txt/1)

