Skip to content

Transactions

Submit a signed transaction for execution.

async def execute_transaction(tx_bytes: bytes) -> TransactionEffects
ParameterTypeRequiredDefaultDescription
tx_bytesbytesYesSigned transaction bytes

Returns: TransactionEffects

Dry-run a transaction without committing it.

async def simulate_transaction(tx_data_bytes: bytes) -> TransactionEffects
ParameterTypeRequiredDefaultDescription
tx_data_bytesbytesYesUnsigned transaction data bytes

Returns: TransactionEffects

Fetch the effects of a previously executed transaction.

async def get_transaction(digest: str) -> TransactionEffects
ParameterTypeRequiredDefaultDescription
digeststrYesTransaction digest

Returns: TransactionEffects

Build a transaction to transfer a coin (or a portion of it) to a recipient.

async def build_transfer_coin(
sender: str, recipient: str, coin: ObjectRef,
amount: Optional[int] = None, gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
recipientstrYesRecipient address
coinObjectRefYesCoin to transfer
amountintNoNoneAmount in shannons (entire coin if omitted)
gasObjectRefNoNoneGas coin (auto-selected if omitted)

Build a transaction to transfer one or more objects.

async def build_transfer_objects(
sender: str, recipient: str, objects: list[ObjectRef],
gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
recipientstrYesRecipient address
objectslist[ObjectRef]YesObjects to transfer
gasObjectRefNoNoneGas coin

Build a transaction to pay multiple recipients from multiple coins.

async def build_pay_coins(
sender: str, recipients: list[str], amounts: list[int],
coins: list[ObjectRef], gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
recipientslist[str]YesRecipient addresses
amountslist[int]YesAmounts in shannons (must match recipients length)
coinslist[ObjectRef]YesInput coins
gasObjectRefNoNoneGas coin

Stake SOMA with a validator.

async def build_add_stake(
sender: str, validator: str, coin: ObjectRef,
amount: Optional[int] = None, gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
validatorstrYesValidator address
coinObjectRefYesCoin to stake
amountintNoNoneAmount in shannons (entire coin if omitted)
gasObjectRefNoNoneGas coin

Withdraw staked SOMA.

async def build_withdraw_stake(
sender: str, staked_soma: ObjectRef,
gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
staked_somaObjectRefYesStakedSoma object
gasObjectRefNoNoneGas coin

Stake SOMA with a model.

async def build_add_stake_to_model(
sender: str, model_id: str, coin: ObjectRef,
amount: Optional[int] = None, gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
model_idstrYesModel object ID
coinObjectRefYesCoin to stake
amountintNoNoneAmount in shannons
gasObjectRefNoNoneGas coin

Build a commit-model transaction (phase 1 of commit-reveal).

async def build_commit_model(
sender: str, model_id: str, weights_url_commitment: str,
weights_commitment: str, stake_amount: int, commission_rate: int,
staking_pool_id: str, gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
model_idstrYesPre-assigned model ID
weights_url_commitmentstrYesHash of the encrypted weights URL
weights_commitmentstrYesHash of the decrypted weights
stake_amountintYesStake in shannons
commission_rateintYesBasis points (100 = 1%)
staking_pool_idstrYesStaking pool object ID
gasObjectRefNoNoneGas coin

Build a reveal-model transaction (phase 2 of commit-reveal).

async def build_reveal_model(
sender: str, model_id: str, weights_url: str, weights_checksum: str,
weights_size: int, decryption_key: str, embedding: list[float],
gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
model_idstrYesModel ID from commit phase
weights_urlstrYesURL of encrypted weights
weights_checksumstrYesHex checksum of weights file
weights_sizeintYesFile size in bytes
decryption_keystrYesHex AES-256 decryption key
embeddinglist[float]YesModel embedding vector
gasObjectRefNoNoneGas coin

Commit updated weights for an active model.

async def build_commit_model_update(
sender: str, model_id: str, weights_url_commitment: str,
weights_commitment: str, gas: Optional[ObjectRef] = None,
) -> bytes

Reveal updated weights for an active model. Same parameters as build_reveal_model.

async def build_reveal_model_update(
sender: str, model_id: str, weights_url: str, weights_checksum: str,
weights_size: int, decryption_key: str, embedding: list[float],
gas: Optional[ObjectRef] = None,
) -> bytes

Voluntarily deactivate a model. No slash is applied.

async def build_deactivate_model(
sender: str, model_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Set a model’s commission rate for the next epoch.

async def build_set_model_commission_rate(
sender: str, model_id: str, new_rate: int,
gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesModel owner address
model_idstrYesModel ID
new_rateintYesNew rate in basis points
gasObjectRefNoNoneGas coin

Report a misbehaving model (validators only).

async def build_report_model(
sender: str, model_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Undo a previous model report.

async def build_undo_report_model(
sender: str, model_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Build a data submission transaction for a target.

async def build_submit_data(
sender: str, target_id: str, data_commitment: str, data_url: str,
data_checksum: str, data_size: int, model_id: str,
embedding: list[float], distance_score: float, bond_coin: ObjectRef,
gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesSender address
target_idstrYesTarget to submit to
data_commitmentstrYesHash of raw data
data_urlstrYesURL where data is hosted
data_checksumstrYesChecksum of data file
data_sizeintYesData size in bytes
model_idstrYesModel used for scoring
embeddinglist[float]YesData embedding vector
distance_scorefloatYesDistance to target (must be ≤ threshold)
bond_coinObjectRefYesCoin for bond payment
gasObjectRefNoNoneGas coin

Claim rewards from a filled target after the challenge window closes.

async def build_claim_rewards(
sender: str, target_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Report a fraudulent submission.

async def build_report_submission(
sender: str, target_id: str, challenger: Optional[str] = None,
gas: Optional[ObjectRef] = None,
) -> bytes

Undo a previous submission report.

async def build_undo_report_submission(
sender: str, target_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Initiate a fraud challenge against a filled target’s submission. Requires a bond.

async def build_initiate_challenge(
sender: str, target_id: str, bond_coin: ObjectRef,
gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesChallenger address
target_idstrYesTarget ID to challenge
bond_coinObjectRefYesCoin for challenger bond
gasObjectRefNoNoneGas coin

Report a challenge (validators only).

async def build_report_challenge(
sender: str, challenge_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Undo a challenge report.

async def build_undo_report_challenge(
sender: str, challenge_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Claim the bond from a resolved challenge.

async def build_claim_challenge_bond(
sender: str, challenge_id: str, gas: Optional[ObjectRef] = None,
) -> bytes

Register a new validator.

async def build_add_validator(
sender: str, pubkey_bytes: bytes, network_pubkey_bytes: bytes,
worker_pubkey_bytes: bytes, proof_of_possession: bytes,
net_address: bytes, p2p_address: bytes, primary_address: bytes,
proxy_address: bytes, gas: Optional[ObjectRef] = None,
) -> bytes
ParameterTypeRequiredDefaultDescription
senderstrYesValidator account address
pubkey_bytesbytesYesProtocol public key
network_pubkey_bytesbytesYesNetwork public key
worker_pubkey_bytesbytesYesWorker public key
proof_of_possessionbytesYesProof of possession
net_addressbytesYesBCS-encoded network address
p2p_addressbytesYesBCS-encoded P2P address
primary_addressbytesYesBCS-encoded primary address
proxy_addressbytesYesBCS-encoded proxy address
gasObjectRefNoNoneGas coin

Remove a validator from the committee.

async def build_remove_validator(
sender: str, pubkey_bytes: bytes, gas: Optional[ObjectRef] = None,
) -> bytes

Update validator metadata (takes effect next epoch).

async def build_update_validator_metadata(
sender: str, gas: Optional[ObjectRef] = None,
next_epoch_network_address: Optional[bytes] = None,
next_epoch_p2p_address: Optional[bytes] = None,
next_epoch_primary_address: Optional[bytes] = None,
next_epoch_proxy_address: Optional[bytes] = None,
next_epoch_protocol_pubkey: Optional[bytes] = None,
next_epoch_worker_pubkey: Optional[bytes] = None,
next_epoch_network_pubkey: Optional[bytes] = None,
next_epoch_proof_of_possession: Optional[bytes] = None,
) -> bytes

Set the validator commission rate for the next epoch.

async def build_set_commission_rate(
sender: str, new_rate: int, gas: Optional[ObjectRef] = None,
) -> bytes

Report a misbehaving validator.

async def build_report_validator(
sender: str, reportee: str, gas: Optional[ObjectRef] = None,
) -> bytes

Undo a previous validator report.

async def build_undo_report_validator(
sender: str, reportee: str, gas: Optional[ObjectRef] = None,
) -> bytes