Monad Next: Cadence & BTX | James Hunsaker, Category Labs
Nothing is loaded from YouTube until you press play, and then without tracking cookies.
About this video
Monad Next: Category Labs CEO and Monad co-founder James Hunsaker explains plans for faster consensus and encrypted transactions, with demos of Cadence and BTX.
0:00 Introduction to Monad Next 0:29 Cadence: blocks and finality 2:33 From MonadBFT to Cadence 4:17 Encrypted transactions and block translation 5:09 Reserve balances and proposer lanes 6:43 Inclusion and ordering fees 7:50 Transaction fields and compatibility 10:11 BTX and sandwich attacks 12:32 Cadence simulation 13:12 Cadence test network demo
James Hunsaker is CEO of Category Labs and a co-founder of Monad. He leads a research and engineering team developing the consensus, execution and storage systems behind the Monad blockchain.
In this presentation at Open, Monad Foundation’s flagship event, James explains how Cadence would use multiple concurrent proposers to shorten block intervals and reduce reliance on a single block producer. He covers BTX encryption of selected transaction fields before execution, its intended protection against sandwich attacks, and the proposed separation of transaction inclusion and ordering fees. The session also covers compatibility with existing Ethereum transactions and includes a Cadence simulation and test-network demonstration of features still in development at the time of recording.
🔗 Learn more about Monad: monad.xyz
🔗 Follow Monad on X: x.com/monad
Subscribe for more conversations on blockchain infrastructure, market structure, and on-chain finance.
#Monad #CategoryLabs #Cadence #BTX #MEV #EncryptedTransactions #BlockchainInfrastructure #OnChainFinance
Transcript
3,108 wordsCaptions as YouTube publishes them, usually machine-generated, so product and people names can be misheard.
- 0:00
I'm James Hunaker, work at Category Labs, co-founder of Monad. And today I'm going to talk about Monad Next. Monad Next is actually a constant in the C++ code. That's where this name comes from. So there's a little this is actual in the execution client. And what it represents is the set of features that we have built but we haven't released yet. And so when we release features, we we switch monad next to the next version of Monad. And then Monad next rolls to the new features. So yeah. So what's
- 0:28
next for Monad? what's coming up. Uh block times right now are 300 milliseconds. You've probably seen uh some discussion of this on some of you may have seen on Twitter. The 300 milliseconds is a pacing timer where we intentionally slow down the Monet network. But the block times right now are there we go 300 seconds and finalization it takes 600 milliseconds to finalize a block. So in our new
- 0:52
consensus algorithm we're going to lower the block time to 100 milliseconds. So block will be new block will be produced every 100 milliseconds and the finalization time will drop to 300 millisecond. Um we will have uh ME protection orders will stay or transactions will stay encrypted until they're included in the block. And then finally censorship resistance via MCP multicurrent proposed. So this is this is sort of an example of uh what the new
- 1:17
speed will look like. Basically you get uh for example you get a market uh feed update from let's say Binance, right? It comes in uh you encrypt the order because you don't want to be sandwich attack. The order gets sent there's a 100 millisecond proposal time and then it's finalized. Here we put 400 uh seconds which is including the proposal time to be finalized. Okay. So here's sort of the order today. Monite transactions just timing uh RPC to
- 1:42
proposer. That's when you decide to send the transaction. It sits in the me pool uh of the leader 150 milliseconds. That's on average. Uh it can be at anywhere from 0 to 300. And then the consensus takes 600 milliseconds to final. Okay, so here's the uh cadence version. Cadence is the name of the new algorithm. And you can see this is sort of at scale. The RPC to proposer is a little bit faster. So why is it faster?
- 2:07
Because there's multiple proposers. And so you potentially could be sending to something to a proposer that is geographically closer to you. And so it'll actually cut down the time that it takes for the RPC to send to the proposer. the mempool time the blocks are produced every 100 milliseconds. So the mempool wait time on average will be about 50 milliseconds and then as I mentioned before the consensus finality drops to 300 millisecond. Um so here's the current consensus algorithm. It's a
- 2:36
monf is still pipelined but you can see the like the leader proposes it sends the block to all the validators. The validators send all their votes back to the leader the next leader. that leader includes those votes with the following proposal of the next block again votes leader three and this is when finality happens um down here. So that's why that's how you get up to the 600 milliseconds. What you can see here is
- 3:01
each each proposer follows sequentially one after another and they're building off the previous proposer's work in cadence since the block times are so low 100 milliseconds there's no way globally that you can communicate uh across the entire globe amongst all the validators within 100 milliseconds. the the longest the shortest like latency between or sorry longest latency can be like 180 or something like that. So there's no way
- 3:25
if you wanted to lower the block time down to 100 milliseconds that you could that you could um go through this sort of sequential process and still be a globally distributed network. And so what cadence does is it kind of severs the dependency between sequential blocks. And so um you have proposers that are proposing blocks when they have not yet seen the previous block uh from the previous proposer. And so uh this is even more extreme pipelining than what
- 3:51
we sort of have in moni whereas this proposal is happening before it's even seen the the previous proposer uh block. So finality comes here you have speculative finality after the first round of votes which would be at 200 milliseconds. So after you see that you could react you know if you wanted to react in the market you're trading um you could react within that time frame and then final commitment happens at
- 4:13
300. Yeah I think this is talking about the uh encryption. So we're also introducing encrypted transactions. So you have your wallet public transaction encryption gets sent to the RPC. We have a number of proposers here. The transaction is crypted. None of the proposers can see the transaction. It goes through consensus and then at this stage there's a you have since you have multiple proposers at this stage there's
- 4:36
a translation layer which takes the um multiple proposals and combines them into one block. It also is able to decrypt that encrypted transaction. Basically the private key multi-party computation is happening here. And so you get a this transaction that was encrypted over there gets decrypted here. Everything is ordered and so the sequence is basically filtering. So sorting through transactions, removing duplicates because you might have duplicates in the proposals, decrypting
- 5:03
and then ordering those transactions and then that block finally flows through execution. Okay, so that's the translation layer. So some of you may know that we have reserve balance already in Monad because Monad is a pipelined architecture. execution is um happening pipelined with consensus. And so in order to ensure that someone cannot take advantage of the protocol by basically sending transactions that they
- 5:28
can't pay for, we have this concept of reserve balance. Um so that concept is still present in the new consensus algorithm, but it has to take into account that there might be multiple concurrent proposers. And so um one of the considerations for inclusion is basically how do you design how do you divide up the reserve balance amongst multiple proposers. Okay, this is introducing uh so stable leaders. So for
- 5:52
a given um I think what I should have mentioned before is these these are basically lanes proposers and stable leaders means that you'll have the same leader will be able to propose multiple times back to back and so uh that gives a little bit more simpler logic to how you process transactions. If you included transaction from account in the previous block and then they're sending you a new transaction you already know what the nuns is so you can include it.
- 6:17
if it was a different proposer, you wouldn't know what that nuns is and so you you wouldn't be able to include it, right? And then dduplication. Uh so as I said, because we have multiple proposers, if somebody sent the same transaction to multiple proposers, it could be potentially included multiple times. Obviously, that transaction can't be executed. You wouldn't want the same transaction with the same nuns executed multiple times. And so during the translation step, we would filter out that duplicate transaction. Okay. Yeah.
- 6:45
The um fees in Ethereum are sort of uni-dimensional. Uh you can pay a priority fee uh for ordering and that also serves as an inclusion fee. In cadence, we're separating the concept of inclusion from ordering. Um the reason is ordering happens later during the translation step. And so this is really like an auction that's happening um you know to order the transactions. The inclusion fee is to pay for your
- 7:09
transaction to be included in a block to begin with. And so um in in the case of the inclusion fee, you're paying the proposer that includes your transaction to have it included. This would go to part of it goes to the proposer and part of it's burned. Then the multiple proposers are translated and compressed into one executable block as I mentioned before. And the ordering fee then determines the order of the transactions in that final block. And so why is it
- 7:33
this way? Because uh with MCP you want um you know for sensitive resistance and so forth, you want the ordering to happen after the fact. the it prevents somebody from bidding within one proposer to be at the front and so you need something that can sort of like sort the block from all the proposers and that's the ordering field. Okay, so new transactions fields. So here's an example of the encrypted field. So on
- 7:55
monad the transactions are only partially encrypted. If you wanted to encrypt the entire transaction, that would require a little bit more complex work, which would require like ZK proving that you have the funds to pay for it. And ZK is really slow and um this is sort of the first iteration that makes sense. And so in the encrypted transaction here, in this case, we're not hiding the the from address or the
- 8:19
nuns. And so then the system is able to at least determine, you know, does this account have enough to pay for this transaction? Does it is it in the right order and so on? Is it a duplicate? But the fields of like what is getting called. So who is this sent to? What what smart contract is it sent to? What what's the value? You know what's the input to that smart contract in this case the swap all that is encrypted. So with MEV, you know, you would not mostly
- 8:44
not be able to sandwich attack this transaction. Um going back to the MCP fields which were a couple slides ago, we're adding fields which is ordering bid. So this is you know what is your bid to order within the final block. Um again we're taking that unit dimensional and turning it two-dimensional problem and so we have to add an extra field for that. Uh eligible proposer eligible proposer indices is the set of proposers
- 9:08
that a transaction could appear on. So one way to guard against your transaction being included in multiple proposals is to is to put a specific indicy of the proposal that you want it to appear. Um so here's uh what you pay. You pay an inclusion fee which is the base fee plus priority times the gas limit and then the ordering fee is the bid times the gas used. Okay. So what happens to my transactions? So does current transactions still work? Yes. Uh legacy transactions legacy being the
- 9:37
standard Ethereum transactions that everyone's familiar with. They have no ordering bid and they will they can be included by any proposer. What do you pay? I think this is the same as the previous slide. If you want to put a specific ordering bid, uh, you would need to use the new transaction type.
- 9:53
Can I pay for a transaction doesn't run? Rarely you might pay the inclusion fee. So if a proposer includes a transaction that uh, for some reason can't execute due to the nuns gap or something like that, you would just pay the inclusion fee. And yes, nonses are still applicable here for monad for this consensus algorithm. Okay, demo. Okay, so I'll walk through the encrypted transaction gates. Um, so this is Monad BTX. Okay. So this is the public public transaction. So in other words, plain text transaction. Um, so you want to
- 10:22
swap USDC for Mon. So you sign the transaction and your transaction ends up in the meool and now you have this uh sandwich attacker who's basically looking at everyone's transactions. It sees that you want to swap because it can see what you're doing and it places a buy uh right before a large buy right before your transaction and a large sell right after your transaction. So the proposer of the of the block is going to
- 10:47
order this because the sandwicher paid you know a tip to basically paid them to order it this way. And so you get this sandwich attack here in the right order. And what this shows is basically the the sandwich attacker raises the price and so you get filled at this at this higher price, right? And so you get filled at this price which is bad. And then this and then the sandwich attacker exits their position and sells and so they make a profit. Okay. So let's look at the encrypted transaction case again.
- 11:12
you want the same swap 10 10,000 USDC. Um, so what happens here is the wallet goes and it fetches an encryption key from the network. So this encryption key is a public key. This is telling the u the wallet what key to encrypt the fields against. So the wallet encrypts the transaction. And so now those fields that were originally that I mentioned before the the target the the mon sent the inputs and so forth are now you know encrypted fields. That transaction goes
- 11:39
into the memp pool. there's your uh sandwich bot looking to make some money. He looks he sees a transaction. He doesn't really know anything except that that you sent it and uh what the nuns was. So he he can't react. There's nothing for him to there's no orders for him to insert. So here we have a a block that's been built. It has some plain text transactions. It has some encrypted transactions. That block is proposed.
- 12:03
The proposers the validators network communicate and they come up with a decryption key. And so this is showing the communication of the computation of the decryption key. And so once they've all communicated, they're all able to individually compute their decryption key. And so now the transactions are decrypted. They can be executed by the uh execution engine. And uh you can see that you get a much better price. Before
- 12:25
the price was like out here, that orange dot, you know, after the orange dot. So price is better. Um further this way is worse price. So you got a better pay. Let me just give you sort of a a simulation demo here of of uh cadence.
- 12:37
So on the bottom we have block interval which is 100 milliseconds. This is playing at.3x speed uh with five proposers. There was supposed to be a graphic here which is not loading. Okay, that's better. Okay, so this is this is the graphic similar to what you see on gmonads.com. You can see the network communicating with each other and this is intentionally slowed down. If we put it at, you know, full speed then it's just going so fast that you can't really
- 13:01
tell what's happen. These are 100 millisecond lock and so you're getting the uh speculative finality after 56 millisecond and finality in this case after 110 in this simulation. Um let me walk through what the explorer looks like. So this is a live network. Yeah, this is correct. So this is this time stamp is correct. This is a live network that we're running with the MCP. And so you can see that the uh block times are 100 milliseconds. Finalization latency
- 13:26
in this case is 150 milliseconds. This particular uh explorer is connected to a Singapore server. So that host name up there is in Singapore SGP. And so uh I guess somebody sent a test transaction 46 minutes ago, but I'll just go ahead and send a new one. Um and so here I can select any lane or I can select uh a specific lane. Lane being that there's proposers that are rotating within each lane. So you have five lanes. You have uh let's say 200 validators in the network. um within each lane the
- 13:58
validators are rotating across um each getting a time slot of each lane. So in this case I will just send this to lane zero to start. So we send a transaction it was included right here. So if I open this up I can see okay it's committed scroll here. I think there's a bug with this explorer but basically it's showing um these calculations are the clock must be off here on the server. Yeah let's just look at the durations. Well, yeah, this sorry these timestamps are messed
- 14:23
up because of the clocks are different, but um this is sort of the process that's happening. The the transaction is sent to that lane. Um so submission time is is 0 milliseconds. It's then forwarded uh from the RPC. It sits in the memp pool and then the memp pool uh of that proposer eventually proposes which means it sends out it broadcasts out all the blocks. Upon seeing the proposal, the other validators vote. So they send their votes back to the proposer and to each other. It's all to
- 14:54
all and then they individually finalize as they see and then so there's two rounds of voting standard and BFT but they individually finalize. Um but yeah apologies these time time stamps are off. Let me just try one more to do any lane here. Okay. So here I selected any lane. So this transaction would have been sent assuming to all of them but it was included first by the version that was included first was by lane three. Again sorry the time stamps were wrong.
- 15:18
Um here we can view the blocks. So we have uh five lanes 0 through four. Each lane has a proposer. So you can see at this partic for this particular block proposer 7 proposed for lane zero. Proposer zero proposed for lane one and so on. Uh the size of these blocks are basically empty because I'm the only one sending transactions. These were then decoded. They're merged uh and then committed. So this is a test network.
- 15:43
It's running the actual new cadence algorithm. So this is real code. This explorer obviously had a bug with the uh timestamps, but generally yes, it's all, you know, working well on a small network. And so the goal is to uh you know, resolve the main issues, finish the implementation, and get out as soon as possible. That's it.