These are chat archives for Nethereum/Nethereum

24th
Aug 2018
p0isoN
@p0isoNz_twitter
Aug 24 2018 13:56
?
Enigmatic
@EnigmaticUnreal_twitter
Aug 24 2018 15:14
Hey @p0isoNz_twitter - Just reached home from the airport. I'll look through over the next hour or so. Though yesterday I did a couple transactions without issues it seems.
Which code were you using @p0isoNz_twitter ? The one as posted by junbest?
Cdpopham
@Cdpopham
Aug 24 2018 18:18
Is there a way to instantiate a web3 client in nethereum that matches this Web3.js overload? HttpProvider takes 4 arguments (host, timeout, user, password)
Specifically the username and password fields.. THe Iclient definition only has a routeparams field
Enigmatic
@EnigmaticUnreal_twitter
Aug 24 2018 18:21

I've tried using Nethereum.StandardTokenEIP20.Functions as well as manually calling for the contract transfer function then using SendAsync, both with no issues so far. Gas price 5gwei with 80,000 gas limit. All on mainnet, using both Infura V3 and the previous URL.

Might be something small I am overlooking. Will continue this later this afternoon with a fresher pair of eyes.

Let me know if you might stumble on anything @p0isoNz_twitter; I did a check around Github to see if anyone else was complaining about the same issue, so far no luck.

Enigmatic
@EnigmaticUnreal_twitter
Aug 24 2018 18:26

@sjalq

Something like this:

        sentValue = value.Value
        Dim nonce = Await iweb3.Eth.Transactions.GetTransactionCount.SendRequestAsync("0x00000000000000000000000000000000000000000")
        Dim param1 = sentValue.ToString("X16").PadLeft(64, "0")
        Dim param2 = SomeBigNumber.ToString("X16").Substring(1) 'remove unsigned byte indicator
        Dim data = functionSig & param1 & param2
        Dim encoded = Web3.OfflineTransactionSigner.SignTransaction(privateKey.GetPrivateKey, tokenContractAddress, sentValue, nonce.Value, gasPrice, gas, data)
        transactionHash = Await iweb3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + encoded)
        receipt = Await iweb3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash)

Here I was manually signing the transaction and deploying it raw, the function accepts two parameters, and I needed to find out the function signature (basically 4 bytes of the keccak256 of the function, e.g. RemovePrefix(Web3.Sha3("transfer(address,uint256)").Substring(0, 8))) before being able to construct the data variable.

Do take note of the data encoding: https://solidity.readthedocs.io/en/v0.4.24/abi-spec.html#formal-specification-of-the-encoding

You should be able to reuse web3 without issues. Let us know if you see anything weird. :)