<<<<<<<< HEAD:static/python-api/html/autoapi/bittensor/core/extrinsics/pallets/crowdloan/index.html

bittensor.core.extrinsics.pallets.crowdloan

========

bittensor.core.extrinsics.asyncex.mev_shield

>>>>>>>> origin/main:static/python-api/html/autoapi/bittensor/core/extrinsics/asyncex/mev_shield/index.html

Contents

<<<<<<<< HEAD:static/python-api/html/autoapi/bittensor/core/extrinsics/pallets/crowdloan/index.html

bittensor.core.extrinsics.pallets.crowdloan#

Classes#

========

bittensor.core.extrinsics.asyncex.mev_shield#

Module provides async MEV Shield extrinsics.

Functions#

Crowdloan

Factory class for creating GenericCall objects for Crowdloan pallet functions.

>>>>>>>> origin/main:static/python-api/html/autoapi/bittensor/core/extrinsics/asyncex/mev_shield/index.html

submit_encrypted_extrinsic(subtensor, wallet, call[, ...])

Submits an encrypted extrinsic to the MEV Shield pallet.

wait_for_extrinsic_by_hash(subtensor, extrinsic_hash, ...)

Wait for the result of a MeV Shield encrypted extrinsic.

Module Contents#

<<<<<<<< HEAD:static/python-api/html/autoapi/bittensor/core/extrinsics/pallets/crowdloan/index.html
class bittensor.core.extrinsics.pallets.crowdloan.Crowdloan#

Bases: bittensor.core.extrinsics.pallets.base.CallBuilder

Factory class for creating GenericCall objects for Crowdloan pallet functions.

This class provides methods to create GenericCall instances for all Crowdloan pallet extrinsics.

Works with both sync (Subtensor) and async (AsyncSubtensor) instances. For async operations, pass an AsyncSubtensor instance and await the result.

Example

# Sync usage call = Crowdloan(subtensor).finalize(crowdloan_id=123) response = subtensor.sign_and_send_extrinsic(call=call, …)

# Async usage call = await Crowdloan(subtensor).finalize(crowdloan_id=123) response = await async_subtensor.sign_and_send_extrinsic(call=call, …)

contribute(crowdloan_id, amount)#

Returns GenericCall instance for Subtensor function Crowdloan.contribute.

Parameters:
  • crowdloan_id (int) – The unique identifier of the crowdloan to contribute to.

  • amount (int) – Amount in RAO to contribute.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

========
async bittensor.core.extrinsics.asyncex.mev_shield.submit_encrypted_extrinsic(subtensor, wallet, call, sign_with='coldkey', *, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=False, wait_for_revealed_execution=True, blocks_for_revealed_execution=3)#

Submits an encrypted extrinsic to the MEV Shield pallet.

This function encrypts a call using ML-KEM-768 + XChaCha20Poly1305 and submits it to the MevShield pallet. The extrinsic remains encrypted in the transaction pool until it is included in a block and decrypted by validators.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – The Subtensor client instance used for blockchain interaction.

  • wallet (bittensor_wallet.Wallet) – The wallet used to sign the extrinsic (must be unlocked, coldkey will be used for signing).

  • call (scalecodec.types.GenericCall) – The GenericCall object to encrypt and submit.

  • sign_with (str) – The keypair to use for signing the inner call/extrinsic. Can be either “coldkey” or “hotkey”.

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.

  • raise_error (bool) – Raises a relevant exception rather than returning False if unsuccessful.

  • wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.

  • wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.

  • wait_for_revealed_execution (bool) – Whether to wait for the executed event, indicating that validators have successfully decrypted and executed the inner call. If True, the function will poll subsequent blocks for the event matching this submission’s commitment.

  • blocks_for_revealed_execution (int) – Maximum number of blocks to poll for the executed event after inclusion. The function checks blocks from start_block + 1 to start_block + blocks_for_revealed_execution. Returns immediately if the event is found before the block limit is reached.

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Raises:
  • ValueError – If NextKey is not available in storage or encryption fails.

  • SubstrateRequestException – If the extrinsic fails to be submitted or included.

>>>>>>>> origin/main:static/python-api/html/autoapi/bittensor/core/extrinsics/asyncex/mev_shield/index.html

Note

The encryption uses the public key from NextKey storage, which rotates every block. The payload structure is: payload_core = signer_bytes (32B) + key_hash (32B Blake2-256 hash of NextKey) + SCALE(call) plaintext = payload_core + b”x01” + signature (64B for sr25519) commitment = blake2_256(payload_core)

The key_hash binds the transaction to the key epoch at submission time and replaces nonce-based replay protection.

<<<<<<<< HEAD:static/python-api/html/autoapi/bittensor/core/extrinsics/pallets/crowdloan/index.html
create(deposit, min_contribution, cap, end, call=None, target_address=None)#

Returns GenericCall instance for Subtensor function Crowdloan.create.

Parameters:
  • deposit (int) – Initial deposit in RAO from the creator.

  • min_contribution (int) – Minimum contribution amount in RAO.

  • cap (int) – Maximum cap to be raised in RAO.

  • end (int) – Block number when the campaign ends.

  • call (Optional[scalecodec.GenericCall]) – Runtime call data (e.g., subtensor::register_leased_network).

  • target_address (Optional[str]) – SS58 address to transfer funds to on success.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

========
async bittensor.core.extrinsics.asyncex.mev_shield.wait_for_extrinsic_by_hash(subtensor, extrinsic_hash, shield_id, submit_block_hash, timeout_blocks=3)#

Wait for the result of a MeV Shield encrypted extrinsic.

After submit_encrypted succeeds, the block author will decrypt and submit the inner extrinsic directly. This function polls subsequent blocks looking for either: - an extrinsic matching the provided hash (success) OR - a markDecryptionFailed extrinsic with matching shield ID (failure)

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – SubtensorInterface instance.

  • extrinsic_hash (str) – The hash of the inner extrinsic to find.

  • shield_id (str) – The wrapper ID from EncryptedSubmitted event (for detecting decryption failures).

  • submit_block_hash (str) – Block hash where submit_encrypted was included.

  • timeout_blocks (int) – Max blocks to wait (default 3).

Returns:

Optional ExtrinsicReceipt.

Return type:

Optional[async_substrate_interface.AsyncExtrinsicReceipt]

>>>>>>>> origin/main:static/python-api/html/autoapi/bittensor/core/extrinsics/asyncex/mev_shield/index.html
<<<<<<<< HEAD:static/python-api/html/autoapi/bittensor/core/extrinsics/pallets/crowdloan/index.html
dissolve(crowdloan_id)#

Returns GenericCall instance for Subtensor function Crowdloan.dissolve.

Parameters:

crowdloan_id (int) – The unique identifier of the crowdloan to dissolve.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

finalize(crowdloan_id)#

Returns GenericCall instance for Subtensor function Crowdloan.finalize.

Parameters:

crowdloan_id (int) – The unique identifier of the crowdloan to finalize.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

refund(crowdloan_id)#

Returns GenericCall instance for Subtensor function Crowdloan.refund.

Parameters:

crowdloan_id (int) – The unique identifier of the crowdloan to refund.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

update_cap(crowdloan_id, new_cap)#

Returns GenericCall instance for Subtensor function Crowdloan.update_cap.

Parameters:
  • crowdloan_id (int) – The unique identifier of the crowdloan to update the cap for.

  • new_cap (int) – New cap to be raised in RAO.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

update_end(crowdloan_id, new_end)#

Returns GenericCall instance for Subtensor function Crowdloan.update_end.

Parameters:
  • crowdloan_id (int) – The unique identifier of the crowdloan to update the end block number for.

  • new_end (int) – New end block number.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

update_min_contribution(crowdloan_id, new_min_contribution)#

Returns GenericCall instance for Subtensor function Crowdloan.update_min_contribution.

Parameters:
  • crowdloan_id (int) – The unique identifier of the crowdloan to update the minimum contribution amount for.

  • new_min_contribution (int) – New minimum contribution amount in RAO.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

withdraw(crowdloan_id)#

Returns GenericCall instance for Subtensor function Crowdloan.withdraw.

Parameters:

crowdloan_id (int) – The unique identifier of the crowdloan to withdraw from.

Returns:

GenericCall instance.

Return type:

bittensor.core.extrinsics.pallets.base.Call

======== >>>>>>>> origin/main:static/python-api/html/autoapi/bittensor/core/extrinsics/asyncex/mev_shield/index.html