Nethereum / Nethereum/Nethereum

Send ERC20 Tokens from one account to another account using Xamarin C#

Open
#557 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.3k
Forks
744
PR merge metrics
No merged PRs in 30d

Description

Nethereum.JsonRpc.Client.RpcResponseException: Transaction gas is too low. There is not enough gas to cover minimal cost of the transaction (minimal: 22808, got: 0). Try increasing supplied gas.

Can you please tell me how to Transfer Tokens by setting Gas/Gas price to 0.

            Account DefaultAccount => Wallet?.GetAccount(0)
            var client = new RpcClient(new Uri(GetLandscape.CongigURL.Uri));
            web3 = new Web3(DefaultAccount, client);

            var txCount = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(publickey);

            var transfer = new TransferFunction()
            {
                To = to,
                AmountToSend = amount,
                Nonce = new BigInteger(txCount),
                FromAddress = from,
                Gas = new BigInteger(0),
                GasPrice = new BigInteger(0)
            };

            var signedMessage = await web3.Eth.GetContractHandler(GetLandscape.CongigURL.ContractAddress)
                .SignTransactionAsync(transfer);
            web3.TransactionManager.DefaultGasPrice = new BigInteger(0);
            web3.TransactionManager.DefaultGas = new BigInteger(0);
            await Task.Delay(5000);
            return await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + signedMessage).ConfigureAwait(false)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the TransferFunction and SignTransactionAsync entry points used in the issue, then inspect how Gas and GasPrice are handled before SendRawTransactionAsync. Check the relevant transaction-signing tests or examples for ERC20 transfers. Done means the supported behavior for these zero values is documented or reproduced with a clear, tested outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.