Hi everyone. This talk is about Rust in blockchain, from two angles: Rust as the language protocols themselves are built in, and Rust as a language you write smart contracts in.
Quick intro. I'm Luka, core developer at Parity, and this is Dragan, applied engineer. We both work at Parity, building Polkadot protocol and things around it. Today we'll show you how blockchains use Rust in general, and then take a closer look at how Polkadot puts it to work.
First part: Rust in protocols. Before we get into why, let's look at who actually runs on Rust. Two groups: chains whose original node was written in Rust, and chains where someone came back later and wrote an alternative node in Rust.
Polkadot: built on Substrate, our Rust framework - node and runtime are Rust end to end. Solana: the original validator (now Agave) is Rust; the 400ms slot times basically demand it. Hyperliquid: L1 with its own HyperBFT consensus, whole node written in Rust, closed source. NEAR: nearcore is Rust, and Rust is also its main contract language. Sui: Mysten Labs, Rust node with Move contracts, grew out of Meta's Diem work. Aptos: also a Diem descendant - aptos-core in Rust, contracts in Move.
Reth: Ethereum execution node by Paradigm, built for speed and modularity. Lighthouse: Ethereum consensus node by Sigma Prime, among the most-run validators. Grandine: Ethereum consensus node focused on high performance and parallelization. Trin: Ethereum light node for the Portal Network, by the Ethereum Foundation. Zebra: alternative to zcashd that is now deprecated, so its becoming main node. Floresta: lightweight Bitcoin node using utreexo, runs on tiny hardware.
So that's who. Now the obvious question: why do all these teams keep landing on the same language?
Memory safety: most critical CVEs in C/C++ systems are memory bugs. In a chain client that means an exploit or a chain halt. Rust removes the whole class without adding a GC. Performance: validators live on hard deadlines, 400ms slots on Solana, 6s on Polkadot. A GC pause at the wrong moment means a missed block. Rust gives C-level speed with predictable latency. Concurrency: a node is a networking stack, a database and a VM running at once. Send/Sync turn data races into compile errors. Parallel execution engines like Solana's Sealevel and Sui lean on this. Correctness: you cannot hotfix consensus, a bad block is final and the bug is worth billions. Result instead of exceptions, exhaustive match, no null. Big bug classes never ship.
Now the chain we know best. Let's look at how Polkadot is built and where Rust fits into it.
Polkadot SDK is our monorepo, ~3 million lines of Rust, one of the largest Rust codebases anywhere. Two parts matter for this talk: Substrate and FRAME. The idea: don't build a chain from scratch, compose one with existing components. Everything is Rust end to end: the node, the runtime, the tooling. The runtime compiles to WASM, which is where the next slides pick up.
Substrate splits a chain in two. The node is the infrastructure every chain shares: networking, consensus, database, transaction pool, RPC. The runtime is what makes your chain yours: what transactions exist, what state looks like, what the rules are. The node is deliberately dumb about your chain. It executes whatever runtime it is given, so the same node binary can run very different chains. Consensus sits behind an interface too: Polkadot uses BABE + GRANDPA, a solo chain can run Aura or even PoW. You write the runtime, Substrate handles the rest. The next slide shows what that runtime code looks like.
This is a complete piece of chain logic: a counter anyone can increment. Don't read every line. One attribute declares the storage, one marks the calls, ensure_signed checks who's calling. Storage is a typed value, not raw bytes. This is FRAME code, and FRAME is the next slide.
FRAME stands for Framework for Runtime Aggregation of Modularized Entities. Substrate gives you the node, FRAME gives you the language for the runtime running inside it. You pick pallets off the shelf, write your own for the logic that makes your chain unique, and construct_runtime! composes them into one runtime. The next slide shows what FRAME actually saves you from.
The runtime as functions over raw key-value storage: you invent storage keys and hope no other module picks the same one, you decode the call bytes yourself, you route on a call index yourself. No metadata, no events, no weights, no automatic rollback.
Same counter with FRAME: storage keys, SCALE codecs, dispatch and metadata are generated. A few attributes, and wallets can see the call exists.
The runtime lives in chain state under the :code key. Every block, the node loads that blob and executes it - the logic of the chain is itself just data on the chain. Upgrade = a set_code transaction, approved through governance, that replaces the blob. From the next block every node runs the new logic. No "please update your binary by Tuesday", no fork. The blob is compressed Rust-to-WASM, capped at 5 MiB compressed for parachain code, and the upgrade transaction basically fills a whole block.
This is the whole wiring: each pallet gets an impl of its Config trait on the Runtime type, and construct_runtime! composes the list into one runtime. The Counter pallet from earlier plugs in with one empty impl. derive_impl fills frame_system's ~30 associated types with sane defaults, you override only what differs. All of this resolves at compile time - the composed runtime is one static type, no dynamic dispatch anywhere.
The node is everything the runtime is not: an async Rust binary on Tokio where networking, consensus, the database and the WASM executor all run concurrently. Dozens of tasks touching shared state - Send and Sync turn every data race into a compile error. In C++ the same architecture is a production heisenbug generator. Why only Rust. It needs four things at once: C-level speed, predictable latency, memory safety, and WASM as a first-class target. - C/C++ has the speed but parses untrusted bytes from the open internet on machines that hold keys - one memory bug is a remote exploit. - Go or Java are safe but GC pauses land in the 2s parachain validation window, and a validator that misses deadlines misses blocks. - And the trick nothing else offers: the node and the runtime share the same crates and SCALE codec, because the same no_std Rust compiles to native for the node and to WASM for the runtime. One language end to end, no spec drift between the two halves.
There is no gas metering at runtime. Instead every call is benchmarked ahead of time on reference hardware, against worst-case inputs, and the result is the weight baked into the runtime. Because the weight is known before execution, the transaction pool can price and fill blocks without running anything. If the call turns out cheaper than the worst case, the difference is refunded post-dispatch.
You've seen the architecture. Now let's zoom in on the language itself: the Rust features that make this design work, and what we get out of each one.
Everything on the left of the Without FRAME slide is what these macros generate.
AccountId, balances, block numbers are all associated types. Kusama and Polkadot run the same pallets with different Config impls.
Determinism is consensus: one node computing a different state root is a fork. Pure Rust makes the whole runtime testable as a normal crate.
One codebase, two compilation targets, no spec drift. Compiled runtimes are cached, so the JIT cost is paid once per upgrade.
So far you've seen how Polkadot works today. I'm going to show you what's coming next. Two things: a new virtual machine, and JAM. And then a different angle — Rust as a smart contract language.
First, some terminology, because these two names get mixed up constantly. PVM is the specification. It's the document that says which instructions exist and what they do. PolkaVM is our implementation of that spec, written in Rust. It's built on RISC-V. That's a real, open instruction set — the same one you find in actual hardware. Why does that help? Because anything that compiles through LLVM can compile to RISC-V. Rust, C, C++, and Solidity. We don't have to build our own compiler — LLVM does the heavy lifting. The second nice thing is that RISC-V is register-based, just like real processors. Instructions map almost directly onto what a CPU already understands, so translating to native code is straightforward. That's where the speed comes from. Sandboxed — every program runs in isolation, deterministically, and metering is cheap. And the last point, which is the difference from the weights you heard about earlier. With weights, the cost is measured up front. Here, spending is measured as you go, while the code runs.
This is the second big piece. JAM — the Join-Accumulate Machine.
JAM generalizes Polkadot. Today, parachains are baked into the protocol itself — Polkadot knows what a parachain is. In JAM, that's gone. Instead you have services, and a parachain becomes just one service among many. That's the "breaking the silos" part on the slide. A service is three functions, and those are the next three bullets. Refine is computation. It runs on cores, it doesn't touch state, and because of that it can run massively in parallel. Accumulate takes those results and folds them into the chain state. OnTransfer is communication — messages between services. Then there's the D3 Lake. Today every parachain keeps its data separately, and crossing that boundary means sending an XCM message. The D3 Lake is a shared space for data, spread across the validators. Around 850 megabytes per second — roughly 42 times what Polkadot does today. One service drops a result in, another picks it up. No more walls. And finally — all of this runs on PVM. So the machine from the previous slide is the execution layer for JAM.
Now something concrete. These numbers come from our conformance dashboard. Several teams are writing their own JAM implementation, they all run the same test vectors, so this is a fair comparison. The top ten is up here. Below the line is the fastest client from each language that didn't make the top ten. The story is pretty clear. The top three are all Rust. Five of the top ten are Rust. The fastest one does a step in under two milliseconds. Go fills most of the rest. And below the line — the best entry from every remaining language is slower than the entire top ten. Java, Swift, Python, and Scala at the bottom. Scala is about forty times slower than the leader. The point isn't that only Rust can be fast. The point is that the teams writing in Rust consistently end up at the top of this table.
So far we've talked about the protocol — the node, the virtual machine. Now the other angle: Rust as a language for writing smart contracts.
Rust isn't a contract language only on Polkadot. This is already a broad ecosystem. Rust SC is Polkadot — that's what the next two slides are about. Anchor is the main framework on Solana; its macros generate most of the boilerplate for you. Pinocchio is the lighter alternative on Solana, for when you want the smallest and cheapest contract possible. On NEAR, Rust is the primary contract language. CosmWasm is the contract layer for a large part of the Cosmos ecosystem — Osmosis, Injective, and plenty of other chains. MultiversX is Rust-first as well. And there's more at the bottom — Soroban on Stellar is Rust-only, and so are Internet Computer and Casper. So if you write contracts in Rust, that knowledge carries across chains.
Solidity and Rust, on the same machine. pallet_revive is the runtime module that deploys and executes contracts. It's the entry point for everything else on this slide. revive, or resolc, is the compiler for Solidity. It takes ordinary Solidity code and compiles it to RISC-V instead of EVM bytecode. An existing contract recompiles as-is. And that's why Ethereum tooling works — Hardhat, Foundry, Remix, MetaMask. There's an RPC layer that behaves like an Ethereum node, so the tools don't notice the difference. Rust contracts go through cargo pvm-contract. It scaffolds the project, builds it, and gives you the contract and the ABI. And finally, the dual VM stack. Polkadot Hub runs two machines side by side. REVM executes standard Ethereum bytecode directly — that's where you bring your contract over with no changes, and it's the starting point for most people. PolkaVM is there when you need the performance. Same chain either way; you pick per project.
And here's the concrete comparison. The same contract — a simple counter — in both languages. On the left, Solidity. This is what anyone who's written for Ethereum already knows. Nothing new here, and that's the point. On the right, the same contract in Rust. The structure is always the same: one attribute describes what the contract stores, another marks the module as a contract, and a third marks the methods callable from outside. The macros generate everything else — entry points, call routing, encoding. The important part is that this is compatible with Solidity at the ABI and storage level. In practice that means Ethereum libraries work unchanged, and a Solidity contract and a Rust contract can call each other directly. Rust is more verbose on a tiny example like this. But you get the whole Cargo ecosystem, real testing, and types that hold up once the contract grows. And that's the whole story in one line: the same language from the node, through the runtime, all the way to the contract.