These are chat archives for Nethereum/Nethereum

15th
Apr 2018
Matthew
@ThatSlyGuy
Apr 15 2018 06:06
Hey @juanfranblanco , how does decoding multiple output parameters work with Unity? The example you provide in the documentation uses the regular Nethereum.Web3, but I was wondering if there is a different way which is more compatible with Unity. I haven't been able to get your example working with Unity as of yet.
Juan Blanco
@juanfranblanco
Apr 15 2018 06:20
check the unity3d sample
Matthew
@ThatSlyGuy
Apr 15 2018 06:21
Great I'll check that out, thanks a lot!
Perfect I see what I did wrong now. Thanks for the quick help!
Matthew
@ThatSlyGuy
Apr 15 2018 06:28
Actually I just realized, what if I needed to get the data from a mapping? In the documentation example you pass in the "key1" as your bytes32 key mapping into the CallDeserializingToObjectAsync method. How would I go about this in Unity? Can I use a Dictionary<key, value> as the FunctionOutput Parameter to represent a mapping(key => value) or would that not work?
Or would the key go into the CallInput parameter and then everything else is the same?
Juan Blanco
@juanfranblanco
Apr 15 2018 06:35
if you check your abi
from a mapping you wil pass as a parameter your key
and it will return some values
in the same way as another function
if you use the code generator
in vscode your output will be generated
although a specific code generator for yielding in Unity3d is going to be created
@Greatsamps interesting.. is this corrected now?
it might have been a temporary fork
Matthew
@ThatSlyGuy
Apr 15 2018 06:42
Great, it worked just like you said. Thanks again
Juan Blanco
@juanfranblanco
Apr 15 2018 07:27
@EnigmaticUnreal_twitter at the moment it is assumed that if somebody can access your memory it will be an issue. (Well it will be an issue anyway)
bouncy castle is used for EC and other bits, the bytes are already there floating around. These could be wiped out or use something like ProtectData or SecuredString
which are not yet there fully supported in Linux
Juan Blanco
@juanfranblanco
Apr 15 2018 07:32
so in the future.. an entry point will be only secured strings and / or byte arrays
from secured string to byte array that should be wiped out using random zeros + ones
still an easy point to spot and follow
Juan Blanco
@juanfranblanco
Apr 15 2018 08:02
Greatsamps
@Greatsamps
Apr 15 2018 09:25
Hey
so its still happening
i have put wireshark on and traced what is coming back from web3
this is a cut down extract
{
"jsonrpc":"2.0",
"id":1,
"result":{
"difficulty":"0xb3d1831d83a91",
"extraData":"0x65746865726d696e652d65753134",
"gasLimit":"0x7a121d",
"gasUsed":"0x79fb7e",
"hash":"0x5073a49e45e8d07f5ab82042e730eb8a752309087ee58d7b92f2aa3617431392",
"logsBloom":"0x00024001000000000815051020000000000800100800040200000400002000080206008100800101000000a40000003000808000400000004000000cc0000000000004400000008591000008808000004000400001000080040000000004000000000020020000200011402000002c0004000000010440000080001010002000004040000040000401000000100081000000008000000082000028000000840048040800440200000002000100508002800002022200800000000000040002048000000200800043009002000a8000001000008e0009000308000011000020010200090100010000064000000022801240000010041000000004000080034000",
"miner":"0xea674fdde714fd979de3edf0f56aa9716b898ec8",
"mixHash":"0x5f079e04056a7942e9d0420c57c7f24325f05dba5cd726fb7a5f6bbc71d4a26a",
"nonce":"0x09fcb940645b2848",
"number":"0x5311df",
"parentHash":"0x2bd949ad86276cdf173a90f02b05a9880ec9bfa57a4e2fc98e622c3a020c7e87",
"receiptsRoot":"0xa74d0fc8201e6377aa042c0367630961e3c071070f678febf42e4421ffdbe8d4",
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size":"0x3666",
"stateRoot":"0xb98f887f3ba6c291d6418d8ee67c8cf20b68cc93c8db177b1e38c8250373cd35",
"timestamp":"0x5ad31088",
"totalDifficulty":"0xc5eb6d3a4499473697",
"transactions":[
{
"blockHash":"0x5073a49e45e8d07f5ab82042e730eb8a752309087ee58d7b92f2aa3617431392",
"blockNumber":"0x5311df",
"from":"0xc6b41984f90958750780ae034ab2ac6328386942",
"gas":"0x13060",
"gasPrice":"0x98bca5a00",
"hash":"0xfb8cc84ffed9f3ecc7d01a6cdf2b64a1bf2fabe3ac5f1901f8dfb2e4b4c97e93",
"input":"0xa9059cbb0000000000000000000000005ef97dba3b5db051edb3531902e087d6dc4fa503000000000000000000000000000000000000000000000001158e460913d00000",
"nonce":"0x3f",
"to":"0x228ba514309ffdf03a81a205a6d040e429d6e80c",
"transactionIndex":"0x0",
"value":"0x0",
"v":"0x25",
"r":"0x9cc4dd9be3cc1290a4375642661afc1c0174c0b60d048c017a2d0fe5f6bca323",
"s":"0x741615c66de81d7aa0292ad6b55fae8cab9da2cd507459c60e2cd40a438fb9ed"
},
{
"blockHash":"0x5073a49e45e8d07f5ab82042e730eb8a752309087ee58d7b92f2aa3617431392",
"blockNumber":"0x5311df",
"from":"0xb806c189c086f62e175617064fdd950fabc0190d",
"gas":"0x13131",
"gasPrice":"0x3b9aca00",
"hash":"0x8a98e42c0ad8183b605ed00acfb7041c5459a2e94121ded6be93227d1b8aaac2",
"input":"0x",
"nonce":"0x1",
"to":"0xa701122c1b67220a8b6883d03c8ad67896b12466",
"transactionIndex":"0x25",
"value":"0x0",
"v":"0x25",
"r":"0x2393ed595ee93d3248f1dda0ab69a1149862638fbcf1235db4bcc8ecb6c8adcb",
"s":"0x28116207b6c82b24b50a42754805ea425cdd699a8bb8186c7041683396f29e76"
}
],
"transactionsRoot":"0x28cd665dbc4b35ce9d6282585b2aa1d32e32a9751c2957dbde2419daf938f366",
"uncles":[
]
}
}
if you look at the last transaction
0x8a98e42c0ad8183b605ed00acfb7041c5459a2e94121ded6be93227d1b8aaac2
you can see that it does not belong on this block
it was actually confirmed on the next block
TarrahArshad
@TarrahArshad
Apr 15 2018 13:44
@juanfranblanco for transfer SendRequestAsync is better or andwait ?
Juan Blanco
@juanfranblanco
Apr 15 2018 20:30
I have checked with the infura guys, (just in case there something on their end). This is mainly the usual temporary fork, chain reorg
@Greatsamps
@TarrahArshad depends
on the speed of the chain
and how are your handling it
ie slow chain with an inner thread you can sendAndWaitForReceipt and use a cancellationToken
or an expiration time
Matthew
@ThatSlyGuy
Apr 15 2018 22:48
Hey @juanfranblanco, I'm pretty sure I'm using the EthEstimateGasUnityRequest correctly but apparently not. https://i.imgur.com/IFudEd2.png
It's just a regular erc20 mint function I'm trying to estimate the gas for. The EthereumNetwork.CURRENT_NETWORK just points to infura rinkeby and it works fine for any other UnityRequests. The mint function just accepts two parameters, an address, and uint256 amount.
Matthew
@ThatSlyGuy
Apr 15 2018 22:54
Weirdly enough I can use this same method to read the estimated gas for any "view" functions, even though they actually cost no gas to execute.
Matthew
@ThatSlyGuy
Apr 15 2018 23:05
Nevermind I figured it out. mintFunction.CreateTransactionInput instead of mintFunction.CreateCallInput got the estimated gas no problem.