# 38. `example_mtc_builders.py` — Merkle Tree Certificate Builders and Validators
[<- Example index](index.md) . [`example_mtc_builders.py` on Codeberg](https://codeberg.org/abbra/synta/src/branch/main/examples/example_mtc_builders.py)
Bindings: `synta.mtc.HashAlgorithm`, `synta.mtc.IssuanceLogBuilder`,
`synta.mtc.StandaloneCertificateBuilder`, `synta.mtc.StandaloneCertificate`,
`synta.mtc.MtcProof`, `synta.mtc.Checkpoint`, `synta.mtc.CosignerID`,
`synta.mtc.RevokedRanges`, `synta.mtc.TrustAnchor`,
`synta.mtc.ValidationPolicy`, `synta.mtc.CertificateValidator`,
`synta.mtc.extract_leaf_index`, `synta.mtc.extract_log_number`.
- **HashAlgorithm** -- inspect `name()`, `output_size()`, `oid()` for SHA-256
and SHA-384.
- **IssuanceLogBuilder** -- accumulate TBSCertificateLogEntry records, compute
leaf hashes and the Merkle root, generate a checkpoint at a fixed Unix
timestamp, and produce inclusion proofs for individual leaves.
- **MtcProof** -- decode a hand-built TLS wire-format proof, inspect
`start`, `end`, `inclusion_proof`, `signatures`, and verify a byte-exact
`encode()` round-trip.
- **extract_leaf_index / extract_log_number** -- demonstrate the serial-number
encoding scheme from the spec (log_number << 48 | leaf_index).
- **RevokedRanges** -- add non-overlapping and overlapping ranges, verify
automatic merging, check `is_revoked()` and `contains_range()`.
- **StandaloneCertificateBuilder** -- assemble a `StandaloneCertificate` with
an embedded `SubtreeSignature` cosignature, parse it back, and inspect
fields.
- **CertificateValidator** -- validate the standalone certificate against a
`TrustAnchor` derived from the log's checkpoint using a permissive
`ValidationPolicy`; then revoke the leaf index and confirm validation
fails with a `ValueError`.