These are chat archives for Nethereum/Nethereum

30th
Jun 2017
FVE
@FVE999_twitter
Jun 30 2017 08:21

Hi, I am trying to find a way to create a signed offline transaction to transfer ERC20-tokens with C#. As MyEtherWallet can do it I think it is possible with Nethereum. But I can't find out how...

I was able to create an offline transaction to send ETH from one address to another with:

var encoded = web3.OfflineTransactionSigning.SignTransaction(_privateKey, contractAddress, WeiAmount, Nonce, GasPrice, _gasLimit);

Can I do something like this to transfer ERC20-tokens?

Jacob Brown
@jacobthebrown
Jun 30 2017 18:36
var abi = @"[{""constant"":false,""inputs"":[{""name"":""entryID"",""type"":""uint256""},{""name"":""version"",""type"":""uint8""},{""name"":""entryHash"",""type"":""bytes32""}],""name"":""addEntry"",""outputs"":[{""name"":""success"",""type"":""bool""}],""type"":""function""},{""constant"":true,""inputs"":[],""name"":""_hasPermissions"",""outputs"":[{""name"":"""",""type"":""bool""}],""type"":""function""},{""constant"":true,""inputs"":[{""name"":""entryID"",""type"":""uint256""},{""name"":""version"",""type"":""uint8""}],""name"":""getEntry"",""outputs"":[{""name"":""hashEntry"",""type"":""bytes32""},{""name"":""entryExists"",""type"":""bool""}],""type"":""function""},{""constant"":false,""inputs"":[],""name"":""DeepFreeze"",""outputs"":[],""type"":""function""},{""constant"":true,""inputs"":[],""name"":""owner"",""outputs"":[{""name"":"""",""type"":""address""}],""type"":""function""},{""constant"":false,""inputs"":[{""name"":""newAddress"",""type"":""address""},{""name"":""access"",""type"":""bool""}],""name"":""_setPermissions"",""outputs"":[{""name"":"""",""type"":""bool""}],""type"":""function""},{""constant"":false,""inputs"":[{""name"":""numberOfEntries"",""type"":""uint256""},{""name"":""hash"",""type"":""bytes32""}],""name"":""addDudEntries"",""outputs"":[],""type"":""function""}]";
var byteCode = "0x6060604052341561000c57fe5b5b33600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061008e600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166001610095640100000000026103bf176401000000009004565b505b610158565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373";
var senderAddress = "0x683c67010a5dfaa542037374b9bcb8e6b71e881b";

transactionHash = await web3.Eth.DeployContract.SendRequestAsync(abi, byteCode, senderAddress, new HexBigInteger(0xFFFFF));
I cannot for the life of me find out why I am getting a System.AggregateException with an exception "One or more errors occured"
{"Object reference not set to an instance of an object."}
why... why does nethereum not send more detailed rpc exception information
Fazri Zubair
@FazriZubair_twitter
Jun 30 2017 22:48

I keep getting 0x response trying to get the balance of a token contract in Unity, following the blog post example. Is contract first param suppose to be null?
'''
EthCallUnityRequest tokenBalanceCall = new EthCallUnityRequest("https://api.myetherapi.com/rop");

    string abi = "MYABI"; // this is placeholder for the post

    Contract contract = new Contract(null,
        abi,
        "MYCONTRACTID");

    Function balanceOf = contract.GetFunction("totalSupply");
    Debug.Log(balanceOf.GetData());
    yield return tokenBalanceCall.SendRequest(balanceOf.CreateCallInput(null), Nethereum.RPC.Eth.DTOs.BlockParameter.CreateLatest());
    Debug.Log("RAW: " + tokenBalanceCall.Result);
    int balance = balanceOf.DecodeSimpleTypeOutput<int>(tokenBalanceCall.Result);
    Debug.Log("TEST: " + balance);
}

'''

Fazri Zubair
@FazriZubair_twitter
Jun 30 2017 23:00
Ok solved it... Might need to understand this better, what does BlockParameter mean? So changing it from CreateLatest() to CreatePending() solved my issue