Skip to content

Register a Model

Model registration uses a two-phase commit-reveal protocol. You first post a cryptographic commitment of your weights, then reveal the actual data in the next epoch. This prevents front-running — no one can see your weights before they’re locked in.

  1. Prepare your weights for upload:

    Encrypt your weights using AES-256-CTR. This ensures validators can’t access your weights before the reveal.

    from soma import SomaClient
    weights = open("weights.safetensors", "rb").read()
    encrypted_weights, decryption_key = SomaClient.encrypt_weights(weights)

    Upload the encrypted weights and any test data to storage (S3 or compatible). You need a URL that validators can access.

    Then compute the commitments — Blake2b-256 hex digests of the URL and the encrypted weights:

    weights_url = "https://storage.example.com/my-model/weights.enc"
    url_commitment = SomaClient.commitment(weights_url.encode())
    weights_commitment = SomaClient.commitment(encrypted_weights)
  2. Commit your model on-chain:

    Terminal window
    soma model commit <model_id> \
    --weights-url-commitment <url_commitment_hex> \
    --weights-commitment <weights_commitment_hex> \
    --stake-amount <amount> \
    --commission-rate <basis_points> \
    --staking-pool-id <pool_id>

    Verify the commit:

    Terminal window
    soma model info <model_id>

    The model should show a committed status.

  3. Reveal your model in the next epoch:

    Terminal window
    soma model reveal <model_id> \
    --weights-url <url> \
    --weights-checksum <hex> \
    --weights-size <bytes> \
    --decryption-key <key_hex> \
    --embedding <comma_separated_floats>

    Verify the reveal:

    Terminal window
    soma model info <model_id>

    The model should now show an active status. It will begin competing in subsequent epochs.

Updating weights follows the same two-phase commit-reveal pattern.

Terminal window
# Phase 1: commit the update
soma model update-commit <model_id> \
--weights-url-commitment <url_commitment_hex> \
--weights-commitment <weights_commitment_hex>
# Phase 2: reveal in the next epoch
soma model update-reveal <model_id> \
--weights-url <url> \
--weights-checksum <hex> \
--weights-size <bytes> \
--decryption-key <key_hex> \
--embedding <comma_separated_floats>

Set commission rate — takes effect next epoch:

Terminal window
soma model set-commission-rate <model_id> --commission-rate <basis_points>

Deactivate your model — stops competing:

Terminal window
soma model deactivate <model_id>

Stake on your own model:

Terminal window
soma stake --model <model_id> --amount <amount>

List all models:

Terminal window
soma model list