Skip to content
mwaddipPublic

About

Build, read and compare Ergo bytes through the reference implementation, so agents never touch hex.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

hexless

Build, read and compare Ergo bytes through the reference implementation, so agents never touch hex.

Language models, frontier ones included, get bytes wrong. VLQ and ZigZag make every offset depend on every number before it, so one slip shifts everything after it. A hand-built tree or transaction then tests something other than its name, and a hand-traced one burns thousands of tokens before it goes wrong. hexless gives an agent, or a person, one command for each of those jobs. Every byte it makes comes from the reference implementation's own objects and serializers (sigma-state, the JVM).

Status: being extracted from the setup it grew in. The commands below describe what is coming; they are not in this repository yet.

The tools

Command What it does
hexless build -e '<scala>' Builds a tree, constant, box or transaction from the reference's own objects and prints its exact bytes and ids. ErgoScript goes through compile("..."); shapes ErgoScript cannot write are built from AST nodes; parseTx("<hex>") starts from existing bytes so you can change one part.
hexless tx <hex> Every input, data input, token and output of a transaction with its byte range, the registers and nested boxes included, then the transaction and box ids.
hexless tree <hex> An ErgoTree spelled out: header flags, size, each constant with its range, type and value, and the root as an indented tree.
hexless bytes <cmd> One field at a time: len, slice, vlq, zz, enc, hash, diff (where two byte strings first differ), walk (read fields in order).
hexless compare <kind> <hex> The same input through the reference and through your implementation, graded the way a SANTA vector would grade it: same or DIFFERENT, with both answers.
hexless map path <from> <to> Which reference methods run on the same reader, and so share its state, with the file:line of every call, read from the reference's bytecode.

build, tx, tree and map need Java 17 or later (and sbt for the first build); map also needs Python 3. compare needs a SANTA checkout and a SANTA runner for your implementation (sigma-rust and ergots have one).

For your agent

Paste this into your AGENTS.md, CLAUDE.md or equivalent:

## Bytes: never by eye
Never read, count, decode or write Ergo bytes in your head or by hand. VLQ and ZigZag make
every offset depend on every earlier number, and hand-built hex tests something other than
what you meant. Use hexless:
- to make bytes (a tree, constant, box or transaction): `hexless build -e '<scala>'`
- to see what bytes hold: `hexless tx <hex>`, `hexless tree <hex>`, `hexless bytes walk ...`
- to learn what the reference does with them, next to your implementation: `hexless compare ...`
If you catch yourself manually constructing a transaction, tree or box, stop and build it.

License

MIT, see LICENSE.

About

Build, read and compare Ergo bytes through the reference implementation, so agents never touch hex.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors