GENERALBYTESCOM / batm_public

BATM Public Repository
www.generalbytes.com
Other
98 stars 241 forks source link

ERC20 - Mumbai #711

Open enriquesouza opened 2 years ago

enriquesouza commented 2 years ago

Hi, I am having an issue to send and ERC20 TOKEN using mumbai and infura.

return new ERC20Wallet(rpcURL, passwordOrMnemonic, tokenSymbol, tokenDecimalPlaces,
                        contractAddress, gasLimit, gasPriceMultiplier);

When it tries to send ti returns the following error

web3j only replay-protected (EIP-155) transactions allowed over RPC
pvyhnal-generalbytes commented 2 years ago

Hi, Mumbai is a testnet of Polygon chain? I'm not really familiar with that and how sending ERC20 tokens work there, but it seems you might need to create your own version of "ERC20Wallet" class, it's using https://mainnet.infura.io/v3/ endpoint and you might need to use a Polygon specific endpoint? See here https://docs.infura.io/infura/networks/polygon-pos/getting-started/make-requests

Also you can enable TRACE logging in logback to see the HTTP requests you are sending to Infura and analyze if there is anything wrong with them

enriquesouza commented 2 years ago

Yes, Mumbai is the test net of Polygon. Usually I use it via node JS. I think our web3j is not up to date, since I had to to upgrade our web3 using nodeJS. Well, it usually require a chain ID, I could not find a way to pass the chain id here yet.

Hum... I am using this implementation here:

https://github.com/biteuro-io/batm_public/blob/1750d2f004e3780f008392ddbfa8c20a95ed9c75/server_extensions_extra/src/main/java/com/generalbytes/batm/server/extensions/extra/ethereum/erc20/ERC20Wallet.java

enriquesouza commented 2 years ago

I am comparing the version of the code and the latest, and:

Latest: https://docs.web3j.io/4.8.7/

The code version org.web3j:abi:3.6.0

enriquesouza commented 2 years ago

Yes, that is exactly what I need. I need to upgrade the dependency to the latest. The problem is that there are a bunch of dependencies validations that are not allowing me to do that.

Specifying the Chain Id on Transactions (EIP-155)

TransactionManager transactionManager = new RawTransactionManager( web3j, credentials, ChainId.MAINNET);

   ```
   The RawTransactionManager takes an optional chainId parameter to specify the chain id to be used on transactions as per [EIP-155](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md). This prevents transactions from one chain being re-broadcast onto another chain, such as from Ropsten to Mainnet:
   ```