These are chat archives for Nethereum/Nethereum

9th
Jan 2018
Michael John Peña
@mjtpena
Jan 09 2018 02:44
Folks. Anyone here have tried Nethereum with ASP.NET Web API? What are your thoughts so far...
Chris Mack
@chrimack_twitter
Jan 09 2018 02:45
doing that right now with .net core web api - what is your question? why do you think it would be different than anywhere else?
Michael John Peña
@mjtpena
Jan 09 2018 02:47

Currently we have a nodejs app that interfaces with web3. But it's a company policy of the client not to use node. Hence the idea of Nethereum on Web API.

Just on a high level thoughts before we dig deep. Just want to know general thoughts about Nethereum.

Chris Mack
@chrimack_twitter
Jan 09 2018 02:49
so your question is really how is Nethereum? Honestly, i like C# a whole lot better than node, so I think it's better.
Michael John Peña
@mjtpena
Jan 09 2018 02:49
any caveats so far? Anything trivial you are experiencing?
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 07:38
Hi! I'm getting "transaction replacement underpriced" error. How can I increase the nonce, calling a contract function like that? var receipt = function.SendTransactionAndWaitForReceiptAsync(ethereumPublicKey, gas, value, null, new object[] { address, amount });
AlexandrSurkov
@AlexandrSurkov
Jan 09 2018 08:45
Hi. Can anyone give me example of using of web3.Eth.Filters?
Edson Alcalá
@EdsonAlcala
Jan 09 2018 10:08
@mjtpena I think Nethereum is a strong library, I wouldn't doubt about using it, additionally, the support is very good, Juan is always here helping everybody and you have all the benefits that .NET and C# offer to you.
just give it a try, do a proof of concept :smile:
Stefan Naegeli
@snaegeli
Jan 09 2018 10:27
Hi, I am struggling a bit with events and filters:
1) I create a filter for my event
2) I execute a transaction that triggers this event
3) I call event.GetAllChanges<MyFilter>(filter) and event.GetFilterChanges<MyFilter>(filter)
It looks like I only get events that were fired since I created the filter. Is there an option to get all (historic) events on a contract (since the contract was created)?
Also it appears that GetAllChanges() sometimes returns the events that were fired after the filter was created and sometimes not. Where GetFilterChanges seems to get the events correctly (since the filter was created).
I think it's this issue here: Nethereum/Nethereum#175
Art1987
@Art1987
Jan 09 2018 10:58

Hi @juanfranblanco
I have deployed following smart contract which is multisig
https://medium.com/@ChrisLundkvist/exploring-simpler-ethereum-multisig-contracts-b71020c19037

I have called execute method pass following parameters - destination - 0xe78910AA37f079B2AE23AFff0DE34162Ab1d5110, value -var amountByWei = UnitConversion.Convert.ToWei(0.01m);
for sigv, sigr and sigs - based on netherum example.
but when I checked ropsten there were no any transaction and balance was not changed, could you please help me out? If you think issue is related to mutlisig contract could you please point me out some mutlisig working example?
Thanks

Juan Blanco
@juanfranblanco
Jan 09 2018 12:05
@snaegeli to get historical you need to use GetAllChanges or GetLogs
I prefer (but that is me) to use GetLogs using a custom FilterInput and set the block range
you do need to set the block range if not you won't get all the results. I normally have worked in ranges of 1000 / 10000 tracking the block numbers
@lbertenasco nice!
@Art1987 part of the future "wallet" work is to include multi signature, but not for tomorrow
you can use gnosis multi signature
Juan Blanco
@juanfranblanco
Jan 09 2018 12:18
regarding the multisignature contract of Christian, you need sign using each address and add them to the contract
transaction
function execute(uint8[] sigV, bytes32[] sigR, bytes32[] sigS, address destination, uint value, bytes data) {
ASoldo
@ASoldo
Jan 09 2018 12:27
How can i mine with Unity? where can i find snippets of code that does that?
Juan Blanco
@juanfranblanco
Jan 09 2018 12:27
You cannot mine with unity
i think there is an unity plugin to mine in unity
but that is not part of Nethereum
check in the Unity store
ASoldo
@ASoldo
Jan 09 2018 12:28
got it got it, nethereum is just for connecting with blockchain
Juan Blanco
@juanfranblanco
Jan 09 2018 12:28
oh we working to have all the features
components of the blockchain
but there is no plan to implement ever PoW consensus
Casper is coming anyway :D
although for Nethereum my plan is to focus only on scaling (state channels / plasma) anyway
ASoldo
@ASoldo
Jan 09 2018 12:31
tnx for the explanation :smile:
Juan Blanco
@juanfranblanco
Jan 09 2018 12:32
super Karls work
Art1987
@Art1987
Jan 09 2018 13:04
@juanfranblanco thanks for the answer, I have signed all addresses based on netherum example but no luck, I have tried gnosis as well but same result, do you have any working example?
Juan Blanco
@juanfranblanco
Jan 09 2018 13:06
no i don't have any
for Christian you could initialise with one address
from there you sing the message to be relayed
Art1987
@Art1987
Jan 09 2018 13:09
see my code sample
                var msg = "wee test message 18/09/2017 02:55PM";
                var privateKey = "privatekey";
                var signer = new EthereumMessageSigner();
                var signature = signer.EncodeUTF8AndSign(msg, new EthECKey(privateKey));
                string[] sigR = new string[3];
                string[] sigS = new string[3];
                uint[] sigV = new uint[3];
                var r = signature.Substring(0, 32);
                var s = signature.Substring(32, 32);

                var v1 = signature.Substring(130, 2);
                var v = uint.Parse(v1, System.Globalization.NumberStyles.HexNumber);
                sigR[0] = r;
                sigS[0] = s;
                sigV[0] = v;

                msg = "wee test message 18/09/2017 02:55PM";
                privateKey = "privatekey";
                signer = new EthereumMessageSigner();
                signature = signer.EncodeUTF8AndSign(msg, new EthECKey(privateKey));
                r = signature.Substring(0, 32);
                s = signature.Substring(32, 32);
                v1 = signature.Substring(130, 2);
                v = uint.Parse(v1, System.Globalization.NumberStyles.HexNumber);
                sigR[1] = r;
                sigS[1] = s;
                sigV[1] = v;
                msg = "wee test message 18/09/2017 02:55PM";
                privateKey = "privatekey";
                signer = new EthereumMessageSigner();
                signature = signer.EncodeUTF8AndSign(msg, new EthECKey(privateKey));
                r = signature.Substring(0, 32);
                s = signature.Substring(32, 32);
                v1 = signature.Substring(130, 2);
                v = uint.Parse(v1, System.Globalization.NumberStyles.HexNumber);
                sigR[2] = r;
                sigS[2] = s;
                sigV[2] = v;



                var amountByWei = UnitConversion.Convert.ToWei(0.01m);
                var contract = _web3.Eth.GetContract(abi, contractAddress);
                var multiplyFunction = contract.GetFunction(methodName);
                var destination = "0xe78910AA37f079B2AE23AFff0DE34162Ab1d5110";
                var result = await multiplyFunction.CallAsync<TReturn>(sigV, sigR, sigS, destination, amountByWei);

                return result;
Juan Blanco
@juanfranblanco
Jan 09 2018 13:10
But the message is not a string
it is the message to send
Art1987
@Art1987
Jan 09 2018 13:11
what you mean it is not string? what should it be?
Juan Blanco
@juanfranblanco
Jan 09 2018 13:12
check the contract
bytes32 txHash = sha3(byte(0x19), byte(0), this, destination, value, data, nonce);
you do need to understand the contract very well
it is a guidance
well nearly out of the box
Art1987
@Art1987
Jan 09 2018 13:14
to say the truth I am not good at it :D
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:14
Does anybody know how to increase a nonce when calling contract function?
Juan Blanco
@juanfranblanco
Jan 09 2018 13:14
well that is not the one for you
@etot_tovarisch_twitter it happens automatically for you
Art1987
@Art1987
Jan 09 2018 13:15
so could you please let me know what should actually I pass?
Juan Blanco
@juanfranblanco
Jan 09 2018 13:15
if you are sending more than one, use the same instance of Web3
@Art1987 that will need a big explanation
when we do the wallet we may implement this as a simple multisignature
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:16
@juanfranblanco but I'm getting "transaction replacement underpriced" error.. How can I deal with that?
Juan Blanco
@juanfranblanco
Jan 09 2018 13:17
but you mainly need to hash as per the code, the byte, other byte, the contract address, the destination address, the value you are sending, the data and the nonce
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:17
Changing gas limit doesn't help..
Juan Blanco
@juanfranblanco
Jan 09 2018 13:17
so you have a pending transaction still?
not mined?
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:18
infura responses with this error, so transaction doesn't get to the blockchain
Juan Blanco
@juanfranblanco
Jan 09 2018 13:18
yes because you do have a pending transaction
but that should be discovered and increase the nonce
Art1987
@Art1987
Jan 09 2018 13:19
what do you mean - hash as per code?
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:19
etherscan doesn't show any transactions on the address
Juan Blanco
@juanfranblanco
Jan 09 2018 13:19
@Art1987 as per the solidity code
I know it will take a while but take your time to understand it
as you may lose money if you don't
@etot_tovarisch_twitter is that on mainnet or testnet
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:21
mainnet
Juan Blanco
@juanfranblanco
Jan 09 2018 13:22
is this a contract transaction or a "normal" transaction
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:22
Contract function call
Juan Blanco
@juanfranblanco
Jan 09 2018 13:22
if it is a function transaction, what you can do is the following
functionXX.BuildTransactionInput()
top of my head.. but you should be able to find it
web3.TransactionManager.SendTransaction(transactionInput)
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:23
CreateTransactionInput
Juan Blanco
@juanfranblanco
Jan 09 2018 13:23
in the transactionInput before hand set the nonce
ah I told you top of my head :)
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:24
no problem! Thank you a lot, I'll try this!
Art1987
@Art1987
Jan 09 2018 13:30
@juanfranblanco thank you very match, so as far as I understood I need to understand solidity very wall
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:38
Is there the way to ensure that transaction is mined? Can't find something like "SendTransactionAndWaitForReceiptAsync" in the TransactionManager
Juan Blanco
@juanfranblanco
Jan 09 2018 13:43
the transactionManager has the TransactionReceiptService
which has SendRequestAsync
that waits for the Receipt
those might need to be renamed
этот товарищ
@etot_tovarisch_twitter
Jan 09 2018 13:47
oh! Great! I've found it.
hak
@hakart_twitter
Jan 09 2018 13:48
@juanfranblanco BTW: when you are going implement simple wallet multi signature do you have any roadmap, seems it is very interesting topic for me as well
Juan Blanco
@juanfranblanco
Jan 09 2018 13:51
I will be made one available soonish, but on the UI persepective
that is a must
overall on the UI we have
the hardening of all samples, ie a generic reactive MVVM library including signing transactions, loading keys, multi signature, hosting web dapps (dapp hybrid), loading of NetDapps (Dekstop) and generic interface to create NetDapps
that will connect to local and backend services (think Nethereum BlockchainStorage etc)
hak
@hakart_twitter
Jan 09 2018 13:54
can you please share some link of sources is that open source ?
Juan Blanco
@juanfranblanco
Jan 09 2018 13:55
it will be
most of that stuff is already there
a part of the glue of everything ;) which are the hardening steps (logging, top controllers, signing manager, etc, etc)
and of course multisignature, hardware signatures, etc
hak
@hakart_twitter
Jan 09 2018 13:57
looking forward to see the sources. and Big Thanks for your hardwork
Stefan Naegeli
@snaegeli
Jan 09 2018 18:21
@juanfranblanco Thanks for your help! I got it working for GetAllChanges(). When you say GetLogs()... is this the event.GetLogsForEvent() method? This one takes a JArray as parameter. Is there anywhere an example on how to use it?
I've read that the filters will not work for public nodes - hence I need a different solution to get all historic events on a contract
yltlatl
@yltlatl
Jan 09 2018 19:52
@juanfranblanco thanks - that worked!
DDeathlonger
@DDeathlonger
Jan 09 2018 22:43
I'm so glad to see that Ethereum has a .NET implementation! I'm new to it and still looking around online (Ethereum as a whole I mean) I've been watching the web implementations through a course on Udemy so far, almost done and it seems pretty straight forward.. How long has Nethereum been out? Any recommended very highly rated teachers or tutorials online for using Nethereum?
DDeathlonger
@DDeathlonger
Jan 09 2018 23:46
nvm, I found the tutorials from @juanfranblanco on YouTube. :) thanks mango! How long has Nethereum been released though?