Skip to content

Commit

Permalink
Two reminders to use web3.js on MOAC network
Browse files Browse the repository at this point in the history
  • Loading branch information
mdranger committed May 14, 2021
1 parent 920a790 commit 510265e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

## 墨客伏羲 2.x

### Fuxi v2.1.0:
2021/05/14

使用以太坊 web3.js 开发MOAC应用的两个注意问题
1,MOAC链的一般交易, gaslimit是1000,如果用web3来做sign的话,gaslimit仍必须要21000以上了,这个21000是web3的限制,实际使用仍是1000 gas;

2,当使用web3.eth.accounts.signTransaction 来做签名交易时,如果用web3.eth.sendSignedTransaction(signedTx.rawTransaction)来发送交易,sendSignedTransaction的结果里面有一个transactionHash。这个transactionHash是web3.js本地生成的,和以太坊上receipt中的transactionHash一致。但是,MOAC的receipt中的transactionHash,即实际链上产生的transactionHash,和web3.js本地产生的不一致。开发者需要使用receipt给出的为准。

### Fuxi v2.1.0:
2021/05/12

Expand Down
8 changes: 8 additions & 0 deletions READMEen.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

## MOAC Fuxi 2.x

### Fuxi v2.1.0:
2021/05/14

Two reminders for the developers using Ethereum web3.js library on MOAC net work:
1. The gas cost for one simple transaction, not contract call, on MOAC network is 1000 instead of 21000 on Ethereum network. But web3.js still requires the input gasLimit over 21000. The actual cost is 1000 gas.

2. When using web3.eth.accounts.signTransaction to sign a transaction, if you use web3.eth.sendSignedTransaction(signedTx.rawTransaction) and get a returned transactionHash. This transactionHash is the same as Ethereum network, but not the MOAC network. This is because MOAC network has extra fields to perform layer 2 transactions. To get the correct transactionHash value, please use transactionHash in the TX receipt instead.

### Fuxi v2.1.0:
2021/05/12

Expand Down

0 comments on commit 510265e

Please sign in to comment.