Skip to main content

Suave

Library to interact with the Suave MEVM precompiles.

Functions​

isConfidential​

Returns whether execution is off- or on-chain

Output:

  • "b": Whether execution is off- or on-chain

buildEthBlock​

Constructs an Ethereum block based on the provided bidIds. The construction follows the order of bidIds are given.

Input:

  • "blockArgs": Arguments to build the block

  • "dataId": ID of the data record with mev-share bundle data

  • "namespace": deprecated

Output:

  • "blockBid": Block Bid encoded in JSON

  • "executionPayload": Execution payload encoded in JSON

confidentialInputs​

Provides the confidential inputs associated with a confidential computation request. Outputs are in bytes format.

Output:

  • "confindentialData": Confidential inputs

confidentialRetrieve​

Retrieves data from the confidential store. Also mandates the caller's presence in the AllowedPeekers list.

Input:

  • "dataId": ID of the data record to retrieve

  • "key": Key slot of the data to retrieve

Output:

  • "value": Value of the data

confidentialStore​

Handles the storage of data in the confidential store. Requires the caller to be part of the AllowedPeekers for the associated bid.

Input:

  • "dataId": ID of the data record to store

  • "key": Key slot of the data to store

  • "value": Value of the data to store

contextGet​

Retrieves a value from the context

Input:

  • "key": Key of the value to retrieve

Output:

  • "value": Value of the key

doHTTPRequest​

Performs an HTTP request and returns the response. request is the request to perform.

Input:

  • "request": Request to perform

Output:

  • "httpResponse": Body of the response

ethcall​

Uses the eth_call JSON RPC method to let you simulate a function call and return the response.

Input:

  • "contractAddr": Address of the contract to call

  • "input1": Data to send to the contract

Output:

  • "callOutput": Output of the contract call

extractHint​

Interprets the bundle data and extracts hints, such as the To address and calldata.

Input:

  • "bundleData": Bundle object encoded in JSON

Output:

  • "hints": List of hints encoded in JSON

fetchDataRecords​

Retrieves all data records correlating with a specified decryption condition and namespace

Input:

  • "cond": Filter for the decryption condition

  • "namespace": Filter for the namespace of the data records

Output:

  • "dataRecords": List of data records that match the filter

fillMevShareBundle​

Joins the user's transaction and with the backrun, and returns encoded mev-share bundle. The bundle is ready to be sent via SubmitBundleJsonRPC.

Input:

  • "dataId": ID of the data record with mev-share bundle data

Output:

  • "encodedBundle": Mev-Share bundle encoded in JSON

newBuilder​

Initializes a new remote builder session

Output:

  • "sessionid": ID of the remote builder session

newDataRecord​

Initializes data records within the ConfidentialStore. Prior to storing data, all bids should undergo initialization via this precompile.

Input:

  • "decryptionCondition": Up to which block this data record is valid. Used during fillMevShareBundle precompie.

  • "allowedPeekers": Addresses which can get data

  • "allowedStores": Addresses can set data

  • "dataType": Namespace of the data

Output:

  • "dataRecord": Data record that was created

privateKeyGen​

Generates a private key in ECDA secp256k1 format

Input:

  • "crypto": Type of the private key to generate

Output:

  • "privateKey": Hex encoded string of the ECDSA private key. Exactly as a signMessage precompile wants.

randomBytes​

Generates a number of random bytes, given by the argument numBytes.

Input:

  • "numBytes": Number of random bytes to generate

Output:

  • "value": Randomly-generated bytes

signEthTransaction​

Signs an Ethereum Transaction, 1559 or Legacy, and returns raw signed transaction bytes. txn is binary encoding of the transaction. signingKey is hex encoded string of the ECDSA private key without the 0x prefix. chainId is a hex encoded string with 0x prefix.

Input:

  • "txn": Transaction to sign encoded in RLP

  • "chainId": Id of the chain to sign for

  • "signingKey": Hex encoded string of the ECDSA private key

Output:

  • "signedTxn": Signed transaction encoded in RLP

signMessage​

Signs a message and returns the signature.

Input:

  • "digest": Message to sign

  • "crypto": Type of the private key to generate

  • "signingKey": Hex encoded string of the ECDSA private key

Output:

  • "signature": Signature of the message with the private key

simulateBundle​

Performs a simulation of the bundle by building a block that includes it.

Input:

  • "bundleData": Bundle encoded in JSON

Output:

  • "effectiveGasPrice": Effective Gas Price of the resultant block

simulateTransaction​

Simulates a transaction on a remote builder session

Input:

  • "sessionid": ID of the remote builder session

  • "txn": Txn to simulate encoded in RLP

Output:

  • "simulationResult": Result of the simulation

submitBundleJsonRPC​

Submits bytes as JSONRPC message to the specified URL with the specified method. As this call is intended for bundles, it also signs the params and adds X-Flashbots-Signature header, as usual with bundles. Regular eth bundles don't need any processing to be sent.

Input:

  • "url": URL to send the request to

  • "method": JSONRPC method to call

  • "params": JSONRPC input params encoded in RLP

Output:

  • "errorMessage": Error message if any

submitEthBlockToRelay​

Submits a given builderBid to a mev-boost relay.

Input:

  • "relayUrl": URL of the relay to submit to

  • "builderBid": Block bid to submit encoded in JSON

Output:

  • "blockBid": Error message if any

Structs​

BuildBlockArgs​

Arguments to build the block.

  • "slot": Slot number of the block
  • "proposerPubkey": Public key of the proposer
  • "parent": Hash of the parent block
  • "timestamp": Timestamp of the block
  • "feeRecipient": Address of the fee recipient
  • "gasLimit": Gas limit of the block
  • "random": Randomness of the block
  • "withdrawals": List of withdrawals
  • "extra": Extra data of the block
  • "beaconRoot": Root of the beacon chain
  • "fillPending": Whether to fill the block with pending transactions

DataRecord​

A record of data stored in the ConfidentialStore.

  • "id": ID of the data record
  • "salt": Salt used to derive the encryption key
  • "decryptionCondition": Up to which block this data record is valid
  • "allowedPeekers": Addresses which can get data
  • "allowedStores": Addresses can set data
  • "version": Namespace of the data record

HttpRequest​

Description of an HTTP request.

  • "url": Target url of the request
  • "method": HTTP method of the request
  • "headers": HTTP Headers
  • "body": Body of the request (if Post or Put)
  • "withFlashbotsSignature": Whether to include the Flashbots signature

SimulateTransactionResult​

Result of a simulated transaction.

  • "egp": Effective Gas Price of the transaction
  • "logs": Logs emitted during the simulation
  • "success": Whether the transaction was successful or not
  • "error": Error message if any

SimulatedLog​

A log emitted during the simulation of a transaction.

  • "data": Data of the log
  • "addr": Address of the contract that emitted the log
  • "topics": Topics of the log

Withdrawal​

A withdrawal from the beacon chain.

  • "index": Index of the withdrawal
  • "validator": ID of the validator
  • "Address": Address to withdraw to
  • "amount": Amount to be withdrawn