From c759e4856c84db404c70bd3c4bfd0533dd762c5c Mon Sep 17 00:00:00 2001 From: Mateusz Morusiewicz <11313015+Ruteri@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:26:28 +0200 Subject: [PATCH] Readme fixups --- README.md | 67 +++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 55d12d796e..86e0a726f5 100644 --- a/README.md +++ b/README.md @@ -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, @@ -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. @@ -187,20 +188,20 @@ 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` @@ -208,12 +209,10 @@ type ConfidentialComputeRecord struct { 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` @@ -221,12 +220,12 @@ type ConfidentialComputeRequest struct { 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)