These are chat archives for Nethereum/Nethereum

20th
Dec 2016
Matt.Tan
@mtbitcoin
Dec 20 2016 12:45
Trying to call the following function but i am running into an error in the last line. Any idea what i might be doing wrong? https://gist.github.com/mtbitcoin/df77426574f3f8d61cb689b75394829d
Juan Blanco
@juanfranblanco
Dec 20 2016 12:50
@mtbitcoin if you are doing a call, you will need to use CallAsync
or i might be missing something of what you are trying to do
GetData builds the Data for the transaction
Matt.Tan
@mtbitcoin
Dec 20 2016 12:53

@juanfranblanco I have also tried

Dim data= Await sfunc3.CallAsync(Of String)("0xf887964f142d4ad27dfb4a048a21fd0394ebe1d76f44fc2023393af1cc4f8c98")

but i get the following error "System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds. a"

Juan Blanco
@juanfranblanco
Dec 20 2016 13:23
ok let me create it locally
Juan Blanco
@juanfranblanco
Dec 20 2016 13:30
@mtbitcoin the bytes32 as string will use a real string, do you want to use a byte[] instead? look at this example https://github.com/Nethereum/Nethereum/blob/master/src/Nethereum.Web3.Tests/Issues/FunWithHashesWithDrCooper.cs
Juan Blanco
@juanfranblanco
Dec 20 2016 14:00
the issue is that treated as a string the hex, becomes too big
use the extension HexToByteArray()
and use that as the parameter
Matt.Tan
@mtbitcoin
Dec 20 2016 14:06
That did it, thanks @juanfranblanco

I am putting this here, in case someone else runs into the same issue

Dim hash = "0xf887964f142d4ad27dfb4a048a21fd0394ebe1d76f44fc2023393af1cc4f8c98"
Dim newResult3 = Await sfunc3.CallAsync(Of String)(hash.HexToByteArray)

Juan Blanco
@juanfranblanco
Dec 20 2016 14:14
thanks @mtbitcoin :)
Matt.Tan
@mtbitcoin
Dec 20 2016 14:49
is it possible to pass in an encoding type with web3.Sha3 ? For instance :
var hashOfHash = web3.sha3(hash, {encoding: 'hex'});
Juan Blanco
@juanfranblanco
Dec 20 2016 15:12
no
just use the sha3 directly
you mainly want to pass the bytes don't you?
Matt.Tan
@mtbitcoin
Dec 20 2016 15:30
i am actually try to recreate the ENS namehash function. specifically this portion
web3.sha3(node + web3.sha3(labels[i]).slice(2), {encoding: 'hex'});
the "encoding: hex" is the one thats throwing things off
Juan Blanco
@juanfranblanco
Dec 20 2016 15:34
is that not concatenating the strings and letting the javascript function is hex encoded?
or are those buggers
buffers*
Matt.Tan
@mtbitcoin
Dec 20 2016 15:36
i am not too sure, but i am trying to replicate the web3.sha3('xxx', {encoding: 'hex'}) in C#. Where xxx is a string
Xamarin workbooks is the best teaching tool (when is widely adopted)
Shannon Code
@genecyber
Dec 20 2016 15:41
is it based on jupyter?
we are using jupyter for testing dynamic complex scenarios
Juan Blanco
@juanfranblanco
Dec 20 2016 15:43
it may actually be, I don't know how miguel (icaza) got the inspiration from, but mainly you just create markdown and it becomes executable. Very good to teach
it is jupyter similar to Fit / Fitness?
Shannon Code
@genecyber
Dec 20 2016 15:43
oh man! wow
it is and it isn't
my wife is a huge proponent of executable specs, and worked with fit/fitness
Juan Blanco
@juanfranblanco
Dec 20 2016 15:44
well i guess is better
Shannon Code
@genecyber
Dec 20 2016 15:45
I saw jupyter being used like this and thought… finally a fitnesse that’s made for web
Juan Blanco
@juanfranblanco
Dec 20 2016 15:45
I need to try it!
Shannon Code
@genecyber
Dec 20 2016 15:46
I think it’s the same as xamarin notebook
yep
Juan Blanco
@juanfranblanco
Dec 20 2016 15:47
:+1:
i am not too sure, but i am trying to replicate the web3.sha3('xxx', {encoding: 'hex'}) in C#. Where xxx is a string
@mtbitcoin here I believe you will want to use the class Sha3Keccack
Juan Blanco
@juanfranblanco
Dec 20 2016 15:53
and call CalculateHash("0xbytes".HexToByteArray())
if you pass me an input and output ill have a look as I am interested to on ENS
Shannon Code
@genecyber
Dec 20 2016 15:54
@juanfranblanco have you done any work on going from c# to sol?
even something like an entity to a solidity struct?
Juan Blanco
@juanfranblanco
Dec 20 2016 15:56
So mainly you want to map an entity to a struct as a function input?
(kind of)
Shannon Code
@genecyber
Dec 20 2016 15:56
mostly I want to design schema in .net and have it export some struct code
but my c# code should be able to parse the struct’s elentry types into a .net object
Juan Blanco
@juanfranblanco
Dec 20 2016 15:57
ah got you, code generate from c# to sol
Shannon Code
@genecyber
Dec 20 2016 15:57
yes
Juan Blanco
@juanfranblanco
Dec 20 2016 15:57
not from c# to sol
Shannon Code
@genecyber
Dec 20 2016 15:58
well I’ll have to make that and do a PR :P
Juan Blanco
@juanfranblanco
Dec 20 2016 15:58
but you have the function outputs and inputs attributes to do the mappings
Shannon Code
@genecyber
Dec 20 2016 15:58
I guess I’m just wanting a bit more sugar
I believe I can write contracts in c# (some subset)
Juan Blanco
@juanfranblanco
Dec 20 2016 15:59
oh write directly solidity in c#
Shannon Code
@genecyber
Dec 20 2016 16:00
yes. well write c# (a DSL maybe) and have it convert to sol
@juanfranblanco check out this that I made: https://github.com/loyyal/sol2swagger
Juan Blanco
@juanfranblanco
Dec 20 2016 16:00
well, if solidity was not changing so often
and as more reusable contracts are getting created
you will end up fighting it instead of helping you
Shannon Code
@genecyber
Dec 20 2016 16:01
probably so
thoughts on my solidity to swagger?
Matt.Tan
@mtbitcoin
Dec 20 2016 16:08
@juanfranblanco i've sent you a pm
Shannon Code
@genecyber
Dec 20 2016 17:18
@juanfranblanco Any suggestions on automating the azure storage client?
I’d like to have it detect where it receives errors and start importing from there
and I’d like to query current blockheight every once in a while and have it continually import
Juan Blanco
@juanfranblanco
Dec 20 2016 17:23
webjobs, functions or fabric
@genecyber choose your best evil ^^^
Shannon Code
@genecyber
Dec 20 2016 17:25
and I assume adding the getblockheight into the block storage app?
Juan Blanco
@juanfranblanco
Dec 20 2016 17:25
@genecyber checked your swagger, really cool.
yes just addit
Shannon Code
@genecyber
Dec 20 2016 17:26
:) I dream of writing a contract in c# and going to fully functional deployed contract with a restful api
Juan Blanco
@juanfranblanco
Dec 20 2016 17:26
also it is made so you can change azure tables to sql azure
Shannon Code
@genecyber
Dec 20 2016 17:27
how do I go from azure tables to sql?
the first time I messed with either was while getting this app to work
Juan Blanco
@juanfranblanco
Dec 20 2016 17:27
the repository
is all interfaced base, so you can plug your own
hence the complex configuration
Shannon Code
@genecyber
Dec 20 2016 17:28
gotcha. I <3 interfaces. I also assumed I’d have to build my own provider behind the interface so I backloged that and decided to learn azure-table instead
Juan Blanco
@juanfranblanco
Dec 20 2016 17:28
I think it will be easier to generate from solidity / abi to rest api... (some how something needs to sign the transactions in between or at another end)
table storage is great as it is so cheap
only issue is the indexing
Shannon Code
@genecyber
Dec 20 2016 17:29
my soil2swagger already generates a mock-api so I’m close
Ha, I exported my table(blocks) to csv and went from csv to json
I’m going all mad scientist and making a contract that will map datetime to blockheight
so I can make filters based on time instead of block number
Juan Blanco
@juanfranblanco
Dec 20 2016 18:30
:+1: