Multisig transactions
TRON multisig uses account permissions. Each active permission has an id, allowed operations, weighted keys, and a threshold. Configure permissions first, then set that permission id on the transaction.
1. Configure the permission
Create an active permission with only the required ContractKind values,
weighted keys, and threshold. The runnable
permission update example shows the
complete account update.
2. Select the permission
Set the active permission ID on the transaction request before building it:
let raw = provider.build_transaction(request.with_permission_id(2)).await?;Every signer must sign this exact raw.tx_id(). Rebuilding the request can
change the transaction ID and invalidate previously collected signatures.
3. Collect signatures
use tronz::{TronNetworkWallet, providers::types::SignedTransaction};
let signatures = wallet.sign_hash_with_many(&signer_addresses, &raw.tx_id()).await?;
let signed = SignedTransaction { raw, signatures };4. Check weight and broadcast
let weight = provider.get_transaction_sign_weight(&signed).await?;
if weight.current_weight < weight.required_weight {
anyhow::bail!("permission threshold not met");
}
let receipt = provider.broadcast(signed).await?.get_receipt().await?;Check sign weight before broadcasting. ProviderBuilder::wallet() may use its
default key when it has no key for the transaction owner, which supports active
permissions delegated to another account; use strict_wallet() when that
fallback would hide a configuration error.
See the runnable multisig send example.
