Skip to main content

Transaction validation & processing

Overview

The Auth module in KIRA extends the functionality of the Cosmos SDK's auth module, focusing on validating and processing transactions within the network. It utilizes a set of AnteDecorators to perform basic transaction validity checks before they are included in the blockchain. These checks involve verifying signatures, ensuring correct nonces, and validating auxiliary fields. The Auth module is also responsible for managing accounts, including their creation, storage, and querying, as well as maintaining associated account information.

KIRA enriches the standard handlers by introducing custom decorators tailored to its network requirements such as custody rules, poor network conditions and token whitelist/blacklist enforcement.. One key area is fee processing; since KIRA does not have a concept of gas fees, it implements specific decorators for this purpose. More information on KIRA's fee processing can be found in the Fee processing module.

Parameters

Standard Module Params

note

All parameters pertaining to gas fees are obsolete.

NAMETYPEEXAMPLEDESCRIPTION
max_memo_charactersuint64512The maximum permitted number of characters in the memo of a transaction
tx_sig_limituint647The maximum number of signers for a transaction. A single transaction can have multiple messages and multiple signers
tx_size_cost_per_byteuint6410The cost per byte used to compute the gas consumption of a transaction. TxSizeCostPerByte * txsize
sig_verify_cost_ed25519uint64590The gas cost for verifying ED25519 signatures
sig_verify_cost_secp256k1uint641000The gas cost for verifying Secp256k1 signatures

Standard Decorators

These are auth's standard AnteDecorators that are chained together in a specific order to form an AnteHandler

DECORATORDESCRIPTION
SetUpContextDecoratorSets up the context and gas meter for transactions.
RejectExtensionOptionsDecoratorRejects extension options in protobuf transactions.
MempoolFeeDecoratorChecks if transaction fees meet the minimum fee requirements during CheckTx.
ValidateBasicDecoratorValidates transaction basics.
TxTimeoutHeightDecoratorChecks for transaction height timeouts.
ValidateMemoDecoratorValidates transaction memos.
ConsumeGasTxSizeDecoratorConsumes gas proportional to the transaction size.
DeductFeeDecoratorDeducts transaction fees from the signer's account (or fee granter's account if fee grant module is enabled).
SetPubKeyDecoratorSets public keys for signers if not already set in the state machine.
ValidateSigCountDecoratorValidates the number of signatures in the transaction.
SigGasConsumeDecoratorConsumes gas for each signature.
SigVerificationDecoratorVerifies that all signatures are valid.
IncrementSequenceDecoratorIncrements account sequence numbers for each signer to prevent replay attacks.

Custom Decorators

These are KIRA’s custom AnteDecorators

DECORATORDESCRIPTIONMODULE
CustodyDecoratorThis decorator enforces custody rules for users, such as requiring them to have a valid key or a minimum reward amount when sending a transaction. It also checks whether they're using a whitelist, and if so, whether the recipients are on that whitelistUntitled
ZeroGasMeterDecoratorThis decorator bypasses gas consumption for transactions by setting the gas limit to 0 and indicating no gas is consumed during processingUntitled
ValidateFeeRangeDecoratorThis decorator checks if the transaction fee is within the range defined by the network properties. If the fee is too high or too low, it returns an errorUntitled
ExecutionFeeRegistrationDecoratorThis decorator manages the execution fee return process based on the success or failure of a message execution in a blockUntitled
PoorNetworkManagementDecoratorHandles the allowed messages when the network is in a poor stateUntitled
BlackWhiteTokensCheckDecoratorChecks and prevents transactions involving frozen tokens based on the token blacklist and whitelistUntitled

CLI Syntax & Examples

note

Each CLI command and proposal process in KIRA requires specific permissions. These permissions must be added to the account's whitelist or obtained as sudo permissions for direct changes. Refer to the Roles & Permissions documentation for more details.

note

$SIGNER represents the transaction signer's account name or address. For instructions on setting common flags as environment variables, such as $FLAGS_TX and $FLAGS_QR, see the CLI Guide page.

Transactions

tx signSign transactions generated offline.
tx sign-batchSign multiple offline generated transactions. Combines signed transactions into one file using --append flag.
tx multisignSign transactions by a multisig account offline.
tx multisign-batchSign a batch of transactions for a multisig account. Does not support the --append flag.
tx validate-signaturesValidate the signatures of a signed transaction.
tx broadcastBroadcast a signed transaction to the network.
tx aux-to-feeInclude aux signer data in a transaction, broadcast it, and send the tip amount to the broadcaster.

Sign a Transaction

Sign transactions that were generated offline using the sign command.

sekaid tx sign \
--from=$SIGNER $FLAGS_TX \
tx.json > tx.signed.json

Sign Multiple Transactions

Sign multiple offline generated transactions (-generate-only flag) using the sign-batch command. Transactions can be in one file (one tx per line) or in multiple files. For combining the signed transactions into one transaction, use the --append flag.

sekaid tx sign-batch \
--from=$SIGNER $FLAGS_TX \
txs.json > tx.signed.json

Or

sekaid tx sign-batch \
--from=$SIGNER $FLAGS_TX \
tx1.json tx2.json tx3.json > tx.signed.json

Multi-sign a Transaction

Sign transactions generated offline (-generate-only flag) by a multisig account using the multi-sign command. Where multisigk1k2k3 is the multisig account address, k1sig.json is the signature of the first signer, k2sig.json is the signature of the second signer, and k3sig.json is the signature of the third signer.

sekaid tx multisign \
$FLAGS_TX transaction.json multisigk1k2k3 k1sig.json k2sig.json k3sig.json

Multi-sign a Batch of Transactions

The multisign-batch works the same way as sign-batch, but for multisig accounts. With the difference that the --append flag does not exist.

sekaid tx multisign-batch \
$FLAGS_TX transactions.json multisigk1k2k3 k1sigs.json k2sigs.json k3sig.json

Validate Transaction Signatures

Validate the signatures of a signed transaction using the validate-signatures command.

sekaid tx validate-signatures \
$FLAGS_TX tx.signed.json

Broadcast a Transaction

Broadcast a signed transaction to the network using the broadcast command.

sekaid tx broadcast \
$FLAGS_TX tx.signed.json

Aux-to-fee

The aux-to-fee command includes the aux signer data in the tx, broadcasts the tx, and sends the tip amount to the broadcaster. Learn more about tip transaction.

sekaid tx aux-to-fee \
$FLAGS_TX tx.aux.signed.json