Skip to content

Chaincode lifecycle

Chaincode changes ship via the Fabric chaincode lifecycle at a new version and an incremented sequence. World state is preserved; only the definition/binary changes.

Terminal window
# inside the CLI container of the network
hybrid-architecture/fabric-network/prod/scripts/upgrade-chaincode.sh <new-version> [new-sequence]
# e.g.
upgrade-chaincode.sh 2.0

The script derives the next sequence from what is committed, then runs package → install on every org → approve (all orgs) → commit under the channel’s endorsement policy (MAJORITY, 2 of 3 on the staging network). A committed chaincode whose sequence can’t be parsed fails with a clear error rather than silently restarting at sequence 1.

Because anchors are write-once, an upgrade never rewrites existing batches; new behavior applies to batches anchored after the commit. Sequence chaincode upgrades with schema migrations when a change spans both layers.

Provision a per-tenant signing identity (whose ecert carries tenant=<id>) with register-tenant-identity.sh, then map it under fabric.tenant_identities. See tenant isolation.