XDagger / xdagj

XDAGJ is an implementation of XDAG in Java. https://xdag.io
MIT License
112 stars 59 forks source link

Feature : EVM Support #54

Open LucasMLK opened 3 years ago

LucasMLK commented 3 years ago

The biggest source of Ethereum on the chain and the success of smart contracts, we see that the key to the success of the Ethereum ecosystem is the creation of an EVM virtual machine. At present, the realization of a virtual machine is very important for XDAG. The reasons are as follows:

  1. The throughput of Ethereum L1 15 tps/s causes high handling fees (>10$), which greatly limits the development of DAPP
  2. Ethereum 2.0 POS has not yet determined the specific launch date, which has a great degree of delay risk and security risk (the topic of POW vs POS is a cliché, not to argue here, but we believe that POW is more secure)
  3. XDAG has a natural high TPS design, and POW safety design, and has a good foundation for the development of higher performance DAPP

    EVM Illustrated

ethereum evm illustrated-1

EVM INSTRUCTIONS

The EVM executes as a stack machine with a depth of 1024 items. Each item is a 256-bit word, which was chosen for the ease of use with 256-bit cryptography (such as Keccak-256 hashes or secp256k1 signatures).

During execution, the EVM maintains a transient memory (as a word-addressed byte array), which does not persist between transactions.

Contracts, however, do contain a Merkle Patricia storage trie (as a word-addressable word array), associated with the account in question and part of the global state.

Compiled smart contract bytecode executes as a number of EVM opcodes, which perform standard stack operations like XOR, AND, ADD, SUB, etc. The EVM also implements a number of blockchain-specific stack operations, such as ADDRESS, BALANCE, KECCAK256, BLOCKHASH, etc. ethereum evm illustrated-2

wangxuguo commented 3 years ago

How to calculate the gas cost of XDAG and the fee of the transaction?

LucasMLK commented 3 years ago

How to calculate the gas cost of XDAG and the fee of the transaction?

1.Define the smallest unit of xdag gas Sub-units of Ether: Unit wei value wei ether value
wei 1 wei 1 10^-18 ETH
kwei 10^3 wei 1,000 10^-15 ETH
mwei 10^6 wei 1,000,000 10^-12 ETH
gwei 10^9 wei 1,000,000,000 10^-9 ETH
microether 10^12 wei 1,000,000,000,000 10^-6 ETH
milliether 10^15 wei 1,000,000,000,000,000 10^-3 ETH
ether 10^18 wei 1,000,000,000,000,000,000 1 ETH
Sub-units of Xdager: Unit nano value nano xdager value
NANO_XDAG 1 NANO_XDAG 1 10^-9 XDAG
MICRO_XDAG 10^3 NANO_XDAG 1,000 10^-6 XDAG
MILLI_XDAG 10^6 NANO_XDAG 1,000,000 10^-3 XDAG
XDAG 10^9 NANO_XDAG 1,000,000,000 1 XDAG

For ease of use, we tentatively set (1 NANO_XDAG == 1 wei)

2.Each OP_CODE Standard Gas Prices

EIP-150 opcode gas costs

3.Estimating transaction costs

Name Mean
Gas Price price (in ether) of one unit of gas specified in the transaction
Gas Used is the total gas that is consumed by the transaction

*Total cost = gasUsed gasPrice**

4.ERC-20 Token Gas for Example

Name Token Gas Price Gas Used ALL Gas
ETH ERC-20(USDT) 0.000000008 Ether 3,170,794 0.025366352

Fair Price Calculation: ETH and XDAG Prices refer to market prices on Coinmarketcap at 2021-06-24

Gas Price ERC20 Cost $ Prices $ Total Price %
0.000000008 Ether 0.025366352 Ether $ 1,928.72 / 1 ETH $ 48 100%
0.000008000 Xdager 25.36635200 Xdager $ 0.00284 / 1 XDAG $ 0.072 0.15 %
LucasMLK commented 1 year ago

It is planned to stabilize the network first, improve network stability, and then support for evm

BourgesMind commented 1 year ago

Is the plan still ongoing?

LucasMLK commented 1 year ago

Is the plan still ongoing?

https://github.com/XDagger/xdagj/issues/230

Please read this article, I think there are too many chains about evm, and it is too complicated for community projects, we are looking for a more suitable way for XDAG to realize defi capabilities