WEMIX3.0
WEMIX3.0 (KOR)
WEMIX3.0 (KOR)
  • Introduction
    • Blockchain Basics
      • What is Blockchain?
      • Consensus Algorithm
      • Transactions
      • Gas
      • Account
  • Design
    • Architecture
    • Consensus
    • Governance
    • Minting
    • EIP1559
    • Fee Delegation
    • Eco Fund
    • Roadmap
  • Quick Start
    • Start Node
      • Use Binary
        • Command-line Option
      • Use Public API Server(RPC)
    • Connect Node
    • Account
      • Use MetaMask
    • Testnet Faucet
  • Install & Operation
    • End Node
      • System Requirements
      • Firewall Setting
      • Install Guide
    • Block Producer Node
      • System Requirements
      • Firewall Setting
      • Install Guide
    • Download
    • Operation Guide
  • dApp Developer
    • Smart Contract
      • Solidity
      • Precompiled Contracts
      • Sample Contracts
    • JSON-RPC
    • API Reference
      • Account APIs
      • Block APIs
      • Contract APIs
      • Transaction APIs
      • Event logs APIs
      • Tokens APIs
  • Tutorial
    • Wallet 생성하기
    • Test Coin 받기
    • Smart Contract 생성하기
      • Remix에서 개발하기
      • Truffle 사용하기
      • Hardhat 사용하기
    • ERC-20 Token
      • ERC-20 Contract 만들기
      • ERC-20 Token 확인하기
      • ERC-20 Token 보내기
      • ERC-20 Token API 조회하기
      • ERC-20 Token 소각하기
    • ERC-721 Token
      • ERC-721 Contract 만들기
      • ERC-721 Minting하기
      • ERC-721 Token API 조회하기
      • ERC-721 Token 소각하기
    • Fee Delegation 사용하기
  • Manual
    • Explorer
    • Wallet
  • FAQ
Powered by GitBook
On this page
  1. Design

Fee Delegation

WEMIX3.0에 적용된 Fee Delegation에 대한 설명입니다.

PreviousEIP1559NextEco Fund

Last updated 10 months ago

WEMIX3.0의 Applepie HF에 적용된 메커니즘인 Fee Delegation은 Sender가 실행하고자 하는 Transaction에 지불되는 수수료를 FeePayer가 대신 지불하는 기능입니다.

Fee Delegation Transaction은 Sender가 서명한 기존 Transaction에 FeePayer 정보를 포함하여 FeePayer가 서명한 서명 정보를 추가하여 전송 함으로써 이루어집니다.

Fee Delegation Transaction

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

Fee Delegation Transaction은 기존 Transaction 중 DynamicFeeTxType만 지원하며 LegacyTxType이나 AccessListTxType은 지원하지 않습니다.

Fee Delegation Transaction 구현을 위해 중요 변경 내용은 아래와 같으며 자세한 변경 내용은 공개된 소스를 참조하시기 바랍니다.

Fee Delegation Transaction Type (transaction.go)

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

Fee Delegation Transaction 구조(transaction.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)

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(),
    })
}

주의

Fee Delegation Transaction은 Sender가 생성한 DynamicFeeTxType Transaction의 수수료 설정값(gas, maxFeePerGas, maxPriorityFeePerGas)에 의해 수수료를 대납하기 때문에 FeePayer는 반드시 Transaction의 수수료가 적정한지 검증하는 절차를 가져야 합니다.

주의

FeePayer가 서명한 Fee Delegation Transaction은 sender의 nonce에 따라 즉시 사용되지 않을 수 있으므로, 사용자가 요청한 Transaction의 nonce가 현재 sender의 nonce보다 차이가 큰 경우에 대해서 주의해야 할 필요가 있습니다.

Fee Delegation