At the end of August 2023 I participated in a virtual Rust conference hosted by Conf42. I gave a talk entitled “Turning Smart Contracts into Indexers with Cross-Compilation in Rust” in which I discussed some work I did at Aurora Labs.
The talk begins by covering some essential blockchain concepts to understand the main use-case that is referenced in the title, then moves into the key features of the Rust programming language that enable us to re-use code between these different parts of our tech stack. Namely, these features are: different compilation targets (native code vs Wasm), conditional compilation (using different code for different compile targets) and, traits (interfaces) to write code that can be used in any compilation target.
Along the way I point out how these traits essentially abstract away platform-specific effects (e.g. IO) and this abstraction encourages us to be mindful of where and how we use these effects in our code. Effects are generally only needed at the boundary of an application which leaves the core of the business logic to be written in pure (effect-free) code. Pure code is easier to maintain and reason about, and this whole architecture of the code results in libraries that are easy to reuse across your tech stack (even if different parts run in very different environments such as smart contracts and indexers). More generally, this style of coding is part of what functional programming is all about.
At the end of the talk I use my work at Aurora as a case example for this style of programming in Rust.
The talk is now publicly available on YouTube! Check it out if you’re interested in functional programming, Rust, and/or blockchain technology (definitely check it out if you are somehow in the same niche as me and like all those things).
I hope you find the talk informative. Feel free to contact us if you are looking for more training resources or consulting services for software development in Rust.