A Rust utility for converting Qubic Random Lottery contract state files from the old format (OldRL) to the new format (NewRL).
This tool reads a binary state file in the old Random Lottery format and converts it to the new format, preserving all essential data structures and state information.
Download pre-built binaries produced by the CI workflow:
-
GitHub Releases (recommended): open the Releases page of this repository on GitHub and download the latest release assets (look for the "Releases" section in the repository):
- Files:
rlconverter-windows-x64.exe(Windows 10/11, x64)rlconverter-linux-x64(Linux x86_64; make it executable withchmod +x)
- Files:
-
Or from CI Artifacts (for non-tag builds): go to the Actions tab → select the "Build" workflow → open the latest successful run → download the artifact for your OS:
- Artifact names:
rlconverter-Windows-x64andrlconverter-Linux-x64
- Artifact names:
Note: If you're working from a local clone of this repository, you may also find pre-built binaries in release-binaries/.
If you prefer to run the program from source, install Rust first.
- Open a terminal and run:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Follow the on-screen instructions (default is fine).
- Restart the terminal or run:
source $HOME/.cargo/env
- Verify:
rustc --version cargo --version
- Download the Rust installer from https://rustup.rs/ (or use
rustup-init.exe). - Run the installer and follow the wizard (default installation is recommended).
- Open a new Command Prompt or PowerShell and verify:
rustc --version cargo --version
rlconverter <input_file> <output_file>
<input_file>- Path to the old format Random Lottery state file (OldRL)<output_file>- Path where the converted new format file (NewRL) will be saved
Using pre-built binaries (recommended):
Linux:
chmod +x release-binaries/rlconverter-linux-x64
./release-binaries/rlconverter-linux-x64 contract0016.185 contract0016_new.185Windows:
release-binaries\rlconverter-windows-x64.exe contract0016.185 contract0016_new.185Quick run from source (no separate build step required):
From the project root you can run the program directly with Cargo (useful for testing or quick runs):
cargo run -- contract0016.185 contract0016_new.185Cargo will compile and run the binary in debug mode; for repeated or production runs consider using the pre-built release binaries in release-binaries/ or building a release locally with cargo build --release.
🎰 Random Lottery Contract - State Converter
📥 Input file: contract0016.185
📤 Output file: contract0016_new.185
📂 Opening file: "contract0016.185"
📖 Reading file contents...
✓ Read 123456 bytes
ℹ️ Expected OldRL structure size: 123456 bytes
🔄 Deserializing OldRL structure...
First 32 bytes of file: 00 01 02 03 ...
✓ Byte-by-byte structure loading successful!
[OldRL state information displayed]
💾 Saving NewRL to file: "contract0016_new.185"
NewRL structure size: 98765 bytes
✓ File successfully written (98765 bytes)
✅ NewRL successfully saved to 'contract0016_new.185'
✅ Conversion completed successfully!
❌ Error: input file 'contract0016.185' not found
Solution: Make sure the input file exists and the path is correct.
Expected size X bytes does not match file size Y bytes
Solution: The input file may be corrupted or not in the correct OldRL format.
This project uses the following Rust crates:
tokio- Asynchronous runtimebincode- Binary serializationserde- Serialization frameworkserde-big-array- Support for large arrays in serdebase64- Base64 encoding/decoding
Run directly with Cargo:
cargo run -- contract0016.185 contract0016_new.185This compiles and runs the project in debug mode.