bittensor.core.extrinsics.asyncex.crowdloan#

Functions#

contribute_crowdloan_extrinsic(subtensor, wallet, ...)

Contributes funds to an active crowdloan campaign.

create_crowdloan_extrinsic(subtensor, wallet, deposit, ...)

Creates a new crowdloan campaign on-chain.

dissolve_crowdloan_extrinsic(subtensor, wallet, ...[, ...])

Dissolves a completed or failed crowdloan campaign after all refunds are processed.

finalize_crowdloan_extrinsic(subtensor, wallet, ...[, ...])

Finalizes a successful crowdloan campaign once the cap has been reached and the end block has passed.

refund_crowdloan_extrinsic(subtensor, wallet, crowdloan_id)

Refunds contributors from a failed or expired crowdloan campaign.

update_cap_crowdloan_extrinsic(subtensor, wallet, ...)

Updates the fundraising cap (maximum total contribution) of a non-finalized crowdloan.

update_end_crowdloan_extrinsic(subtensor, wallet, ...)

Updates the end block of a non-finalized crowdloan campaign.

update_min_contribution_crowdloan_extrinsic(subtensor, ...)

Updates the minimum contribution amount of a non-finalized crowdloan.

withdraw_crowdloan_extrinsic(subtensor, wallet, ...[, ...])

Withdraws a contribution from an active (not yet finalized or dissolved) crowdloan.

Module Contents#

async bittensor.core.extrinsics.asyncex.crowdloan.contribute_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, amount, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Contributes funds to an active crowdloan campaign.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • amount (bittensor.utils.balance.Balance) – Amount to contribute.

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.crowdloan.create_crowdloan_extrinsic(subtensor, wallet, deposit, min_contribution, cap, end, call=None, target_address=None, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Creates a new crowdloan campaign on-chain.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

  • deposit (bittensor.utils.balance.Balance) – Initial deposit in RAO from the creator.

  • min_contribution (bittensor.utils.balance.Balance) – Minimum contribution amount.

  • cap (bittensor.utils.balance.Balance) – Maximum cap to be raised.

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

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

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

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.crowdloan.dissolve_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Dissolves a completed or failed crowdloan campaign after all refunds are processed.

This permanently removes the campaign from on-chain storage and refunds the creator’s remaining deposit, if applicable. Can only be called by the campaign creator.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Notes

  • Only the creator can dissolve their own crowdloan.

  • All contributors (except the creator) must have been refunded first.

  • The creator’s remaining contribution (deposit) is returned during dissolution.

  • After this call, the crowdloan is removed from chain storage.

async bittensor.core.extrinsics.asyncex.crowdloan.finalize_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Finalizes a successful crowdloan campaign once the cap has been reached and the end block has passed.

This executes the stored call or transfers the raised funds to the target address, completing the campaign.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted.

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

  • wait_for_inclusion (bool) – Whether to wait for the extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

async bittensor.core.extrinsics.asyncex.crowdloan.refund_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Refunds contributors from a failed or expired crowdloan campaign.

This call attempts to refund up to the limit defined by RefundContributorsLimit in a single dispatch. If there are more contributors than the limit, the call may need to be executed multiple times until all refunds are processed.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Notes

  • Can be called by only creator signed account.

  • Refunds contributors (excluding the creator) whose funds were locked in a failed campaign.

  • Each call processes a limited number of refunds (RefundContributorsLimit).

  • If the campaign has too many contributors, multiple refund calls are required.

async bittensor.core.extrinsics.asyncex.crowdloan.update_cap_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, new_cap, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Updates the fundraising cap (maximum total contribution) of a non-finalized crowdloan.

Only the creator of the crowdloan can perform this action, and the new cap must be greater than or equal to the current amount already raised.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • new_cap (bittensor.utils.balance.Balance) – The new fundraising cap (in TAO or Balance).

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Notes

  • Only the creator can update the cap.

  • The crowdloan must not be finalized.

  • The new cap must be greater than or equal to the total funds already raised.

async bittensor.core.extrinsics.asyncex.crowdloan.update_end_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, new_end, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Updates the end block of a non-finalized crowdloan campaign.

Only the creator of the crowdloan can perform this action. The new end block must be valid — meaning it cannot be in the past and must respect the minimum and maximum duration limits enforced by the chain.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • new_end (int) – The new block number at which the crowdloan will end.

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Notes

  • Only the creator can call this extrinsic.

  • The crowdloan must not be finalized.

  • The new end block must be later than the current block and within valid duration bounds (between

    MinimumBlockDuration and MaximumBlockDuration).

async bittensor.core.extrinsics.asyncex.crowdloan.update_min_contribution_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, new_min_contribution, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Updates the minimum contribution amount of a non-finalized crowdloan.

Only the creator of the crowdloan can perform this action, and the new value must be greater than or equal to the absolute minimum contribution defined in the chain configuration.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Bittensor Wallet instance used to sign the transaction.

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

  • new_min_contribution (bittensor.utils.balance.Balance) – The new minimum contribution amount (in TAO or Balance).

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Notes

  • Can only be called by the creator of the crowdloan.

  • The crowdloan must not be finalized.

  • The new minimum contribution must not fall below the absolute minimum defined in the runtime.

async bittensor.core.extrinsics.asyncex.crowdloan.withdraw_crowdloan_extrinsic(subtensor, wallet, crowdloan_id, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True)#

Withdraws a contribution from an active (not yet finalized or dissolved) crowdloan.

Parameters:
  • subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – Active Subtensor connection.

  • wallet (bittensor_wallet.Wallet) – Wallet instance used to sign the transaction (must be unlocked).

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

  • 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 extrinsic to be included in a block.

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

Returns:

The result object of the extrinsic execution.

Return type:

ExtrinsicResponse

Note

  • Regular contributors can fully withdraw their contribution before finalization.

  • The creator cannot withdraw the initial deposit, but may withdraw any amount exceeding his deposit.