These are chat archives for Nethereum/Nethereum

Oct 2018
Oct 11 2018 06:17
function getPlayerInfoByAddress(address _addr) public view returns(address , uint256 , uint256 ,uint256 ,uint256 ,bool ,uint256)
this is my smart contract code
I don't know how I'm going to accept what the function returns
Oct 11 2018 07:54
@juanfranblanco Any ideas about this error? I noticed that some people have the same issue but not sure if we have found the solution: Cancel token sell failed: Nethereum.JsonRpc.Client.RpcResponseException: gas required exceeds allowance or always failing transaction at Nethereum.JsonRpc.Client.RpcClient.HandleRpcError (Nethereum.JsonRpc.Client.RpcMessages.RpcResponseMessage response) [0x00033] in <baaf5f434a214d9eaa3168648972e02f>:0 at Nethereum.JsonRpc.Client.RpcClient+<SendInnerRequestAync>d__12`1[T].MoveNext () [0x000a3] in <baaf5f434a214d9eaa3168648972e02f>:0
It used to work the other day but not now for me
Oct 11 2018 07:55
I have read the code you sent us. But I could not understand it.
I would like to resolve any pending transactions generated using this code.
var web3 = new Web3(account, url);
var txCount = await web3.Eth.Transactions.GetTransactionCount.SendRequestAsync(sampleItem.Address);
var value = Convert.ToInt64(txCount.ToString().Substring(2), 16);
var endcode = Web3.OfflineTransactionSigner.SignTransaction(sampleItem.PrivateKey, toAddress, (BigInteger)0.00001, value, 11, 21000);
var veritfy = Web3.OfflineTransactionSigner.VerifyTransaction(endcode);
var sendRow = await web3.Eth.Transactions.SendRawTransaction.SendRequestAsync("0x" + endcode);
Twilight Punkster
Oct 11 2018 12:43
I am getting the privatekey back as bytes with DecryptKeyStoreFromJson(secret, json), how do I convert it to a string value (unity) ? Is there a helper method/example?
Dave Whiffin
Oct 11 2018 15:28
@twilightpunkster - Hi, depending on the version of Nethereum you are running there is a ToHex() extension method in Nethereum.Hex.HexConvertors.Extensions
        public void ShouldGenerateAccountAndCreateKeyStoreFileDefaultService()
            var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
            var keyStoreService = new KeyStoreService();
            var password = "testPassword";
            var json = keyStoreService.EncryptAndGenerateDefaultKeyStoreAsJson(password, ecKey.GetPrivateKeyAsBytes(), ecKey.GetPublicAddress());
            var key = keyStoreService.DecryptKeyStoreFromJson(password, json);
            Assert.Equal(ecKey.GetPrivateKey(), key.ToHex(true));
Dave Whiffin
Oct 11 2018 15:37

@LyonNee @turtlewen - take a look at the doc below (it may be slightly out of date, sorry), but it should help. You need an object to deserialize into that is decorated with parameters that map the order of the return values in to the object.

Notice the numbers below which dictate how the parameters are mapped.

        public class Document
            [Parameter("string", "name", 1)]
            public string Name {get; set;}

            [Parameter("string", "description", 2)]
            public string Description {get; set;}

            [Parameter("address", "sender", 3)]
            public string Sender {get; set;}