Skip to main content

Genesis

Applies to both RGB lines

Both lines start a contract with a genesis operation, but the data structures, tools and files differ. See Two RGB lines.

Genesis is the first operation of a contract. It sets the contract's initial global state (ticker, name, supply and so on) and assigns its first owned state to seals, which are Bitcoin outpoints the issuer controls. The contract ID is computed from the genesis.

What genesis is not:

  • It isn't a Bitcoin transaction and isn't anchored to one. No commitment is published when you issue. Genesis seals point at outputs that already exist. Only later state transitions are committed to the witness transactions that spend those outputs. In Line B's words, a genesis seal "always needs to point to an existing txid since there is no witness transaction" (RGB docs).
  • It doesn't hide amounts. Neither line uses Pedersen commitments or bulletproofs. Amounts are visible to whoever validates the contract. Line B blinds the seals (which outpoint holds the state), not the amounts.
  • It isn't signed by a holder key. Ownership comes from controlling the seal outpoints.
Issue only to outputs your RGB wallet controls

Use an outpoint of the wallet that will hold the asset, and never spend it with a wallet that doesn't know about RGB. Spending a seal outside an RGB-aware tool destroys the state assigned to it. Line A (rc.3) issues on test networks only.

Line B: schemas and ContractBuilder​

A Line B contract follows a schema: NIA, IFA, UDA, CFA or PFA, from rgb-schemas 0.11.1. The genesis structure is (rgb-consensus src/operation/operations.rs):

// rgb-consensus 0.11.1
pub struct Genesis {
pub ffv: Ffv,
pub schema_id: SchemaId,
pub timestamp: i64,
pub issuer: Identity,
pub chain_net: ChainNet, // e.g. BitcoinMainnet, BitcoinTestnet4, BitcoinRegtest
pub seal_closing_strategy: SealClosingStrategy, // FirstOpretOrTapret
pub metadata: Metadata,
pub globals: GlobalState,
pub assignments: Assignments<GenesisSeal>,
}

The contract ID is the genesis operation ID, shown as rgb: plus Baid64. There are no valencies and no extensions in 0.11.1. NIA's state is the globals spec (an AssetSpec), terms and issuedSupply, plus the owned state assetOwner. Its limits come from rgb-ops src/stl/specs.rs: the ticker is 1 to 8 characters, the name 1 to 40 characters, and the precision 0 to 18 decimal places.

With the CLI​

Import the schema kit, write a YAML file and run rgb issue. These commands ran offline with rgb-cmd 0.11.1 on 2026-10-19:

demo.yaml
schema: rgb:sch:RWhwUfTMpuP2Zfx1~j4nswCANGeJrYOqDcKelaMV4zU#remote-digital-pegasus

globals:
spec:
ticker: DEMO
name: Demo Asset
details: ~
precision: 0
terms:
text: demo NIA asset
media: ~
issuedSupply: 1000

assignments:
assetOwner:
seal: 02e107ddf4f42757f44fac43feb007606d8caf40616fa92dba62176995513e88:0
amount: 1000
rgb -n regtest -d data0 import NonInflatableAsset.rgb
rgb -n regtest -d data0 issue "ssi:issuer" demo.yaml
A new contract rgb:vqtQSjVi-x9y5~WR-t8wds~_-6KCHaVx-pjM49W4-LLtiaH4 is issued and added to the stash.
Use `export` command to export the contract.

The ID changes every run, because the CLI blinds each genesis seal with a random value. Templates for every schema are in rgb-sandbox contracts/. The flags are in the v0.11 CLI reference.

In Rust, with rgb-ops​

[dependencies]
rgb-ops = { version = "=0.11.1", features = ["fs"] }
// rgb-ops 0.11.1 (library name `rgbstd`). Compiled and run on 2026-10-21.
use std::str::FromStr;

use rgbstd::containers::{ConsignmentExt, FileContent, Kit};
use rgbstd::invoice::Precision;
use rgbstd::persistence::Stock;
use rgbstd::schema::SchemaId;
use rgbstd::stl::{AssetSpec, ContractTerms, RicardianContract};
use rgbstd::txout::BlindSeal;
use rgbstd::{Amount, ChainNet, GenesisSeal, Txid};

fn main() {
// The NIA kit from rgb-protocol/rgb-schemas 0.11.1 (schemata/NonInflatableAsset.rgb).
let kit = Kit::load_file("NonInflatableAsset.rgb").unwrap().validate().unwrap();
let mut stock = Stock::in_memory();
stock.import_kit(kit).expect("invalid kit");

let schema_id = SchemaId::from_str(
"rgb:sch:RWhwUfTMpuP2Zfx1~j4nswCANGeJrYOqDcKelaMV4zU#remote-digital-pegasus",
)
.unwrap();
// An outpoint the issuer owns. Use a fresh random u64 for the blinding.
let txid = "02e107ddf4f42757f44fac43feb007606d8caf40616fa92dba62176995513e88";
let seal = GenesisSeal::from(BlindSeal::with_blinding(Txid::from_str(txid).unwrap(), 0, 0x5eed));
let terms = ContractTerms { text: RicardianContract::default(), media: None };

let contract = stock
.contract_builder("ssi:issuer", schema_id, ChainNet::BitcoinRegtest)
.unwrap()
.add_global_state("spec", AssetSpec::new("DEMO", "Demo asset", Precision::Indivisible))
.unwrap()
.add_global_state("terms", terms)
.unwrap()
.add_global_state("issuedSupply", Amount::from(1000u64))
.unwrap()
.add_fungible_state("assetOwner", seal, 1000u64)
.unwrap()
.issue_contract()
.expect("contract doesn't fit the schema");

println!("{}", contract.contract_id()); // rgb:…, different on each run (timestamp)
}

issue_contract() stamps the current time. issue_contract_raw(timestamp) takes a fixed one, which gives a reproducible ID. With the rgb-schemas crate you can use ContractBuilder::with(issuer, NonInflatableAsset::schema(), NonInflatableAsset::types(), NonInflatableAsset::scripts(), chain_net) instead of loading a kit file, as its examples/nia.rs does.

In an app, with rgb-lib​

rgb-lib picks the issuer's UTXOs and blinds the seals for you. Each amount becomes a separate allocation on a UTXO the wallet already has, so create UTXOs first with create_utxos.

// rgb-lib 0.3.0-beta.7, src/wallet/singlesig.rs. `wallet` is a `Wallet`; this passes cargo check.
let asset = wallet.issue_asset_nia(
"DEMO".to_string(), // ticker
"Demo asset".to_string(), // name
0, // precision
vec![1000], // amounts, one allocation each
)?;
println!("{}", asset.asset_id);

issue_asset_ifa, issue_asset_uda and issue_asset_cfa cover the other schemas. A wallet can only issue schemas listed in its supported_schemas, and rgb-lib refuses IFA on mainnet (CannotUseIfaOnMainnet). See Rust for setting up the wallet.

After issuing​

Genesis lives only in the issuer's data directory until you share it. Back that directory up. To hand the contract to someone, export it: rgb export on Line B, or rgb backup on Line A (it writes a consignment that rgb accept -u loads). Then transfer it with a state transition.