These are chat archives for Nethereum/Nethereum

28th
May 2018
I am off this week so answers will trickle ;)
Celestral
@Celestral
May 28 2018 08:33
@EnigmaticUnreal_twitter I worked around it by creating a local textfile with just the address and private key, but this is much better thank you!!
Wilco Bakker
@WilcoBakker
May 28 2018 14:39
Are WebSocket connections between C# and Ethereum nodes supported as of version 2.4.0?
bankojan
@bankojan
May 28 2018 16:16
Hi, I am trying to deploy a smart contract on a private chain that has a gas price of 0. But when I try to deploy it with web3.Eth.DeployCotnract.SendRequestAndWaitForReceiptAsync I get an error saying that I have insufficient funds? Can you help me
Stef Heyenrath
@StefH
May 28 2018 17:06

@bankojan I think that deploying a contract always costs gas.

I use the EstimateGasAsync(...) method to deploy a contract, see complete code below:

public static async Task<string> DeployContractAsync(Web3 web3, string addressFrom,  CancellationTokenSource token = null, HexBigInteger gas = null)
{
    if (gas == null)
    {
        BigInteger estimatedGas = await web3.Eth.DeployContract.EstimateGasAsync(ABI, ByteCode, addressFrom).ConfigureAwait(false);
        gas = new HexBigInteger(estimatedGas);
    }

    var transactionReceipt = await web3.Eth.DeployContract.SendRequestAndWaitForReceiptAsync(ABI, ByteCode, addressFrom, gas, token).ConfigureAwait(false);
    return transactionReceipt.ContractAddress;
}