The accounts calling the transaction are shared between them and, in fact, sometimes I get an rpc exception about 'already known transaction' (that's the message, more or less).
var functionInput = transaction.DecodeTransactionToFunctionMessage<PublishFunction>();
System.ArgumentException: The transaction given is not for the current function
Parameter name: transaction
at Nethereum.Contracts.MessageEncodingServices.FunctionMessageEncodingService`1.DecodeTransactionInput(TContractFunction contractMessageOuput, Transaction transaction)
at EthTransToExcl.Do.ShouldBeAbleCallAndReadEventLogs(List`1 results) in E:\Git_Work\EthTransToExcl\EthTransToExcl\Do.cs:line 33
function setAllocation(address _address, uint256 total_value, uint[] times, uint256[] balanceRequires) public onlyOwner returns (bool)
[Function("publish")]
public class PublishFunctionBase : FunctionMessage
{
[Parameter("address", "retailer", 1)]
public virtual string Retailer { get; set; }
[Parameter("string", "stdPromoJson", 2)]
public virtual string StdPromoJson { get; set; }
}
[Function("transfer")]
public class TransferFunction : PublishFunctionBase
{
[Parameter("address", "_to", 1)]
public string To { get; set; }
[Parameter("uint256", "_value", 2)]
public BigInteger Value { get; set; }
}
[Function("setAllocation")]
public class SetAllocationFunction : PublishFunctionBase
{
[Parameter("address", "_address", 1)]
public string Address { get; set; }
[Parameter("uint256", "total_value", 2)]
public BigInteger Value { get; set; }
[Parameter("uint[]", "times", 3)]
public BigInteger Times { get; set; }
[Parameter("uint256[]", "balanceRequires", 4)]
public BigInteger BalanceRequires { get; set; }
}
var account = new Account(privateKey);
var web3 = new Web3(account, url);
foreach (var result in results)
{
var transactionHash = result.hash;
var transaction = await web3.Eth.Transactions.GetTransactionByHash.SendRequestAsync(transactionHash);
var functionInput = transaction.DecodeTransactionToFunctionMessage<SetAllocationFunction>();
}
[Function("setAllocation")]
public class SetAllocationFunction : FunctionMessage
{
[Parameter("address", "_address", 1)]
public string Address { get; set; }
[Parameter("uint256", "total_value", 2)]
public BigInteger Value { get; set; }
[Parameter("uint[]", "times", 3)]
public BigInteger Times { get; set; }
[Parameter("uint256[]", "balanceRequires", 4)]
public BigInteger BalanceRequires { get; set; }
}
So if you are using different programs, processes the best thing is to use different accounts per process, or have a nonce provider microservice for the accounts
@juanfranblanco
I have one problem when I do sign with a transaction with nethereum trezor. It works fine. Then why there is problem with web3. It gives me invalid sender error
var accountNethereum = new Account("0x2e14c29aaecd1b7c681154d41f50c4bb8b6e4299a431960ed9e860e39cae6d29");
accountNethereum.TransactionManager.Client = new RpcClient(new Uri("http://localhost:8545"));
var signatureNethereum = await accountNethereum.TransactionManager.SignTransactionAsync(tx);
System.Console.WriteLine("Trezor: " + signature);
System.Console.WriteLine("Nethereum: " + signatureNethereum);
what client are you using?
Many thanks. I am wondering why there isnt a Task for "MineAndGetReceiptAsync" in the example u showed me which I am working on now, is it an assumption I already have it or?
Secondly, I get an error stating "TokenAmount" isnt defined in "Transferfunction" but I see it defined as:
public System.Numerics.BigInteger TokenAmount { get; set; }
Not really sure about that