These are chat archives for Nethereum/Nethereum

16th
May 2018
junocaj
@junocaj
May 16 2018 07:37

hi @juanfranblanco , do you have any insight on the contract things under BlockchainStorage?

still unable to store any contact/transactionlog/transactionvmstack

Kirankumar
@kiranbasvaraj
May 16 2018 07:52
hi,
var val = await func.SendTransactionAsync(UserWalletAdress,input);
i am doing send transaction async but i am getting exception saying that "Invalid address (should be 20 bytes length): 4e17bd4c30be2a468bc7449368f73cc4c165f99f6b585f62910449dā€¦"
help please!!!
Enigmatic
@EnigmaticUnreal_twitter
May 16 2018 08:12

@kiranbasvaraj - What's your wallet address? Also what are you planning to do? E.g. calling a contract function, or sending ethers to a payable function, or simply sending ethers to another address, etc?

If you're sending ethers you could use the below SendTransactionAsync:

Function SendTransactionAsync(from As String, [to] As String, amount As HexBigInteger) As Task(Of String)

Which expects a From address, a To address, and an amount in HexBigInteger.

If you're calling a function, then it'll be different in the sense that you'll have a function object, then pass in the relevant parameters.

Juan Blanco
@juanfranblanco
May 16 2018 08:45
@junocaj hi ill have a look now.. i forgot about that one
also it needs an upgrade anyway to the latest
junocaj
@junocaj
May 16 2018 08:47
thanks thanks...i will update later
Menno Hamburg
@MHamburg
May 16 2018 08:50
Quick small question, is the Web3 client thread safe (can I make a singleton)? Or do I need to initialize a Web3 client for each request? (which has the risk of port exhaustion if you use it in many instances)
Kirankumar
@kiranbasvaraj
May 16 2018 09:25
@EnigmaticUnreal_twitter my wallet address is 0x474c01ee07e4226b41ce9b98c3e7251ca1d600fe
and i am trying to call a contract fucntion. i am not sending ethers
Kirankumar
@kiranbasvaraj
May 16 2018 12:27

Hi ,
i am using nethereum plugin for interaction with ethereum
i am doing this
try
{

            var contract=  await  this.Init(XyzContarctAddress);//this will give contract
            var func = contract.GetFunction("MethodName");

           var transactionHash = await func.SendTransactionAsync(AppConstants.AdminWalletAddress, AppConstants.UserWalletAdress,"XyzInputs");
          var miningResult = await gethWeb3.Miner.Start.SendRequestAsync(6);
         .
        .
       .
      .
       .
      .
      .

        }

        catch (Exception ex)
        {

            Debug.WriteLine(ex.ToString());
        }

But here await gethWeb3.Miner.Start.SendRequsetAsync(6) is giving exception saying The method miner_start does not exist/is not available
at Nethereum.JsonRpc.Client.RpcClient.HandleRpcError............
here gethWeb3 is gethWeb3 = new Web3Geth(AppConstants.Nethereum_Base_Url);

can any one help me!!
Enigmatic
@EnigmaticUnreal_twitter
May 16 2018 12:35

I assume you're using geth private network... Have you exposed the RPC methods on geth?

Off the top of my head I believe the command is similar to: geth --rpc --rpcapi web3,eth,personal,miner,net,txpool

On the contract function call, you might want to double check to see if your parameter "input" is an address since 4e17bd4c30be2a468bc7449368f73cc4c165f99f6b585f62910449d is definitely way too long.

Maybe I am missing something, but if you're calling a function you might also need to define the gas limit (most base gas is set to 21k). But since it is complaining about the address you will want to check that first.

Salazar, F. šŸŽ–
@_Salazar_F_twitter
May 16 2018 19:29
I'm trying to use the EstimateGasAsync function (with 'await') and the processing stops without returning error (no error). Can you help me?
Stef Heyenrath
@StefH
May 16 2018 20:40

@_Salazar_F_twitter
In my generated NEthereum Service class I've this code:

public async Task<string> AddSupplierAsync(string addressFrom, string supplierAddress, string name, HexBigInteger gas = null, HexBigInteger valueAmount = null)
{
    var function = GetFunctionAddSupplier();

    if (gas == null)
    {
        BigInteger estimatedGas = await function.EstimateGasAsync(addressFrom, gas, valueAmount, supplierAddress, name).ConfigureAwait(false);
        gas = new HexBigInteger(estimatedGas);
    }

    return await function.SendTransactionAsync(addressFrom, gas, valueAmount, supplierAddress, name).ConfigureAwait(false);
}

Where GetFunctionAddSupplier() looks like:

public Function GetFunctionAddSupplier()
{
    return _contract.GetFunction("addSupplier");
}

This works fine when executed on Ganache or Ethereum Consortium Blockchain.

(If you want to know more about the C# interface + class generation from a contract, see Lab 2 from https://github.com/mstack/bootcamp-blockchain-smartcontracts)

Juan Blanco
@juanfranblanco
May 16 2018 20:42
or.. @_Salazar_F_twitter just use vs code and generate ;)
but as @StefH mention you can mainly do that
or if you use the messages generated you can do the following
but the estimates are handled for you already
Juan Blanco
@juanfranblanco
May 16 2018 21:23
@MHamburg it is thread safe, and the port exhaustion it is actually handled in the rpc http layer
actually the transaction manager handles your nonce concurrency
hence the new code generator does not include that
although it provides the capability if you want to