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:
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:
This value could then be used to make a raw JSON-RPC call without your web3 library, like so:
For more information, see the Ethereum JSON-RPC documentation here.
Last updated