I want to automate sending astar(NOT EVM) with Python(SubstrateInterface). I received an error when executing the following code.
# Imports
from substrateinterface import SubstrateInterface, Keypair, KeypairType
from substrateinterface.exceptions import SubstrateRequestException
# Construct the API provider
substrate = SubstrateInterface(
url="wss://rpc.astar.network",
ss58_format=42,
type_registry_preset='substrate-node-template',
)
keypair = Keypair.create_from_mnemonic(
"***",
ss58_format = 42,
)
print(keypair.ss58_address)
# Form a transaction call
call = substrate.compose_call(
call_module='Balances',
call_function="transfer",
call_params={
"dest": "***",
'value': 1 * 10**16,
"gas_limit": 21000,
}
)
# Form a signed extrinsic
extrinsic = substrate.create_signed_extrinsic(
call = call,
keypair = keypair,
nonce = substrate.get_account_nonce(keypair.ss58_address),
)
print(extrinsic)
# Submit the extrinsic
try:
receipt = substrate.submit_extrinsic(
extrinsic,
wait_for_inclusion = True,
)
print("Extrinsic '{}' sent and included in block '{}'".format(receipt.extrinsic_hash, receipt.block_hash))
except SubstrateRequestException as e:
print("Failed to send: {}".format(e))
Failed to send: { 'code': 1002, 'message': 'Verification Error: Runtime error: Execution failed: Execution aborted due to trap: wasm trap: wasm
unreachable
instruction executed\nWASM backtrace:\n\n
0: 0x44fa8a - !rust_begin_unwind\n 1: 0x3922e4 - !core::panicking::panic_fmt::h32de9c76c9d5eb0c\n 2: 0x1e31a5 - !TaggedTransactionQueue_validate_transaction\n', 'data': 'RuntimeApi("Execution failed: Execution aborted due to trap: wasm trap: wasmunreachable
instruction executed\nWASM backtrace:\n\n 0: 0x44fa8a - !rust_begin_unwind\n 1: 0x3922e4 - !core::panicking::panic_fmt::h32de9c76c9d5eb0c\n 2: 0x1e31a5 - !TaggedTransactionQueue_validate_transaction\n")' }
What could be the issue?