EIP-1559 분석

이더리움 2021. 7. 12. 19:27

출처 : https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md

        https://github.com/ethers-io/ethers.js/issues/1610

       https://web3py.readthedocs.io/en/stable/web3.eth.html

       https://github.com/ethers-io/ethers.js

항목 AS_IS TO_BE
Gas - 사용자가 실시간 현 시세를 인지 해야됨


- 거래소의 출금지갑이 pending 발생시
  이후 모든 트랜젝션이 오류 장애 발생 요인


- 지갑 , Dapp 개발자 gas비 실시간
  조회 기능
- 수수료 예측 및 조회 확률이 이전 보다 높아짐

- Pending으로 인한 송금 실패는 현저히
  줄어 들것 임


- Dapp 더욱 더 활성화 될것으로 예상
채굴자 보상 -블록생성시 발생되는 이더리움과
  GAS 모두 채굴로 보상 받음
-단기적 보상이 줄어들어 이더리움 가격이
     상승이 동반 되지 않을시 채굴자 대거 이탈
     (이더리움 클래식, 제트캐쉬)


-전체 장비 중 일부만 운영 예상 (20% ~50%)
-
-장기적인 관점으로 트랜젝션이 늙어나고 소각량도 많아져 가격 상승하여 회귀 할것으로 예상
capacity - 블록사이즈(고정) : 12.5M
 
- 최초 가격이 현재 시세보다 높게 잡아
  사용자들이 지불 해야되는 비용이 증가


- 경쟁 방식 가장 높은 비용을 지불한
  사용자가 우선 전송
 
-블록사이즈(가변) :12.5 M  -> 25M
    네트워크 용량의 50%이상 사용시
    더 많은 데이터를 블록에 저장


- 이더리움 유통량이 점점 줄어들것으로 예상

 

 

 

기존 레거시 송금
https://ropsten.etherscan.io/tx/0xbc665337265e7d23f63ba50b2d2ba6db4b6e200c35c89b08cba7491996d9ef78

var Web3 = require("web3")
var web3 = new Web3("https://ropsten.infura.io/v3/API키")
var privateKey = "개인키"
const toAddress = "0x7a0e3AB3c9626018850c06A099981F0B1f183D95";
var tx = {
 to: toAddress,
 value: "300000000000000000",
 chainId: 3,
 gas: 21000
}

const app = async () => {
  try {
   var signed = await web3.eth.accounts.signTransaction(tx, privateKey);
   console.log('SIGN', web3.eth.sendSignedTransaction(signed.rawTransaction));
  }catch (error) { console.log('Task Failure',error);
 }
};
app();

 

 

 

 

EIP-1559 송금
https://ropsten.etherscan.io/tx/0x901cada97279cd77daf2e8202356d5a81eae0c918ab9bebe475eb1def7f213be

var Web3 = require("web3")
var web3 = new Web3("https://ropsten.infura.io/v3/API키")
var privateKey = 개인키
const toAddress = "0x07098B928D40E6Bd143EB9550FbBb5c2ca0Ec1E5";


var tx = {
 to: toAddress,
 value: "10000000000000000",
 chainId: 3,
 gasLimit: 21000,
 gasPrice:   10000,
 gasFeeCap:  10000,
 gasTipCap:  50000,
}


const app = async () => {
  try {
   var signed = await web3.eth.accounts.signTransaction(tx, privateKey);
   console.log('SIGN', web3.eth.sendSignedTransaction(signed.rawTransaction));

  }catch (error) { console.log('Task Failure',error);
 }
};
app();

Txn Type : 0 (Legacy) 로 보이는 부분은 아직 잘 모르곘다.

 

 

공식 문서로 정리를 하긴 할텐데 가장 짜증나던 부분이

같은 의미인데 여러가지 함수로 사용된 부분이다.

노드에서 sign트렌젝션에 대해 검증을 하면 결국 하나의 함수명으로 처리 될텐데

왜 이렇게 해깔리게 작성한지 모르겠다.

 

 

코드 npm 모듈 ethereumjs/tx

import Common from '@ethereumjs/common'
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx'

const common = new Common({ chain: 'ropsten'hardfork: 'london' })

const txData = {
  "data": "0x1a8451e600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x02625a00",
  "maxPriorityFeePerGas": "0x01",
  "maxFeePerGas": "0xff",
  "nonce": "0x00",
  "to": "0xcccccccccccccccccccccccccccccccccccccccc",
  "value": "0x0186a0",
  "v": "0x01",
  "r": "0xafb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9",
  "s": "0x479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64",
  "chainId": "0x03",
  "accessList": [],
  "type": "0x02"
}

const tx = FeeMarketEIP1559Transaction.fromTxData(txData, { common })
console.log(tx);


 

 

실행 결과 

[nodemon] 2.0.12
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `babel-node ether.js`
FeeMarketEIP1559Transaction {
  activeCapabilities: [ 1559, 2718, 2930 ],
  DEFAULT_CHAIN: 'mainnet',
  DEFAULT_HARDFORK: 'london',
  _type: 2,
  nonce: <BN: 0>,
  gasLimit: <BN: 2625a00>,
  to: Address {
    buf: <Buffer cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc cc>
  },
  value: <BN: 186a0>,
  data: <Buffer 1a 84 51 e6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 18 more bytes>,
  v: <BN: 1>,
  r: <BN: afb6e247b1c490e284053c87ab5f6b59e219d51f743f7a4d83e400782bc7e4b9>,
  s: <BN: 479a268e0e0acd4de3f1e28e4fac2a6b32a4195e8dfa9d19147abe8807aa6f64>,
  common: Common {
    _events: [Object: null prototype] {},
    _eventsCount: 0,
    _maxListeners: undefined,
    _supportedHardforks: [],
    _eips: [],
    _customChains: [],
    _chainParams: {
      name: 'ropsten',
      chainId: 3,
      networkId: 3,
      defaultHardfork: 'istanbul',
      consensus: [Object],
      comment: 'PoW test network',
      url: 'https://github.com/ethereum/ropsten',
      genesis: [Object],
      hardforks: [Array],
      bootstrapNodes: [Array],
      dnsNetworks: [Array]
    },
    DEFAULT_HARDFORK: 'istanbul',
    _hardfork: 'london',
    [Symbol(kCapture)]: false
  },
  chainId: <BN: 3>,
  accessList: [],
  AccessListJSON: [],
  maxFeePerGas: <BN: ff>,
  maxPriorityFeePerGas: <BN: 1>
}
[nodemon] clean exit - waiting for changes before restart

 

 

 

 

'이더리움' 카테고리의 다른 글

풀노드 구축  (0) 2024.03.13
graphsq + mongodb  (0) 2021.06.08
스마트컨트렉 함수 접근 방법  (0) 2020.12.08
token 송금  (0) 2019.10.28
rinkeby.io facebook으로 테스트 이더 받기  (0) 2019.10.25
블로그 이미지

iesay

,