Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up node, transfer failed #2394

Open
goushijie opened this issue Jul 16, 2023 · 11 comments
Open

Setting up node, transfer failed #2394

goushijie opened this issue Jul 16, 2023 · 11 comments

Comments

@goushijie
Copy link

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)
    
@crystalin
Copy link
Collaborator

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
Copy link
Author

goushijie commented Jul 16, 2023

Thank you very much for your reply. I started the script
docker run --rm --name moonbeam_development -p 9944:9944 purestake/moonbeam:v0.32.1 --chain moonbeam --ws-external --rpc-external --unsafe-ws-external
Code:

Substrate=SubstrateInterface (URL="ws://127.0.0.1:9944")
Random_ Number=random. uniform (0.85, 0.95)
Transfer_ Amount=balance * random_ Number
Call=substrate.compose_ Call(
Call_ Module='Balances',
Call_ Function='transfer ',
Call_ Params={
'dest ': recipient_ Address,
'value': transfer_ Amount
}
)
Extrinsic=substrate.create_ Signed_ Extrinsic (call=call, keypair=keypair)
Receive=substrate.submit_ Extrinsic (extrinsic, wait_for_inclusion=True)

But the error message:
{'code': 1012, 'message': 'Transaction is temporarily banned'}

@goushijie
Copy link
Author

will local nodes ban transactions? the link
substrate = SubstrateInterface(url="wss://wss.api.moonbeam.network")
That's right, the transaction can be successful
but if I use link
substrate = SubstrateInterface(url="ws://127.0.0.1:9944"),
it's the error message:
Error: {'code': 1012, 'message': 'Transaction is temporarily banned'}

@crystalin
Copy link
Collaborator

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

@goushijie
Copy link
Author

@crystalin I restarted the node, the same problem, I used SubstrateInterface https://github.com/polkascan/py-substrate-interface

@crystalin
Copy link
Collaborator

@albertov19 any experience with this ?

@albertov19
Copy link
Contributor

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

@eshaben
Copy link
Contributor

eshaben commented Jul 18, 2023

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

@goushijie
Copy link
Author

image
  • @eshaben I'm sure I'm the latest version, but may it be because I don't have the parameters to start the node? How did you start it and can you share your node's script?

  • In addition, the hacker had already transferred my assets a few hours ago, using the entire value as a gas transfer. This hacker has extensive experience

  • Thank you very much for your support. I have learned a very painful lesson

截屏2023-07-18 上午8 47 19

@eshaben
Copy link
Contributor

eshaben commented Jul 18, 2023

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
Copy link
Contributor

eshaben commented Jul 18, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants