Docker for Jam, so you can load it with an executable and it provides an encapsulation, a whole virtual machine, and it will run that executable indefinitely in that virtual machine for you in a standard environment that you know is going to work exactly as you expect.
So CoreVM emulates a machine with near x64 speed. It's RISC-V compatible and therefore targetable by Rust, C, C++, or indeed anything that can target LLVM. It has paged memory, so you get just a regular 32-bit address space, nothing special going on here, it's normal. It has continuous execution, nothing special going on here, it's normal. Not normal for blockchain, normal for software developers. It has message passing, comes as standard. It can run normal software compiled from normal languages using normal abstractions.
So in this container, this kind of Docker, we can run normal software, software that's not meant for blockchain, software like Doom.
Now if this works, and this is the first time I've tried this, okay, well, might be all right. Let's have a look. Okay, I can see up here, that's good. I am going to run this little script now. What the script is doing is it's creating a small testnet of six nodes. All the nodes live on this laptop, which means they're not going to be running at full Jam speed, but it will be enough. Those six nodes, which have six validators therefore and two cores, are... oh, let me put this window over here. There we go. Are processing the Doom executable.
And there is another process running which is monitoring the Jam chain and the Jam DA and feeding frames out of the DA in here. The frames are timestamped on the chain, right? And it's reading the frames from the DA that the chain is producing and according to the timestamp, displaying them in this window.
So in real time, right now, and you can kind of see it if you look in the background, every 6 seconds a block is produced which provides 6 seconds of Doom frames, and we're just displaying those Doom frames. This isn't a special version of Doom, this is just Doom. I just targeted it to PVM. Right, there's a little bit extra that basically is a graphics driver that just takes the virtual frame buffer and sticks it in the DA, and other than that, this is unmodified Doom.
This isn't using much of a core, right? You can probably run 20 or 30 Dooms, maybe more, in a Jam core. And Jam has 341 cores. Jam is a supercomputer. You can run regular software unmodified on Jam.
Now this will keep going for a while yet, but I should really get along with the talk. So unfortunately you're going to have to take your eyes away now. In principle we could make that demo do some input as well, like we could have people send transactions to Jam for like how to move, right? That's just going through the regular sort of demo sequence that it does if you just run the executable.
So let's have a quick review of what was happening there. Uploaded onto Jam is the CoreVM service. This is like Docker for Jam. Inside of Docker for Jam there is a container that just has the Doom executable, right? Together with, actually, I think it's CoreVM that has this virtual frame buffer that just uses the DA for storing frames. There's an offchain sequencer that's basically just pinging this thing just saying make the next 6 seconds of frames.
Now the DA is used to read the RAM that was in this virtual machine, right? So basically every time the virtual machine generates another 6 seconds worth of frames, at the end of that, totally without Doom's knowledge, the whole of the RAM is being parceled up and put into Jam's DA store. At the beginning of the next one, totally unbeknown to Jam, that RAM is being read from the DA store and placed back inside the virtual machine. From Doom's perspective, nothing has changed. It's just continuous execution.
In addition to this RAM that's going in and out, at the end of the 6 seconds also we output the video frames, basically the output of the graphics card, into the DA as well. And because we have 12 megabytes for every 6 seconds of DA access, this is fine.
Now we have a separate process outside of Jam that's monitoring this CoreVM service to see when new frames have been generated. And then inside of the CoreVM service on the chain, it gets given the references, the cryptographic commitments to where the frames are in the DA store, and then separately uses those to grab the frames and display them in a window.
So how are we doing this? Well, Jam, we have our data lake. It's only with this massive amount of bandwidth that we could possibly do this. Like, there is no way you could execute Doom on Ethereum. We also pipeline a lot. We do one accumulate at the same time as doing another refine, and in fact we pipeline even more than that. Our accumulate is so... even 10 milliseconds, it doesn't seem very much compared to 5 seconds, but it's actually more than we would otherwise be able to do in a synchronous system because we actually pipeline blocks.
And we do this with a very special trick. Instead, for those who know about block data structures, instead of providing inside of the block header the posterior state root, a commitment to everything that the block after the block is executed, we only put in the block header the prior state root, a commitment to what it began with. This allows the author of the block and all of the other validators to execute the block more or less simultaneously.
If you require the author to execute the block before they can send the header off to the other validators, they cannot do it simultaneously. And unless you're using the same validator for block after block after block, then you'll end up having this sort of... the author executes the block, then sends it to the other validators, the other validators execute the block, one of them then authors the next block, and you're kind of alternating, right? And this means you're going to get less than half of the possible execution time.
But because we do the prior state root, we can really squeeze out that amount of execution time in accumulate, in the synchronous portion. And of course we have the PVM which allows us to pack everything up, store it in the DA, and unpack it next block without anyone noticing, without Doom noticing. And it's fast enough and it's a normal machine, so it can be targeted by regular software like Doom.