Polygon FastLane
  • What is Polygon FastLane?
    • Overview
    • Design Principles
    • Components
    • Component Diagram
  • Getting Started as a Validator
    • Getting Started as a Validator
    • Connecting to a FastLane Sentry Node
      • Finding Your Enode Address & Peer ID
      • Adding FastLane as a Static Peer
    • Patching Your Sentry Nodes With The FastLane Patch
      • Installing from source
        • Patch Download
        • Patch Installation
      • Installing from packages
  • Withdrawing Validator Revenue
    • Validator Vault
      • Connect an Eligible Wallet
      • Revenue Redemption (withdrawal)
  • Searcher Guides
    • Getting Started as a Searcher
      • Solver Call Data
      • Submission Methods
      • Migration Guide for Searchers
    • Bundles (Backruns)
      • Bundle Format
      • Bid Submission
      • Bundle Requirements
      • Full Example
      • Subscribe Events
    • 4337 Bundles Integration Guide
      • Overview
      • How it works
      • RPC Reference
      • Examples
    • Searcher Contract Integration
      • Safety Considerations
      • atlasSolverCall
      • Direct Implementation
      • Proxy Implementation
      • Solver Concepts
      • Altas Bonding Concept
      • Bond atlETH
      • Estimating Solver Gas Charges
    • Addresses & Endpoints
    • Helpers
    • Common Mistakes
    • Atlas SDK's
  • Tools and Analytics
    • FastLane Bundle Explorer
      • Features Overview
      • Key Components
      • Usage Example
      • Error Codes & Troubleshooting
  • Key Concepts
    • Transaction Encoding
  • INFRASTRUCTURE
    • Health Status Endpoint
  • Reference
    • Relay JSON-RPC API
    • Relay REST API
    • Glossary of Terms
Powered by GitBook
On this page
  1. Key Concepts

Transaction Encoding

Submitting transactions to the PFL Relay is done using a JSON-RPC endpoint similar to eth_sendRawTransaction which means that a knowledge of how to encode transactions into hex (the wire format) is necessary.

Transactions are usually constructed and sent using one of the higher-level web3 libraries such as web3py or web3.js, to prepare a transaction for sending we would usually do something like:

pfl_contract = web3.eth.contract(address=PFL_CONTRACT_ADDRESS, abi=SOME_ABI)

example_tx_base = {
    'from': '0x1',
    'nonce': 0,
    'gasPrice' : 45,
    'gas': 500_000,
    'value': 1000,
    'chainId': 137,
}

some_abi_args = {}

example_tx = pfl_contract.functions.submitFlashBid(
  **args
).buildTransaction(example_tx_base)

signed_example_tx = web3.eth.account.sign_transaction(example_tx, PRIVATE_KEY)

Under the hood, when we make a web3 call like this the library is first encoding our transaction object into a standardized hex representation before making a JSON-RPC call to the above endpoint using whatever transport mechanism you have your web3 library configued to use (usually HTTP, WebSockets or IPC).

To simply retrieve the hexadecimal encoded representation of our transaction as is required for creating a PFL bundle instead of sending to the RPC, we can simply do:

print('data: ', signed_example_tx.hex())

This value could then be used to make a raw JSON-RPC call without your web3 library, like so:

// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":[{see above}],"id":1}'
// Response
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

PreviousError Codes & TroubleshootingNextHealth Status Endpoint

Last updated 6 months ago

For more information, see the Ethereum JSON-RPC documentation .

here