Fair breeding for Quinelings.
When two Quinelings breed, one number decides the child. Here that number comes from Nightcast on Midnight, after the pair is sealed, so nobody can keep trying until they like the result.
One number decides the child
In the Quinelings ranch, a child's body comes from its two parents and a 32-bit number called the nonce. The ranch's own code turns that number into which traits come from which parent, and into any mutation.
Whoever picks the number can try one after another, keep the child they like best, and nobody can tell. Try it with any two founders of the ranch: each child below shows two of its six inherited traits.
With Nightcast, the number comes from Midnight
Each pair below was sealed first: its parents, recipe and mutation style were hashed into a seal, and the seal went into a Nightcast request on Midnight's Preprod network. The oracle's answer, proved on chain, became the number. Every step can be checked again here, with the ranch's own code.
How it works
Seal the pair
The parents' identities, the recipe and the mutation style are hashed into a 32-byte seal. The nonce is left out: it doesn't exist yet.
Ask Nightcast
The seal is the seed of a Nightcast request. The request's id binds the contract, the requester, the purpose and the seal together.
The answer arrives proved
The oracle answers with a zero-knowledge proof that Midnight's validators check. It is the only value its key can give for that request.
The ranch breeds
The first 4 bytes of the value are the nonce. The ranch's unchanged code turns the sealed pair and that nonce into the child.
What this proves, and what it doesn't
It proves the number wasn't chosen
The seal existed before the value, and Midnight accepted only the one value the oracle's key gives for that request. Nobody picked the child.
One request per pair must count
A breeder could still make several requests and show only the best. A ranch using this would count the first request for a pair, or list them all, as LunaSpin's certificates do.
One oracle can know the value first
These requests use Nightcast v1, which has one oracle. It can't change a value but could see it early. Nightcast's threshold network, in testing now, removes that: no one holds the whole key.
An experiment on a test network
Quinelings' ranch breeding is marked experimental by its author, and Nightcast hasn't been audited yet. These children are previews: none was admitted to anyone's ranch.