These are chat archives for Nethereum/Nethereum

31st
Mar 2017
Matt.Tan
@mtbitcoin
Mar 31 2017 07:02
is there an equivalent function for decoding abi string outputs in Nethereum?. i.e something like https://github.com/ethereumjs/ethereumjs-abi

specifically that allows something like

var decoded = abi.rawDecode([ "string" ], "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001868747470733a2f2f77652e746c2f49555653694c64544b410000000000000000")

you will need to use HexToBytes() extension
Matt.Tan
@mtbitcoin
Mar 31 2017 11:07
Does this handle the dynamic length string encoded hex?
Juan Blanco
@juanfranblanco
Mar 31 2017 11:07
yeah..
the index is not required
but if is bytes32 (and has not index) you need to use the latter
i think in your scenario
your string is the full data
so the string starts at the second position
and has a 32 bytes length
Juan Blanco
@juanfranblanco
Mar 31 2017 11:21
@mtbitcoin if is the whole input / output you can use this
by passing the Parameter
so it will be something like pseudocode
new FunctionCallDecoder().DecodeSimpleOutput<string>(text, new Parameter("string or bytes32.. from abi"));
Sergey Mashin
@smashin
Mar 31 2017 12:29
@juanfranblanco Juan, Hi! I found something about yesterday problem: method's signature is public string EncodeRequest(string contractByteCode, Parameter[] parameters, params object[] values) but the function expects function.Sha3Signature in first parameter (I used contract's bin:)). Now I put sha3Signature and my code works correctly
Juan Blanco
@juanfranblanco
Mar 31 2017 12:31
so it is a typo on the parameter
@smashin
ah...
are you mixing function encoding with contract encoding?
contract encoding will take the contract byte code and then add the other parameteres
function encoding will take the function sha3 signature and then add the other parameters
so...
if you are using the contractEncoding with a function signature and also pass the contract address you will be able to call a smart contract function
Sergey Mashin
@smashin
Mar 31 2017 13:00
Ok, it was not obviously for me that I had to use function sha3 instead of contractByteCode, no I feel the difference
Juan Blanco
@juanfranblanco
Mar 31 2017 13:00
yes I think you are going to low level
you can use the contract library
well web3 is the simplest
you can do something like this
all your sha3 hashing etc is done for you
and encoding
Bennett-farley
@Bennett-farley
Mar 31 2017 16:17
@juanfranblanco How would you estimate gas on the smart contract tutorial that you created?
Juan Blanco
@juanfranblanco
Mar 31 2017 16:19
await multiplyFunction.EstimateGasAsync(7);
as per the example above
note that the estimation might not be exact
ethereum/go-ethereum#1590
@Bennett-farley ^^^
Bennett-farley
@Bennett-farley
Mar 31 2017 16:22
Awesome, I will try this. Thank you!
Juan Blanco
@juanfranblanco
Mar 31 2017 16:22
a pleasure ;)
Bennett-farley
@Bennett-farley
Mar 31 2017 16:50
@juanfranblanco last newb question: Is there an easy way to convert gas to ether?
Matt.Tan
@mtbitcoin
Mar 31 2017 17:29
@juanfranblanco thanks!
Juan Blanco
@juanfranblanco
Mar 31 2017 17:35
@Bennett-farley 0.00000002 check this for info http://ethereum.stackexchange.com/questions/3937/gas-price-in-eth-unit
@mtbitcoin anytime :D
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:04
Ok, so for your multiply example, it looks like it would take 0.02 cents to run, given it costs around 21000 gas @ 50 dollars a ether
correction 0.02 dollars*
and to deploy, 50000 gas, so around 0.05 cents to deploy onto the block chain
with a simple method costing 0.02 cents, is there talk of making calls more affordable?
with a simple method costing 0.02 dollars*, is there talk of making calls more affordable?
Juan Blanco
@juanfranblanco
Mar 31 2017 20:07
yes eventually it will be more affordable
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:08
is this where the new version of ethereum comes in?
Juan Blanco
@juanfranblanco
Mar 31 2017 20:11
well it can be configured by the miners.. but I don't know what will happen with PoS
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:17
does PoS have an eta yet?
Juan Blanco
@juanfranblanco
Mar 31 2017 20:20
no
no date yet
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:20
thanks
just curious
Juan Blanco
@juanfranblanco
Mar 31 2017 20:22
yes cannot wait too
too* implided you do :)
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:23
yeah, I have a feeling it is going to make a big splash
and cause a computing shift when it does
if it can lower the cost low enough
I re-did some things in the edjcore
trying to make the calls have all state passed into them
so they are more functional
should be getting the code up on github here pretty soon
will shoot a link out here when I have it uploaded
Juan Blanco
@juanfranblanco
Mar 31 2017 20:27
edjcore?
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:28
edjcase*
edjcase.Core and edjcase.client
loved the code
Juan Blanco
@juanfranblanco
Mar 31 2017 20:28
ah...
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:29
just needed to make it so that the client is not needed to be held onto
and instead inforrmation passed in as part of the call
Juan Blanco
@juanfranblanco
Mar 31 2017 20:29
what the web3 and rpcClient
which is also the IpcClient
in another library
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:30
yeah, we are diving into all of those libs
learning all about nethereum :)
learned a lot this week
hopefully next week we will be putting out our first contract on the actual block chain
and yeah, its a dependency for those projects
Juan Blanco
@juanfranblanco
Mar 31 2017 20:32
yes i was going to remove it
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:32
I am going to be posting all the changes on github
Juan Blanco
@juanfranblanco
Mar 31 2017 20:32
whole edjcase
but decided against it after checking feedback
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:33
everyone loved it?
Juan Blanco
@juanfranblanco
Mar 31 2017 20:33
yes there was no need
really the library is just an http and some classes
to wrap the http response request
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:34
yeah, the only problem that hit an issue was the fact that the methods effectively had to have state; we are under the requirement to have code more like F#
Juan Blanco
@juanfranblanco
Mar 31 2017 20:34
but it is good enough
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:35
let me create a repository for it
and get the version we created this week uploaded
Juan Blanco
@juanfranblanco
Mar 31 2017 20:35
well
better ask first
raise an issue etc
and can be discussed
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:35
well its just our local copy
not saying for you all to go down that route
Juan Blanco
@juanfranblanco
Mar 31 2017 20:36
it might help everyone
:)
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:36
thats what makes github so magical!
:)
let me get the code up first
and then I can raise an issue
and show an alternate implementation
a picture says a thousand words (or a code example)
Juan Blanco
@juanfranblanco
Mar 31 2017 20:39
yeah true.. it will be fun to see. I know people a year and a half ago were using F#
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:39
well its not F#, its C#, just coded in a more functional manner
Juan Blanco
@juanfranblanco
Mar 31 2017 20:39
so you are just passing functions
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:40
no, just seperating state from the methods
so the methods only know what is passed into them
Juan Blanco
@juanfranblanco
Mar 31 2017 20:40
trying to have an inmutable state
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:40
more like trying to make sure the methods can more thread safe
the methods only operate on the state passed into them
if it is not passed in, it does not exist
Juan Blanco
@juanfranblanco
Mar 31 2017 20:43
so you are passing the responsability to the top layer
for the user to manage all the complexities
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:44
yes and no; there is still state at that level, just the top level state would also incldues the lower level state
no, it still pretty hidden
let me show you the geth client calll for start miner we converted...
var geth = CreateGeth();
        var result = await XGeth.Api.Miner.Start.ExecuteAsync(geth, 6);
or...using fluent...
var geth = CreateGeth();
        var result = await geth.Miner().Start().ExecuteAsync(6);

        Assert.IsTrue(result);
still playing around with the architecture options
Juan Blanco
@juanfranblanco
Mar 31 2017 20:47
so mainly you are putting an extension method
for the rpc request
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:48
geth contains the necessary underlying state for hte rpc
and then geth gets "decomposed"
when an rpc call is made to pass the rpc parameters
public class GethContext
{
public EthereumJsonRpcContext JsonRpc { get; set; }
}
public class EthereumJsonRpcContext
{
/// <summary>
/// Authentication header value for the rpc request being sent. If the server requires
/// authentication this requires a value. Otherwise it can be null
/// </summary>
public AuthenticationHeaderValue AuthHeaderValue { get; set; }
    /// <summary>
    /// Gets or sets the URL used to communicate to the ethereum system.
    /// </summary>
    public Uri BaseUri { get; set; } = new Uri("http://localhost:8545");

    /// <summary>
    /// Gets or sets the default JSON request id
    /// </summary>
    public object DefaultJsonRequestId { get; set; } = 1;



    /// <summary>
    /// Json serialization settings that will be used in serialization and deserialization
    /// for rpc requests
    /// </summary>
    public JsonSerializerSettings JsonSerializerSettings { get; set; }
}
just like your geth contains a client
we just have the requirement that for thread safety, methods cannot access properties that are declared in the same class
Juan Blanco
@juanfranblanco
Mar 31 2017 20:52
looks cool need to really see it
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:52
give me a second and I will have the link to you
I am trying ot make sure I contribute back too :)
Juan Blanco
@juanfranblanco
Mar 31 2017 20:53
it will be interesting to see how it works on a contract scenario
without making any major breaking changes
together with transaction managers
and the different scenarios for different ways to sign transactions
encoding
keeping nonces
Evobolics Digital, LLC
@evo01
Mar 31 2017 20:57
its all in the experimental stages right now
there is a quick upload
will probably do some maintaince folder changes later
Juan Blanco
@juanfranblanco
Mar 31 2017 21:00
ok i had a quick look
and its gone ;)
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:00
its there
Juan Blanco
@juanfranblanco
Mar 31 2017 21:01
but it is too late hre
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:01
just moved it sto src
Juan Blanco
@juanfranblanco
Mar 31 2017 21:01
ah ok
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:01
add a src directory
Juan Blanco
@juanfranblanco
Mar 31 2017 21:01
ill have a look tomorrow
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:01
cool
yeah its over midnight there
you must be a night owl
Juan Blanco
@juanfranblanco
Mar 31 2017 21:01
oh no.. it is 10 pm
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:01
only 6 hours
Juan Blanco
@juanfranblanco
Mar 31 2017 21:02
but wake up early around 5 ;)
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:02
not too bad, ok, so you are outside of london
I have a 9 month old that helps me with that
and anotehr due in July
Juan Blanco
@juanfranblanco
Mar 31 2017 21:02
ha ha yes kids do help
my youngest is 5
i have to go to bed with him
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:03
:) you must be a pretty good dad
well get to bed, and feel free to take al ook tomorrow
I am stuck working on nuget stuff tonight
working on a tool to convert sln files into nuget packages
Juan Blanco
@juanfranblanco
Mar 31 2017 21:04
oh.. I meant normally ... its Friday ;) he is allowed a bit longer
oh cool
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:04
lol, not a school night
yeah, we have a solution with over a 100 projects
and we want to compile it as sln/projects
Juan Blanco
@juanfranblanco
Mar 31 2017 21:05
and you want all of them as nugets
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:05
but deploy it as a series of nuget packages
with the nugets interdepending upon each other
with no project references when you run deploy
Juan Blanco
@juanfranblanco
Mar 31 2017 21:05
ah nice
like the old project.json
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:06
yeah
Juan Blanco
@juanfranblanco
Mar 31 2017 21:06
that now adds project reference
painful the move to 2017
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:06
ahhh yes
very
Juan Blanco
@juanfranblanco
Mar 31 2017 21:07
well really it has been a painful year / 2 years
until it settles down
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:07
but yeah, wanting to still develop with sln, and can publish all the nugets each day without having to make them cross dependent
I have a feeling it really won't
tehre has been so much change in so many technologies these last 3 years
Juan Blanco
@juanfranblanco
Mar 31 2017 21:08
yep im in that situaion
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:08
its unreal
and if you want to stay consulting, you have to stay on top of all the technology changes
Juan Blanco
@juanfranblanco
Mar 31 2017 21:08
but somehow i like having all following the same version as it is easily traced
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:09
yeah, for the nugets, I am up for doing something like that...
currently working on a solution wehre you have MajorVersion.Year.DayOfYear.Build
so a version number equals = 1.2017.89.1
any version scheme though can be used
but really you have major version once or twice a year, you have then builds on a certain day when it boils down to it
Juan Blanco
@juanfranblanco
Mar 31 2017 21:10
can you not use Mayor.Minor.Revision.dev-Year-DayOfYear-Build
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:11
that is another :) good diea
good idea*
still playing with it
I got a sln parser library too I need to push out on github
Juan Blanco
@juanfranblanco
Mar 31 2017 21:11
it gets very long I know.. but you have what you want continuous release
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:11
along with the project and nuget parsers
and continous release is pretty much what I am after
I do not want to have to spend time building out the nugets each day
Juan Blanco
@juanfranblanco
Mar 31 2017 21:12
yes and publishing them
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:13
I want to work in a sln on my computer and know the nugets can be published on a build server without me having to actually manage them in the solution
Juan Blanco
@juanfranblanco
Mar 31 2017 21:13
hence the -dev tag so users know is pre-release
well yourself in that scenario
--
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:13
I have been on projects before where they have 200+ projects in nuget feeds
Juan Blanco
@juanfranblanco
Mar 31 2017 21:13
totally really annoying working on libraries and live projects
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:14
and its gets hard to maintain all the sln and project files
with the nuget dependencies
so on a mission to make nuget just an seperate thought all together
and if it helps me, maybe it will halp someone else
Juan Blanco
@juanfranblanco
Mar 31 2017 21:15
yep good idea
i think it will
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:15
ok, I have to get back to work
else I will not see my wife tonight
have a good ngiht Juan :)
Juan Blanco
@juanfranblanco
Mar 31 2017 21:16
as now the tendency is to have very small projects, libraries
you too!
thanks!
Evobolics Digital, LLC
@evo01
Mar 31 2017 21:16
yep which causes so much pain
but help too
night bud
Juan Blanco
@juanfranblanco
Mar 31 2017 21:16
:+1: