Post
Share your knowledge.
How to generate readable bytecode for Move with Miden Assembly?
I'm trying to experiment with writing a Move compiler by using Miden Assembly as the compiler target. I want to generate readable bytecode for the compiled Move program. Is there a straightforward way to achieve this?
- Move CLI
Answers
2You can check out the sui move disassemble
command, which might help you with generating readable bytecode.
If you're trying to build a Move compiler that targets Miden Assembly, you're taking on a unique and experimental challenge. Right now, there's no official or plug-and-play toolchain that connects Move directly to Miden VM, so you’ll need to manually map Move IR (Intermediate Representation) or bytecode into Miden Assembly. To do this in a straightforward way, you can start by compiling your Move code using the Move CLI to generate its bytecode or IR, then create a translation layer that takes this and emits Miden-friendly assembly instructions. This process involves building a custom backend that understands Move’s stack-based operations and translates them into Miden’s constraint-based VM structure.
To make the Miden Assembly readable and accurate, you’ll likely need to build an interpreter or code generator that aligns Move opcodes (like MoveLoc
, Call
, Add
, etc.) with their equivalent or approximated Miden assembly routines. Since Miden VM has its own set of stack manipulation rules, you might have to redesign some aspects of control flow or function calls to fit its paradigm. This won’t be trivial, but if your goal is experimentation and learning, you can start small—like compiling arithmetic expressions or basic function calls—and build your translation layer incrementally.
There’s no pre-built transaction block example for this since it’s a compiler-level project, but for guidance on compiling Move to bytecode, use:
move build
And then inspect the generated bytecode with:
move bytecode-viewer build/bytecode_modules
From there, you can design a pass that emits Miden Assembly.
You can read more and get involved in the discussions about Miden and Move integration at: https://github.com/move-language/move https://github.com/0xPolygonMiden/miden
This approach requires deep understanding of both the Move VM and Miden's architecture, but it’s an exciting way to bridge high-level smart contract logic with low-level zero-knowledge infrastructure.
Do you know the answer?
Please log in and share it.
Move is an executable bytecode language used to implement custom transactions and smart contracts.