cosmos / cosmos/evm

CLI command 'tx evm send' creates Cosmos transactions instead of Ethereum transactions

Open
#777 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
164
Forks
213
Avg merge
3d 58m
Merged PRs (30d)
12

Description

## Bug Report
### Summary
The `evmd tx evm send` CLI command is incorrectly implemented and creates regular Cosmos `MsgSend` transactions instead of Ethereum `MsgEthereumTx` transactions. This causes confusion for users who expect EVM transactions when using the EVM module's send command.

### Expected Behavior
When using `evmd tx evm send [from] [to] [amount]`, the command should:

- Create a `MsgEthereumTx` transaction that executes on the EVM
- Show up in EVM block explorers
- Work with third party's expecting Ethereum transactions
- Behave like a native Ethereum transfer

### Actual Behavior
The command currently:

- Creates a regular Cosmos `MsgSend` transaction
- Only shows up in Cosmos explorers, not EVM explorers
- Doesn't work with third party services expecting Ethereum transactions
- Transfers tokens on the Cosmos side instead of EVM side

### Steps to Reproduce

1. Set up a local Cosmos EVM chain using `evmd`
2. Run: `evmd tx evm send [from_address] [to_address] [amount] --fees [fee] --gas [gas_limit]`
3. Check the transaction in both Cosmos and EVM explorers
4. Observe that the transaction only appears in the Cosmos explorer

### Code Analysis
The issue is in `x/vm/client/cli/tx.go` in the `NewSendTxCmd` function:
https://github.com/cosmos/evm/blob/main/x/vm/client/cli/tx.go#L173
```go
//This creates a Cosmos MsgSend instead of MsgEthereumTx
msg := types2.NewMsgSend(clientCtx.GetFromAddress(), toAddr, coins)
```

### Proposed Solution
The `NewSendTxCmd` function should create a `MsgEthereumTx` instead of `MsgSend`. The implementation should:

- Create an Ethereum transaction using `EvmTxArgs`
- Use `NewTx()` to create a `MsgEthereumTx`
- Handle gas estimation properly for EVM transactions
- Maintain compatibility with both hex and bech32 addresses

Contributor guide

Open the contributing guide

Research direction

Start in x/vm/client/cli/tx.go at NewSendTxCmd and reproduce the command with the listed evmd arguments. Read the EvmTxArgs and NewTx usage described in the issue, then verify that the command produces a MsgEthereumTx, handles gas and both address formats, and appears in EVM rather than only Cosmos explorers.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
blockchain, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.