You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As per the above outputs, the smart contract has not received any decryption keys for the sealed bids. This is because the bids were encrypted with the auction ending block number which is `56` as in Step 3 and this block number has not reached or been mined on the local Anvil blockchain. Therefore, without the decryption keys, none of the bids can be unsealed by the auctioneer.
157
157
@@ -167,18 +167,19 @@ As per the above outputs, the smart contract has not received any decryption key
167
167
npm run skip:to-block 57 $RPC_URL
168
168
```
169
169
170
-
3.**Verify Fulfilled Timelock Requests**:
170
+
3.**Verify fulfilled timelock requests**:
171
171
When we check the logs for the timelock service from the project root folder:
172
172
```bash
173
173
docker compose logs blocklock
174
174
```
175
175
we should see a new transaction being sent at block `58` in the Anvil blockchain logs as well as the following logs in the timelock agent console showing that the timelock encryption agent has now signed the Ciphertexts from the two earlier sealed bid events and sent the decryption key to the `SignatureSender` smart contract which forwards the signature to the `SimpleAuction` smart contract via the `BlocklockSender` contract:
176
176
```
177
+
creating a timelock signature for block 56
177
178
fulfilling signature request 1
178
179
fulfilled signature request
179
180
```
180
181
181
-
### Step 6: End the Auction
182
+
### Step 6: End the auction
182
183
183
184
1. Use the auction smart contract deployer (auctioneer) private key to end the auction:
184
185
```bash
@@ -187,9 +188,9 @@ we should see a new transaction being sent at block `58` in the Anvil blockchain
187
188
--rpc-url $RPC_URL
188
189
```
189
190
190
-
### Step 7: Reveal Bids and Verify Data
191
+
### Step 7: Reveal bids and verify data
191
192
192
-
1.**View Bid Data and Get Decryption Key**:
193
+
1.**View bid data and retrieve decryption key**:
193
194
- Retrieve and decode data for Bidder A to view the `decryptionKey` and check the `revealed` status and `unsealedAmount`:
This should return five outputs on separate lines. These are:
203
205
* `bytes sealedAmount` - the ciphertext representing the (timelock encrypted) sealed bid.
204
206
* `bytes decryptionKey` - the decryption key used to decrypt the sealedAmount.
@@ -208,7 +210,7 @@ we should see a new transaction being sent at block `58` in the Anvil blockchain
208
210
209
211
We can now see that the decryptionKey has been sent to the auction smart contract after the auction end block number was identified by the timelock agent. The decryptionKey is no longer an empty byte string `0x`. Using the ciphertext and decryption key from the output above, we can decrypt the sealed bid to reveal the bid amount and confirm that the amount is the same as the amounts we encrypted to ciphertexts earlier for each bidder - Bidder A and Bidder B.
210
212
211
-
2. **Decrypt Bid Amounts Using Decryption Keys (Signature over Ciphertext)**:
213
+
2. **Decrypt bid amounts with decryption keys (i.e., signature over the Ciphertext)**:
212
214
```bash
213
215
npm run timelock:decrypt -- --ciphertext <replace with ciphertext from decoded output> --signature <replace with signature or decryption key from decoded output>
214
216
```
@@ -235,35 +237,35 @@ we should see a new transaction being sent at block `58` in the Anvil blockchain
235
237
236
238
We can repeat the same steps for Bidder B's sealed bid.
237
239
238
-
3.**Convert Decrypted Value from Wei to Ether**:
240
+
3.**Convert decrypted value from Wei to Ether**:
239
241
If we convert the decrypted value from wei to ether, we should get 0.3 ether which we encrypted as wei earlier for Bidder A in Step 4.
240
242
```bash
241
243
cast from-wei 300000000000000000
242
244
```
243
245
We can repeat the decryption steps for Bidder B and confirm the decrypted amount.
244
246
245
-
4.**Reveal Bid Amounts on-chain with Auctioneer Key**:
246
-
Now the auctioneer can reveal the bid amounts in the smart contract and with the decryption keys, anyone can verify the revealed amounts are correct with the decryption keys which have only been made available after the auction ending block number.
247
+
4.**Reveal bid amounts on-chain with auctioneer as transaction signer**:
248
+
Now the auctioneer can reveal the bid amounts in the smart contract and with the decryption keys, and anyone can verify that the revealed amounts are correct with the decryption keys which are now on-chain and have only been made available to the auction smart contract after the auction ending block number.
@@ -282,7 +284,7 @@ we should see a new transaction being sent at block `58` in the Anvil blockchain
282
284
283
285
We can now see that the `unsealedAmount` is the amount in Wei that was encrypted in Step 4 and the `revealed` flag in the bid data has now been set to `true` for both bidders.
284
286
285
-
6. **View Highest Bid Amount and Highest Bidder Address**:
287
+
6. **View highest bid amount and highest bidder address**:
@@ -310,7 +312,7 @@ we should see a new transaction being sent at block `58` in the Anvil blockchain
310
312
311
313
### Step 8: Optional extra tasks to finalise the auction process.
312
314
313
-
1.**Fulfil Highest Bid**:
315
+
1.**Fulfil highest bid**:
314
316
To finish off the auction process, bidder B can fulfil the highest bid by paying 0.3 ether which is the difference between the highest bid amount of 0.4 ether and the reserve price of 0.1 ether paid by all bidders during the sealed bid transaction.
0 commit comments