moonbeam icon indicating copy to clipboard operation
moonbeam copied to clipboard

Setting up node, transfer failed

Open goushijie opened this issue 1 year ago • 11 comments

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)
    

goushijie avatar Jul 16 '23 07:07 goushijie

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

crystalin avatar Jul 16 '23 08:07 crystalin

@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 ?

crystalin avatar Jul 17 '23 06:07 crystalin

@albertov19 any experience with this ?

crystalin avatar Jul 18 '23 06:07 crystalin

@eshaben could you please check what the issue is? Thanks in advance 🙏

albertov19 avatar Jul 18 '23 10:07 albertov19

@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?

eshaben avatar Jul 18 '23 14:07 eshaben

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?

eshaben avatar Jul 18 '23 16:07 eshaben

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

eshaben avatar Jul 18 '23 16:07 eshaben