moonbeam
moonbeam copied to clipboard
Setting up node, transfer failed
I execute Docker run -- rm -- name moonbeam_ Development - p 9944:9944 puretake/moonbeam: v0.32.1-- chain moonbeam -- ws external -- rpc external
, and then call the transfer through the program, why did it fail?Error is {'code': 1010, 'message': 'Invalid Transaction', 'data': 'Transaction call is not expected'}
recipient_address = "0x50Bf64677E2652523B88F4810DAC1D875Ad3853b"
form_address = "0x8a8925C3b3298f61c7ECAD83C625105Bff30C351"
transfer_amount = balance * random_number
call = substrate.compose_call(
call_module='Balances',
call_function='transfer',
call_params={
'dest': recipient_address,
'value': transfer_amount,
'gas_limit': 30000
}
)
extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)
receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
Hi @goushijie
It seems you are mixing multiple call data. "Balances.transfer" is the Substrate API, but the substrate API doesn't support providing gas (nor gas limit or price).
Which SDK are you using ? I'm not familiar with the syntax you provided. Additionally, you can try the same without providing the "gas_limit" field, it might work
@goushijie failing transactions are banned for 30min IIRC. You can restart your node (the docker command) to try again.
The code you wrote is unknown to me, can you tell me what SDK/Framework is it ?
@albertov19 any experience with this ?
@eshaben could you please check what the issue is? Thanks in advance 🙏
@goushijie i tried your code snippet out using the latest version of py substrate interface, 1.7.3, and it worked as expected. can you please try to bump the version and let me know if that resolves the issue for you?
Ah ok, I attempted this on a development node, not on moonbeam mainnet. So my command was the same as yours with the exception of the --chain moonbeam
flag. Is your node fully synced with the network?
I'm sorry that you lost your funds 😔💔
Moving forward, if you're running a node on mainnet, try to avoid using the --unsafe-ws-external
command. As it exposes some methods that can be used to submit transactions and retrieve keys from storage. There is more information in the substrate docs