Skip to content

Commit

Permalink
Readme fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruteri committed Oct 4, 2023
1 parent 42dc985 commit c759e48
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ Let’s take a look at how you can request confidential computation through an e

1. Pick your favorite execution node. You’ll need its URL and wallet address. Note that the execution node is fully trusted to provide the result of your confidential computation.

2. Craft your confidential computation request. This is a regular Ethereum transaction, where you specify the desired contract address and its (public) calldata. I’m assuming you have found or deployed a smart contract which you intend to call. Don’t sign the transaction quite yet!
2. Craft your confidential computation record. This is a regular Ethereum transaction (fields are similar to `LegacyTx`), where you specify the desired contract address and its (public) calldata. I’m assuming you have found or deployed a smart contract which you intend to call. Don’t sign the transaction quite yet!

```go
allowedPeekers := []common.Address{newBlockBidPeeker, newBundleBidPeeker, buildEthBlockPeeker} // express which contracts should have access to your data (by their addresses)
confidentialComputeRequestInner := &types.LegacyTx{
confidentialComputeRecord := &types.ConfidentialComputeRecord{
ExecutionNode: "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B",
Nonce: suaveAccNonce,
To: &newBundleBidAddress,
Value: nil,
Expand All @@ -66,20 +67,20 @@ Let’s take a look at how you can request confidential computation through an e
}
```

3. Wrap your regular transaction into the new `ConfidentialComputeRequest` transaction type, and specify the execution node’s wallet address as the `ExecutionNode` field. Sign the transaction with your wallet.
3. Wrap your compute record into a `ConfidentialComputeRequest` transaction type, and specify the confidential data.

```go
confidentialDataBytes := hexutil.Encode(ethBundle)
confidentialComputeRequest := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{
ExecutionNode: "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B",
Wrapped: *types.NewTx(&confidentialComputeRequestInner),
ConfidentialComputeRecord: confidentialComputeRecord,
ConfidentialInputs: confidentialDataBytes,
}), suaveSigner, privKey)
```

4. Request confidential computation by submitting your transaction along with your confidential data to the execution node you chose via `eth_sendRawTransaction`.
4. Request confidential computation by submitting your transaction to the execution node you chose via `eth_sendRawTransaction`.

```go
confidentialDataBytes := hexutil.Encode(ethBundle)
suaveClient.Call("eth_sendRawTransaction", confidentialComputeRequest, confidentialDataBytes)
suaveClient.Call("eth_sendRawTransaction", confidentialComputeRequest)
```

5. All done! Once the execution node processes your computation request, the execution node will submit it as `SuaveTransaction` to the mempool.
Expand Down Expand Up @@ -187,46 +188,44 @@ We introduce a few new transaction types.
This type serves as an onchain record of computation. It's a part of both the [Confidential Compute Request](#confidential-compute-request) and [Suave Transaction](#suave-transaction).

```go
type ConfidentialComputeRecord struct {
ExecutionNode common.Address
ConfidentialInputsHash common.Hash
// LegacyTx fields
Nonce uint64
GasPrice *big.Int
Gas uint64
To *common.Address `rlp:"nil"`
Value *big.Int
Data []byte
// Signature fields
}
type ConfidentialComputeRecord struct {
ExecutionNode common.Address
ConfidentialInputsHash common.Hash
// LegacyTx fields
Nonce uint64
GasPrice *big.Int
Gas uint64
To *common.Address `rlp:"nil"`
Value *big.Int
Data []byte
// Signature fields
}
```

* `ConfidentialComputeRequest`

This type facilitates users in interacting with the MEVM through the `eth_sendRawTransaction` method. After processing, the request's `ConfidentialComputeRecord` is embedded into `SuaveTransaction.ConfidentialComputeRequest` and serves as an onchain record of computation.
```go
type ConfidentialComputeRequest struct {
ExecutionNode: address,
Wrapped Transaction,
ConfidentialComputeRecord
ConfidentialInputs []byte
}
type ConfidentialComputeRequest struct {
ConfidentialComputeRecord
ConfidentialInputs []byte
}
```
* `SuaveTransaction`
A specialized transaction type that encapsulates the result of a confidential computation request. It includes the `ConfidentialComputeRequest`, signed by the user, which ensures that the result comes from the expected computor, as the `SuaveTransaction`'s signer must match the `ExecutionNode`.

```go
type SuaveTransaction struct {
ExecutionNode common.Address
ConfidentialComputeRequest ConfidentialComputeRecord
ConfidentialComputeResult []byte
/* Execution node's signature fields */
}
type SuaveTransaction struct {
ExecutionNode common.Address
ConfidentialComputeRequest ConfidentialComputeRecord
ConfidentialComputeResult []byte
/* Execution node's signature fields */
}
```

![image](suave/docs/conf_comp_request_flow.png)
Expand Down

0 comments on commit c759e48

Please sign in to comment.