DSS 2026 — Confidential Smart Contracts: From Mechanics to Secure Design Rogue Rotkosky · Arturo Roura Source video: https://www.youtube.com/watch?v=r5cKKHxi-rE Automatic captions — not human-reviewed. Complete spoken-audio coverage is unverified. Source language tag: en (English). Source export SHA256: 49473aac63de749b9b07c813dc290213ad23b092b9419513abdfdbf3f7e754a6 [0:00] Pass the slide. Ah, there we go. [0:04] Okay, yeah. It's a pleasure to be here [0:05] with with Rogue from Phoenix. I'm Arturo [0:08] from ConsenSys Diligence. And yeah, [0:10] we're going to be doing a small [0:11] introduction to confidential smart [0:14] contracts and trying to explain the [0:17] mental models that we have to shift [0:19] when reviewing this from a from a [0:21] security standpoint. [0:22] Take it away, Rogue. [0:23] >> Thank you. Um, yeah. So I'm from [0:26] Phoenix. Uh, [0:29] bit down. [0:32] Thank you. Um, I'm from Phoenix. The [0:35] first three letters are FHE. So I'll [0:38] assume you all know what FHE is. Um, but [0:40] if you don't, [0:42] FHE stands for fully homomorphic [0:44] encryption. [0:45] Um, this is touted as the holy grail of [0:47] encryption. It allows you to encrypt a [0:50] number, [0:51] um, but also do computation on that [0:54] number leaving it in its encrypted [0:57] state. [0:58] Uh, [0:58] this is something that is wildly [1:00] complex. However, I like this metaphor. [1:04] So [1:05] I have two volunteers from the audience. [1:08] Um, yes, George from Diligence and uh [1:11] David from Diligence. This is lucky. Uh, [1:14] I'm going to ask them to [1:18] Yes. I'm going to ask them to encrypt a [1:20] number [1:21] for me. Um, since they're brothers, they [1:23] share an encryption key. So this is [1:24] really helpful. [1:26] Um, how they're going to encrypt a [1:28] variable is they're going to think of [1:30] it. So David, [1:33] you've thought? [1:35] George? [1:36] Anything between one and two to the 256. [1:40] So it can be large. [1:42] Um, now if I came over there and I said, [1:45] barring torture, can I compel you to [1:48] give me that number? Can I put you in an [1:50] MRI? Can I slice the top of your skull? [1:52] Can I get that number from you? [1:55] Hopefully not. [1:59] But that's great. That's encryption. [2:00] We're used to encryption. Um what I want [2:02] to do is [2:04] do an operation on this number. I want [2:07] to add the two of you together. I [2:08] understand you have a third brother. [2:11] This is something new. [2:12] So [2:13] pretend I have a machine and you both [2:16] step into the machine together [2:18] and the arms descend and they start [2:20] picking at your brains and they start [2:22] stitching you two together. This is a [2:24] blind machine. It doesn't know your [2:26] names or your brains or the numbers [2:29] inside of you. It doesn't know anything [2:30] about you and it does its deterministic [2:33] pattern to stitch you two together. [2:36] And Captain America pops out of the [2:38] machine [2:41] and if we ask [2:42] the result, the person that was stitched [2:45] together from the two of you to think of [2:47] a number between 1 and 2 to the 256 [2:50] the number that he will think of [2:52] is the sum of your two numbers [2:55] because this is the sum machine. [2:57] And we've done an operation [3:00] that resulted in a new number without [3:03] ever knowing what you two thought of in [3:05] the first place. [3:06] This is an extraordinarily powerful tool [3:09] to have. [3:11] So we have addition [3:12] and we have a separate machine for [3:14] multiplication and subtraction and [3:15] division. The division machine is [3:17] gigantic. Don't [3:18] The division machine is horrible. Um [3:21] very inefficient. Well, not inefficient, [3:22] but [3:24] Once we have this, we can start to [3:27] leverage it. So we packaged all of these [3:29] machines into a box and called it [3:31] coffee. Co co FHE. It's a co-processor [3:35] that sits on top of the EVM and allows [3:38] this power [3:40] to be interfaced with via a a ecosystem [3:44] that we're already in and aware of. [3:48] So how this works is [3:51] Can you go next? Sorry. [3:54] There's two sides of this. There's the [3:55] EVM part and there's the co-processor [3:57] part. [3:58] The EVM part is very simple. I'm not I I [4:01] don't want to pitch, but it's a FHE [4:04] library [4:05] that you import into your contract. And [4:08] then Can you go to the next one? Sorry, [4:09] it has good examples. [4:11] And then instead of a plus, you now have [4:14] to call FHE.add. [4:17] And that uses the machine. What this [4:18] does is it creates an event that gets [4:21] picked up by the co-processor, [4:23] and this co-processor executes this FHE [4:25] computation [4:27] off-chain, [4:28] but in such a way and Arturo will tell [4:30] you more about this but in such a way [4:32] that these two things mirror each other [4:33] and link together deterministically. [4:37] Once we have this [4:39] once we have this stitch into the chain, [4:41] we get to start using these FHE [4:44] computations to create an ERC 20 or a [4:48] different contract that instead of [4:50] holding public balances holds a handle [4:54] to a confidential balance. And this [4:57] confidential balance you can add and you [4:59] could subtract. It's program It's [5:00] programmatic. It's composable. [5:03] And you can build the ERC 20, [5:05] but you can build on top of it as well. [5:08] Can you go next? [5:12] So this is what we did. Um we have FHE [5:14] ERC 20 standards. Um [5:17] it's called a dual-mode token. [5:20] Uh it's an ERC 20 that has an extension [5:22] on top of it that has this additional [5:24] computational uh layer. [5:27] And we wanted to make sure that this was [5:28] secure. Uh it's it we [5:31] we've all gone through processes where [5:32] we want to make sure that people aren't [5:34] taking our funds. So we reached out to [5:36] diligence and we found amazing auditors [5:39] that are willing to Yes. [5:41] Amazing auditors that are willing to [5:42] come with us on this journey to [5:44] understand [5:46] what pitfalls do you run into when you [5:48] have this new style of system? What [5:50] pitfalls [5:52] What changes the way that you write a [5:53] smart contract? [5:56] And what do those changes allow you to [5:58] break? Um [6:00] >> That's precisely it. Yeah. Um and from [6:03] my side, of course, it took a of [6:05] changing of these mental models, but [6:07] when when it clicked, we were able to to [6:09] understand how to secure these systems. [6:11] And that's what I hope for you, at least [6:13] a bit a tiny bit of this experience when [6:16] finishing this this presentation. And [6:18] but remind this phrase because it's [6:19] really really key to understand what's [6:21] going to be going on in the future. [6:23] The chain holds the handles, the [6:25] coprocessor holds the data. [6:27] So [6:29] what did the audit taught us? [6:32] A confidential contract cannot fail out [6:34] loud when manipulating encrypted data. [6:36] This might seem very evident for a lot [6:38] of you, but let's just go over this [6:40] example that's make this idea really [6:43] going to make this idea really quick. If [6:44] Alice Alice has a confidential balance [6:47] and then she decides to transfer [6:51] 150 tokens from that from that balance [6:54] and the transaction reverts, [6:56] everyone already knows that her balance [6:57] is below 150. [6:59] And that's [7:00] a lot of confidentiality that's lost [7:02] from from her. Of course, her her direct [7:05] balance hasn't been hasn't lost the [7:07] privacy, but it's way more than what a [7:09] confidential [7:10] system would want to to release as [7:11] information. [7:13] So you would think, oh, so that means [7:14] that there are no reverts. Everything [7:17] has to work correctly from the get-go. [7:19] No, we're we're actually going to find [7:20] ourselves in plenty of situations where [7:23] we would like to we're seeing that [7:24] performing this operation, [7:26] the current state that that we're in, if [7:28] we were to advance this state to a state [7:30] post operation, [7:32] that state doesn't look good for the [7:34] system. That state is it's an unwanted [7:36] state. So [7:37] we do revert. We just do it silently. [7:40] So how would the silent revert look [7:43] from from the unchained perspective? [7:46] So you can think of the Alice Alice's [7:48] balance instead of pointing to a [7:50] specific number as in an ERC 20 token, [7:54] it would point to this handle, [7:57] 32-byte hash [7:59] handle [8:00] that doesn't give us any information. [8:03] Now, as Rogue previously described, [8:05] this 32-byte handle [8:07] in the coprocessor [8:08] actually [8:10] uh is the key [8:11] pointing to an encrypted value. In this [8:13] case, it's pointing to the 100. But this [8:15] is off-chain. On-chain, we only have the [8:17] handle. [8:18] And what we know how how would we revert [8:21] uh this to the original state? Well, [8:23] on-chain you wouldn't really know if [8:24] anything reverted because you would see [8:25] that after the queued operations, [8:28] Alice's new balance points to oh a [8:30] different handle. [8:32] No information leaked there. [8:33] But if we were to decrypt the the value [8:35] that this new new new handle is has in [8:39] in the off-chain uh system, we would see [8:41] that it's actually the same value. [8:44] So here you can get a glimpse of of how [8:46] the handles work in in tandem with the [8:48] with the coprocessor. But just to [8:51] really understand it through, let me go [8:53] through a code example that I'm sure [8:55] most of us us in this room would [8:57] appreciate. [8:58] How [8:59] this this example really would help us [9:01] understand specifically how the on-chain [9:03] part [9:04] works hand in hand with the coprocessor. [9:07] So you're looking at trade decrease. In [9:10] a regular ERC 20 token, you would expect [9:13] in in a let's say underscore update on [9:17] uh you would expect some kind of require [9:20] statement checking that [9:22] hey, has the the account that we are [9:24] transferring from enough balance to [9:26] actually send out money? Because if not, [9:27] we would be basically minting money, [9:29] right? Out of thin air. [9:31] So this is very much like the the first [9:33] line that you see here. [9:35] What we're doing is we're calling the [9:37] FAT library with a greater than or equal [9:39] operation, which is going to return an [9:41] EBO. [9:42] And this EBO is an encrypted EBO, right? [9:45] We from the on-chain perspective, [9:48] we don't really know if that EBO is [9:49] going to be true or false. [9:51] Handles are deterministic. So for that [9:53] matter, we can already know at this [9:55] state at this point that [9:58] the handle is going to be let's say X. [10:01] So we just use that handle and we say we [10:04] call it success. [10:06] Now on the next operation, let's let's [10:08] make it as simple as possible. With with [10:10] that previous information, if it is [10:12] greater than or equal, it it means that [10:15] the transactional should be successful, [10:17] right? There's enough old value, meaning [10:19] there's enough old balance before to [10:21] actually perform the transfer of the [10:23] delta that's that's leaving the the [10:25] account. [10:26] And the next line you're going to see [10:28] that [10:29] that we're queuing several different uh [10:32] if uh [10:34] FAT operations, right? Calling to to the [10:36] FAT library. You're you're going to see [10:38] mainly two parts. [10:39] This part over here, [10:41] which is [10:42] what would happen if success was true, [10:44] right? If this e bull was true. [10:47] Well, we would queue another operation [10:49] to the co-processor that goes right [10:51] after the the other one, [10:53] after the the greater than or equal, [10:55] saying please [10:57] get us the result of [10:59] the old balance minus the amount we're [11:02] transferring out, which would be the [11:03] outcome of the the final balance of [11:05] Alice if everything were to go [11:07] correctly, right? [11:08] Now, if the transfer should revert, we [11:12] want to leave the balance as it was [11:13] prior to the to the to the transfer. So, [11:16] we're just leaving old value. [11:18] And we're going to And finally, we're [11:19] getting updated, which is going to be [11:21] the the balance of Alice at the end of [11:24] the operation. So, if you were to ask in [11:26] the future, hey, what's the what's [11:28] Alice's balance? It will be that [11:30] variable over there. It would be just a [11:32] handle. [11:33] So, all in all, [11:34] you would see that queuing these three [11:36] operations uh into the co-processor, [11:39] you will end up with [11:41] two different states from the unchained [11:43] perspective. Unchain, it's not clear if [11:46] it was if it the success was [11:49] the the transfer was successful or the [11:51] transfer was was unsuccessful. [11:54] So, again, going back to the the last [11:56] phrase, from the unchained perspective, [11:58] you only see the shapes of operations. [12:00] You don't see the data. It's only the [12:02] co-processor where the data gets [12:05] manipulated and of of course in an [12:06] encrypted manner. [12:09] So, we've been talking about handles and [12:11] deterministic handles and so on, but I [12:12] think there's another important uh I [12:14] mean, many of the security researchers [12:16] over here are going to think handles. [12:18] Okay, so you can get this handle and you [12:20] can manipulate the these bytes and maybe [12:23] maybe I can put it in a different [12:25] function and actually try to use it for [12:28] other purposes. For example, if if Rogue [12:30] had a a certain uh balance uh a handle [12:33] that represented his balance, what if I [12:35] got that same exact hash and put it on [12:39] my system and try to transfer that [12:41] amount out of my of my of my own [12:44] balance? That way I would know what what [12:46] balance he's holding, right? [12:48] Um well, the answer is this obviously is [12:51] is thought of about by the Phoenix team. [12:53] There's a specific contract that's in [12:54] charge of saying [12:56] who is the owner of each uh handle, [13:00] who's able to manipulate these and who [13:03] can actually perform or grant uh [13:06] uh allowance to use uh these handles to [13:09] other contracts. And this is greatly [13:11] important because you can imagine that [13:12] in encrypted systems [13:14] they it's not about a single user [13:16] performing a transfer, but it's very [13:19] multi-layered contracts that pass [13:21] allowances from one side to the other. [13:23] So I would say from a security [13:24] standpoint, it's our job to have a very [13:27] very clear idea of [13:30] what what allowances does this contract [13:33] or should this contract hold at this [13:34] moment? So these encrypted variables, is [13:36] it absolutely necessary that this uh [13:39] this contract is able to decrypt this [13:42] this value or pass this this uh this [13:45] allowance to another contract? [13:50] And yeah, um this is the way basically [13:53] constructing with these complicated [13:54] contracts uh one on top of the other in [13:57] a confidential way is how you can [13:59] clear numbers on nobody has ever seen [14:01] with in an entire market. You can [14:03] construct from auction tokens to OTC [14:06] markets, [14:07] regular tokens, and there's many more [14:08] examples to of of different systems that [14:11] can leverage this wonderful technology. [14:14] >> It's amazing you found all this [14:16] Am I on? It's amazing you found all this [14:18] without any of those issues in our code. [14:21] [laughter] [14:23] Uh yeah, just thank you to the diligence [14:25] team for doing the audit. Um [14:28] it's really interesting to work on [14:31] something that's pushing a frontier and [14:35] and have another team that gets to look [14:37] at it and and find the issues with it. [14:39] There's some really interesting things [14:40] that we found, especially with [14:42] allowances that changed the way that we [14:44] built our libraries. Um [14:48] we think the FHE is really exciting. [14:50] Um [14:51] and it's great to have another team that [14:53] knows how to look at it securely. [14:55] So anyway, sorry, I'm gushing at the [14:56] end. [14:57] >> It's been a I I [14:58] I hope that our passion for for [15:00] confidential contracts has touched you a [15:02] bit and I urge you all to take a look at [15:04] confidential contracts because it it [15:05] really is an very interesting topic. [15:07] Thank you very much. [15:08] >> Thank you. Thank you. [15:09] >> [applause]