Skip to main content

Builder Solidity

Builder solidity is a superset of Solidity with additional precompiles to support decentralized MEV applications. It looks something like this [🔗 source]:

pragma solidity ^0.8.8;

import "../libraries/Suave.sol";

contract AnyBidContract {

event BidEvent(
Suave.BidId bidId,
uint64 decryptionCondition,
address[] allowedPeekers
);

function fetchBidConfidentialBundleData() public returns (bytes memory) {
require(Suave.isConfidential());

bytes memory confidentialInputs = Suave.confidentialInputs();
return abi.decode(confidentialInputs, (bytes));
}

function emitBid(Suave.Bid calldata bid) public {
emit BidEvent(bid.id, bid.decryptionCondition, bid.allowedPeekers);
}
}

Builder solidity contracts are used to define the public logic that is used for confidential computation. Using a precompile like confidentialInputs allows SUAVE computors to access encrypted data from users, do stuff with it privately and only reveal the results, not the inputs.

This ensures confidentiality and improves efficiency, enabling computation that is not possible on blockchains like Ethereum.

To get your hands on working examples of builder solidity contracts, we recommend our how to write a contract guide.

Confidential Computation

TODO:

  1. Explain view functions and how we use those for execution of confidentialComputeRequests
  2. An example of a very simple request and response object on a view function to show how it all works with data points
  3. A more in-depth data flow

Further context

We recommend this early research talk from Andrew Miller to get a sense of the ideas from which builder solidity has grown.

Please note that the pseudo code Andrew shows is now outdated and you are better off learning from our how to write a contract guide above, or looking directly at our list of available precompiles. That said, the framework used in this talk and the background provided should still prove useful when writing your own builder solidity contracts.