Closed Xuefeng-Zhu closed 4 years ago
However, when I include all msgs in one transaction, if one msg results in an error, the whole transaction will fail.
Currently, this is the only way. Your best bet is to make sure all messages in the tx are valid. We're potentially looking into ways of allowing multiple txs sequentially, but it's not a priority atm.
@alexanderbez Thank you for the response. I wonder if there is a way to do the precommit check like ethereum?
Maybe you can try the --dry-run
option first before broadcasting?
@alexanderbez Thank you for the quick response.
So if I do it in code
cliCtx := client.
NewCLIContext().
WithCodec(cdc).
WithFromAddress(key.GetAddress()).
WithFromName(key.GetName()).
WithNodeURI(nodeURI).
WithTrustNode(true).
WithBroadcastMode(flags.BroadcastSync).
WithSimulate(true)
cliCtx.BroadcastTx(txBytes)
The transaction will only run locally instead of broadcasting to the network?
It seems that dry run will only estimate the gas whenever the msg will succeed or not.
You'd have to run simulation, yes. That should let you know that CheckTx passes.
@alexanderbez Is there sample code to do it? I used CompleteAndBroadcastTxCLI
from https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/client/tx.go#L48, but it will not return err when the tx fails
which cosmos sdk version was used here?
Sending multiple transactions in v0.35.0 was working by using offline signer but it's not working on v0.38.3. Please share what's happening if someone experience similar issue.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I have the use case that one account needs to sends multiple msgs in one block. Currently, If one account sends the msgs in separate transactions, they will result in errors because of account seqNum. However, when I include all msgs in one transaction, if one msg results in an error, the whole transaction will fail. I wonder if there is a way to send multiple msgs in one block for one account