Skip to content
LogoLogo

Crypto

IntroductionCrypto is many things to many people.

To some it names cryptography — the mathematical field of techniques for secrecy, authenticity, and integrity: hashes, signatures, commitments, proofs. To others it names cryptocurrency — a digital tool that those techniques power inside blockchains, unlocking financial primitives (transfer, custody, markets, settlement) without a named cashier. For a third camp, even the second kind is just scams with extra steps. Terp is built where the first kind is real enough that the second kind does not have to take anyone’s word for it.

Cryptography on Terp Network

Cryptography is the foundation of every trust-minimized system. Terp Network uses cryptographic primitives at every layer — from account authentication to block finalization to cross-chain proofs.

Where Terp Uses Cryptography

LayerCryptographic PrimitiveWhat It Does
Account authenticationsecp256k1 / Ed25519 digital signaturesVerifies transaction senders
Block headersSHA-256 hashingApp hash, last block hash chain
State storageIAVL Merkle tree (SHA-256)Merklized state root at every block
IBC light clientsHash chains + signature verificationVerify counterparty chain state
Smart account authenticatorsHash-based commitmentsSafe-word hashes, credential verification
ZK PollRegistryPoseidon hash + ZK-SNARKPrivate vote aggregation
Content addressingBLAKE3 hashingIPFS CIDs, code verification
ConsensusEd25519 (CometBFT)Validator signature aggregation

Cryptographic Primitives

Hash Functions

Hash functions take an input of any size and produce a fixed-size digest that uniquely represents the input. They are the building blocks of blockchain integrity.

Properties:

  • Deterministic — same input always produces the same output
  • One-way — given a hash, finding the input is computationally infeasible
  • Collision-resistant — finding two inputs with the same hash is infeasible

Hash functions used on Terp Network:

AlgorithmUsed ForKey Property
SHA-256Block headers, IBC commitments, account stateNIST standard, widely audited
BLAKE3Code hashes, content addressing, QMD indexing10x faster than SHA-256
PoseidonZK circuits, PollRegistryZK-friendly — low constraint count

Example — same input, different algorithms:

Input: "Hello"

SHA-256:  2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
BLAKE3:   6671090d8c6b3b3d3c4f5e6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6

See the full Hash Functions guide for details, including post-quantum hash readiness.

Interactive hash explorer scaffold — a component that accepts text input and displays the output hash across SHA-256, BLAKE3, and Poseidon side-by-side, with byte-level visual diff highlighting.

Elliptic Curves

Elliptic curve cryptography (ECC) provides the mathematical foundation for Terp Network's digital signatures and key pairs. The security rests on the Elliptic Curve Discrete Logarithm Problem (ECDLP) — given a public key (a point on the curve), finding the private key (the scalar multiplier) is computationally infeasible.

Curves used on Terp Network:

CurveKey SizeSignature SchemeWhere Used
secp256k132 bytesECDSAAccount keys, wallet signatures (Keplr, Leap, Ledger)
Ed2551932 bytesEdDSACometBFT consensus validator signatures
secp256r132 bytesECDSAPasskey/WebAuthn authentication (future)

How key pairs work:

Private Key: a random 256-bit integer
        ↓ (scalar multiplication on the curve)
Public Key: a point (x, y) on the curve, 33 bytes compressed
        ↓ (Bech32 encoding with chain prefix)
Address: terp1...

The critical property: you can derive the address from the public key, but you cannot derive the private key from the public key (ECDLP).

Curve comparison diagram scaffold — a visual showing signature sizes, verification speeds, and security levels for secp256k1, Ed25519, and secp256r1 on Terp Network.

Key Pairs & HD Derivation

A key pair on Terp Network consists of a private key (kept secret) and a public key (shared openly). Hierarchical Deterministic (HD) wallets derive multiple key pairs from a single seed phrase using BIP-44 paths.

Terp Network derivation path:

m / 44' / 114' / 0' / 0 / <index>
  ↑      ↑       ↑
 BIP-44  Coin   Account
         Type

Chain-specific coin types:

ChainCoin TypeHD PathBech32 Prefix
Terp Network114m/44'/114'/0'/0/0terp1
Cosmos Hub118m/44'/118'/0'/0/0cosmos1
Osmosis118m/44'/118'/0'/0/0osmo1

The same seed phrase produces different private keys on different chains because the coin type segment in the HD path changes. This is by design — it prevents cross-chain replay attacks.

Address conversion (Bech32):

# Convert a Terp address to Cosmos format (same public key, different prefix)
terpd keys parse terp1fts0sdw08e5kj02qev8hkmuwgr3wr2rxnl092t --output cosmos

Address derivation visualizer scaffold — an interactive component that accepts a seed phrase or private key and shows the derived public key, address, and HD path for any supported chain.

Merkle Structures

Merkle trees are hash-based data structures that enable efficient verification of large datasets. Terp Network uses multiple Merkle variants depending on the use case:

VariantStructureBest ForTerp Use
Standard MerkleBinary hash treeFixed dataset proofsIBC light client commitments
IAVL MerkleBalanced BST + hashingKey-value stateCosmos SDK state storage
Jellyfish (sparse)Key-addressed sparse treeAccount statePollRegistry, account proofs
Merkle Mountain RangeAppend-only accumulatorStreaming dataBlock headers, event logs
Patricia Merkle TriePrefix-compressed trieKey-value with shared prefixesIBC v2 light clients (Ethereum)

See the dedicated guides for each variant:

Merkle variant comparison diagram scaffold — an interactive side-by-side that takes the same 4 data items and shows how each Merkle variant structures them, with proof sizes, append costs, and verification times.

Zero-Knowledge Proofs

Zero-knowledge proofs allow a prover to convince a verifier that a statement is true without revealing any information beyond the statement's validity. Terp Network supports ZK proofs through precompiled circuits.

Supported proof systems:

SystemTrusted SetupProof SizeVerificationTerp Integration
ZK-STARKNoneKB-scaleModerateSelective disclosure, general ZK
ZK-SNARKPer-circuitB-scaleCheapPollRegistry, token-gating

Where Terp uses ZK:

  • PollRegistry — private vote tallying with ZK proofs of correct aggregation
  • Selective disclosure — prove age, membership, or credential without revealing underlying data
  • IBC v2 light clients — ZK-verified consensus proofs for non-Cosmos chains
  • Future: zk-CosmWasm VM — private contract execution

ZK operations run as native precompiles, not in-contract WASM. This means orders of magnitude lower gas costs than implementing ZK logic in CosmWasm bytecode.

ZK proof flow diagram scaffold — a diagram showing: User Data → Witness Generation → Prover (STARK/SNARK) → Proof → On-Chain Verifier Precompile → Result (accept/reject). Highlight the precompile boundary.

Post-Quantum Readiness

As quantum computing advances, current elliptic curve cryptography (secp256k1, Ed25519) will become vulnerable to Shor's algorithm. Terp Network is designed for cryptographic agility — the ability to migrate to new primitives without breaking the network.

How Terp is post-quantum ready:

FeatureWhat It Enables
Smart account authenticatorsRegister new key types (hash-based, lattice-based) without changing your account key
Authenticator composabilityCombine a classical key with a post-quantum authenticator during migration (AllOf)
Algorithm-agnostic moduleThe x/smart-account module has no hardcoded curve dependency — authenticators define their own verification logic
Governance-upgradableChain-level crypto parameters can be updated through governance
IBC light client agilityLight clients can be migrated to post-quantum signature schemes independently per connection

Migration path:

Today:    secp256k1 → SignatureVerification authenticator
Migrate:  secp256k1 AND sphincs+ → AllOf(SigVerif, PQ-Auth)
Future:   sphincs+ → single PostQuantumVerification authenticator

This means Terp Network does not need a hard fork to become post-quantum secure — accounts can migrate at their own pace.

PQ migration timeline diagram scaffold — a Gantt chart showing the phased migration from classical signatures through hybrid (AllOf) to post-quantum-only, with governance milestones.