Nightcast / Fair breeding for Quinelings

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.

See three real breedings Why it matters

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

  1. 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.

  2. 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.

  3. 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.

  4. 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