These are chat archives for Nethereum/Nethereum

23rd
Aug 2017
David Burela
@DavidBurela
Aug 23 2017 04:35

.net standard = program your code against this API, and it will run on many different implementations of .Net. e.g. .Net Framework 4.6+, Xamarin.Android, .Net Core, etc.

.Net Core = a new implementation of .Net. Which has been built to run on many platforms (Mac, Windows, Linux).

Alexander Yarushin
@aayarushin
Aug 23 2017 05:00
I now have the only test and that is the only one I have. It attempts to unlock en external account with web3.Personal.UnlockAccount.SendRequestAsync call
...the project is built for .NET 4.5
Alexander Yarushin
@aayarushin
Aug 23 2017 05:07
Do I have to use .NET standard to be able to employ Nethereum.Web3 and other supplimentary NEthereum packages?
Juan Blanco
@juanfranblanco
Aug 23 2017 06:13
@aayarushin you need to change the hexbiginteger to an integer, the newer version of geth uses an integer instead
Alexander Yarushin
@aayarushin
Aug 23 2017 06:14
@juanfranblanco Good morning! Thank you! Will try that in a second :D
Juan Blanco
@juanfranblanco
Aug 23 2017 06:15
There are three / four types of releases
The individual packages, target netstandard 1.1 and net451. These should work with any platform (now)
Alexander Yarushin
@aayarushin
Aug 23 2017 06:17
packages of Nethereum?
Juan Blanco
@juanfranblanco
Aug 23 2017 06:17
If you have problems, or use an older version of visual studio. The Nethereum.Portable
Yeah
Includes everything. (A part from IPC)
Alexander Yarushin
@aayarushin
Aug 23 2017 06:18
Just installed portable
should I install IPC separately now?
image.png
Juan Blanco
@juanfranblanco
Aug 23 2017 06:19
Oh for IPC you need the other packages, but just use RPC
It is the "same", just a different transport
Alexander Yarushin
@aayarushin
Aug 23 2017 06:20
Excellent.so I should be good with these on the screenshot?
Juan Blanco
@juanfranblanco
Aug 23 2017 06:20
Yes.
Alexander Yarushin
@aayarushin
Aug 23 2017 06:21
sorry for spamming with questions...
Juan Blanco
@juanfranblanco
Aug 23 2017 06:21
No bother everyone starts somewhere
Alexander Yarushin
@aayarushin
Aug 23 2017 06:22
:) thanks for cheering Juan, Very nice of you.
Juan Blanco
@juanfranblanco
Aug 23 2017 06:23
Just to finish the explanation, there is also a separate release for unity 3d. This targets net351, and is slightly different to support the libraries and threading of unity3d
Alexander Yarushin
@aayarushin
Aug 23 2017 06:28
will not be using unity 3d...
Juan Blanco
@juanfranblanco
Aug 23 2017 06:28
@thisdhe_twitter I had a "look" at your smart contract, I don't see anything weird (need to run etc) Only suggestion is to simplify it a bit, until you spot the error, or use remix and debug through it.
@aayarushin I guessed so, just wanted to give you a complete explanation
Alexander Yarushin
@aayarushin
Aug 23 2017 06:30
I appreciate that :)
Juan Blanco
@juanfranblanco
Aug 23 2017 06:30
:)
Alexander Yarushin
@aayarushin
Aug 23 2017 06:37
@juanfranblanco Now I just need to install resharper to find out how to start miner. The code in Portable is different than in Web3...
/code web3.Miner.Start.SendRequestAsync(6);
Juan Blanco
@juanfranblanco
Aug 23 2017 06:38
Oh
If using anything 2.0.0 miner is in Nethereum.GethWeb3
Sorry Nethereum.Geth.Web3Geth
Alexander Yarushin
@aayarushin
Aug 23 2017 06:41
cool
Juan Blanco
@juanfranblanco
Aug 23 2017 06:41
This has been moved because these methods are specific to Geth
Alexander Yarushin
@aayarushin
Aug 23 2017 06:41
logical!
cheez how I got used to resharper!
:D
Juan Blanco
@juanfranblanco
Aug 23 2017 06:44
This and accounts are the most "visible changes" to 1.0 (to simplify usage)
Ha ha yeah resharper is awesome
Alexander Yarushin
@aayarushin
Aug 23 2017 06:45
:) Very nice to have this improvements...
Juan Blanco
@juanfranblanco
Aug 23 2017 06:47
Tried to keep the changes minimal, to avoid unnecessary breaking the api. But lots of namespaces changes, libraries. So resharper is king in finding those
Alexander Yarushin
@aayarushin
Aug 23 2017 06:49
Message: Test method FirstProject.Tests.DeploymentTest.ShoudBeAbleToDeployAContract threw exception:
Nethereum.JsonRpc.Client.RpcResponseException: invalid argument 0: hex string has length 424, want 40 for common.Address
from this call var txHash = await web3.Eth.DeployContract.SendRequestAsync(_abiTest, _bytecodeTest);
Juan Blanco
@juanfranblanco
Aug 23 2017 06:52
Have you put your sender address?
Alexander Yarushin
@aayarushin
Aug 23 2017 06:53
account has been unlocked
so I assume that account is in the context already?
        var web3 = new Web3Geth();

        var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, password, 120);
        Assert.IsTrue(unlockAccountResult);

        var txHash = await web3.Eth.DeployContract.SendRequestAsync(_abiTest, _bytecodeTest);
string senderAddress = "0x12890d2cce102216644c59daE5baed380d84830c";
I just use everything from tutorial so that I have a safe base to start playing with on myown later :)
Juan Blanco
@juanfranblanco
Aug 23 2017 06:54
Oh when you deploy the contract
No is not
Alexander Yarushin
@aayarushin
Aug 23 2017 06:55
yep
Juan Blanco
@juanfranblanco
Aug 23 2017 06:55
(account in context)
The reason for this, is that you may have unlocked your account in geth directly
Alexander Yarushin
@aayarushin
Aug 23 2017 06:56
should I use signature with bytecode and from instead?
Juan Blanco
@juanfranblanco
Aug 23 2017 06:56
Yes
Alexander Yarushin
@aayarushin
Aug 23 2017 06:56
cool
Juan Blanco
@juanfranblanco
Aug 23 2017 06:57
The abi is only needed when having a constructor parameter
Alexander Yarushin
@aayarushin
Aug 23 2017 06:58
Message: Test method FirstProject.Tests.DeploymentTest.ShoudBeAbleToDeployAContract threw exception:
Nethereum.JsonRpc.Client.RpcResponseException: intrinsic gas too low
Juan Blanco
@juanfranblanco
Aug 23 2017 06:58
So the parameters can be encoded correctly
Alexander Yarushin
@aayarushin
Aug 23 2017 06:58
How much gas should I need for deployment?
Juan Blanco
@juanfranblanco
Aug 23 2017 06:58
This will be storage on the first instance.
But for now instead of calculating the gas, which it is a bit of an art
Alexander Yarushin
@aayarushin
Aug 23 2017 07:00
Should I use estimation from remix then?
Juan Blanco
@juanfranblanco
Aug 23 2017 07:00
Just put a high figure, the reminder will be returned to you
Yes that is actually rather good
Alexander Yarushin
@aayarushin
Aug 23 2017 07:00
var mineResult = await web3.Miner.Start.SendRequestAsync(6);
returned FALSE
Juan Blanco
@juanfranblanco
Aug 23 2017 07:01
Yes that is geth again changing
Alexander Yarushin
@aayarushin
Aug 23 2017 07:01
what is 6 by the way? :)
I am on Geth 1.6.7
Juan Blanco
@juanfranblanco
Aug 23 2017 07:02
That is the number of threads
To speed up mining
Based on the number of CPUs you have
Alexander Yarushin
@aayarushin
Aug 23 2017 07:03
physical CPUs?
Juan Blanco
@juanfranblanco
Aug 23 2017 07:04
Yes
Once you start mining, it should be very fast due to small difficulty.
Also you can use clique ( which uses a different consensus, proof of authority)
Alexander Yarushin
@aayarushin
Aug 23 2017 07:06
How do I know what to do with var mineResult = await web3.Miner.Start.SendRequestAsync(6); returning fasle?
Juan Blanco
@juanfranblanco
Aug 23 2017 07:07
Just ignore it
Alexander Yarushin
@aayarushin
Aug 23 2017 07:07
Oh, ok
Juan Blanco
@juanfranblanco
Aug 23 2017 07:08
If you want to check if it is mining
Alexander Yarushin
@aayarushin
Aug 23 2017 07:08
I would love to :)
Juan Blanco
@juanfranblanco
Aug 23 2017 07:08
There is a isMinining request
That is. Web3.Eth.Mining.SendRequestAsync
Alexander Yarushin
@aayarushin
Aug 23 2017 07:18
the multiplication is working :)
WHOA!
:D
Thank you so much for holding me by the hand @juanfranblanco
       var mineResult = await web3.Eth.Mining.IsMining.SendRequestAsync(4); 
Juan Blanco
@juanfranblanco
Aug 23 2017 07:25
Actually it is great to see your perspective, all the small changes in geth can be rather confusing, and the material "Nethereum docs" ( now that the changes are settled) will reflect that. :)
Alexander Yarushin
@aayarushin
Aug 23 2017 07:26
It is just me without resharper realy... :(
But as one additional positive outcome I have now VS 2017 installed :D
Juan Blanco
@juanfranblanco
Aug 23 2017 07:28
Ha ha yes still you should not need resharper :)
Alexander Yarushin
@aayarushin
Aug 23 2017 07:28
I work on a code base 1.5 LoC and there I just cannot live with R#
Juan Blanco
@juanfranblanco
Aug 23 2017 07:28
Actually vs2017 has lots of new resharper (like ) features
Alexander Yarushin
@aayarushin
Aug 23 2017 07:28
for Re-factoring?
Juan Blanco
@juanfranblanco
Aug 23 2017 07:29
Yes, and hinting on implementations, errors
Alexander Yarushin
@aayarushin
Aug 23 2017 07:29
ok. that I will not bugg you with :)
Juan Blanco
@juanfranblanco
Aug 23 2017 07:30
It has now move class to file, after so many years
(so happy)
Alexander Yarushin
@aayarushin
Aug 23 2017 07:30
question: in your Bat-file you start geth with --mine option... Why Do I need to start / stop mining in the app?
Juan Blanco
@juanfranblanco
Aug 23 2017 07:31
No I have included it now
With the mine option
So no need
Check the clique in the other folder
You need to unlock your account first
But it does not do PoW so it is more CPU friendly
Alexander Yarushin
@aayarushin
Aug 23 2017 07:38
with cluque I do not get tx reciept
...it is mining according to var mineResult = await web3.Eth.Mining.IsMining.SendRequestAsync(4);
Juan Blanco
@juanfranblanco
Aug 23 2017 07:40
Have you unlocked the main account?
Alexander Yarushin
@aayarushin
Aug 23 2017 07:41
main? I did same code : var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, password, 120);
Ha-ha saw I wrote 1.5 LoC earlier :D :D:D Supposed to write 1.5M LoC :D
Juan Blanco
@juanfranblanco
Aug 23 2017 07:44
Yes resharper will be an overkill for that
:)
Alexander Yarushin
@aayarushin
Aug 23 2017 07:44
Ha-ha
Mainly only step needed is the start mining and unlock account. In this scenario your account (test one) is set to be the signer. But don't worry if PoW works for you
Alexander Yarushin
@aayarushin
Aug 23 2017 07:48
PoA isn't it what NEO block chain does?
Juan Blanco
@juanfranblanco
Aug 23 2017 07:53
It uses dBFT (just checked again :) )
Alexander Yarushin
@aayarushin
Aug 23 2017 07:54
but in essence miners are certificate authorities?
they will prioritize tx with validatable digital identity
1 April joke with PoA
reason wy I chose away NEO is because it is effectively a federate chain....
federatED
Juan Blanco
@juanfranblanco
Aug 23 2017 08:06
Ah cool :)
Alexander Yarushin
@aayarushin
Aug 23 2017 08:07
what is this clique that you mentioned is about then?
Juan Blanco
@juanfranblanco
Aug 23 2017 08:09
That is PoA it is not part of the public chain, but it can be used in a private setting
Alexander Yarushin
@aayarushin
Aug 23 2017 08:10
I didn't see any publical anouncement about PoA moving to main net so that I HOPE is a joke_
?
Juan Blanco
@juanfranblanco
Aug 23 2017 08:10
No is not, is is PoS in main net
Alexander Yarushin
@aayarushin
Aug 23 2017 08:11
REf: clique. I now wonder what you mean by unlocking main account. I did that.
Juan Blanco
@juanfranblanco
Aug 23 2017 08:12
The account is the signer
Hence it needs to be unlocked
Alexander Yarushin
@aayarushin
Aug 23 2017 08:12
it has been...
...but it still didn't mine
Juan Blanco
@juanfranblanco
Aug 23 2017 08:13
Have you started mining?
Is it not producing blocks?
Alexander Yarushin
@aayarushin
Aug 23 2017 08:13
one sec
Juan Blanco
@juanfranblanco
Aug 23 2017 08:15
I'll have a look and see if I can change the batch file
Well got to go :)
Alexander Yarushin
@aayarushin
Aug 23 2017 08:17
thank you!
alexpee
@alexpee
Aug 23 2017 10:06
Hi is there anyway to get previous transaction event log? I understand and successfully retrieved the detail use the event filter, but how about old transactions? Let say I want to retrieve certain transactions details in a old block?
Juan Blanco
@juanfranblanco
Aug 23 2017 10:09
You can put the block range when creating the filter
alexpee
@alexpee
Aug 23 2017 10:10
thanks Juan
alexpee
@alexpee
Aug 23 2017 10:28
Hi Juan sorry, another question if the filter param is set to empty, it will always using the latest block ?
Arman
@SahakyanGit
Aug 23 2017 12:13
hey guys, can you please help me to figure out the issue on my end. I'm trying to deploy contract on blockchain and getting following error.
nethereum.PNG
kai
@kaista82_twitter
Aug 23 2017 12:15
you're passing in a public key instead of an address? or is that a typo
Arman
@SahakyanGit
Aug 23 2017 12:15
Actually I want to see my deployed contract on this page https://testnet.etherscan.io/
kai
@kaista82_twitter
Aug 23 2017 12:15
you need to give that function the public address
not public key
i think
Alexander Yarushin
@aayarushin
Aug 23 2017 12:16
it is address, just variable name is misleading
kai
@kaista82_twitter
Aug 23 2017 12:16
and there needs to be a keystore file in the keystore directory
is there a matching keystore json file in the keystore folder for that geth?
%appdata%\roaming\ethereum i think it resides
Alexander Yarushin
@aayarushin
Aug 23 2017 12:17
and address is a public key :)
...or part of it
kai
@kaista82_twitter
Aug 23 2017 12:17
do you have a keystore file for this?
that geth can get to?
not the same thing
if you hash the public key
they are not the same then
Alexander Yarushin
@aayarushin
Aug 23 2017 12:19
like I wrote "part of it" :)
Arman
@SahakyanGit
Aug 23 2017 12:19
ok let me check and get back to you. Thanks for quick responce
kai
@kaista82_twitter
Aug 23 2017 12:19
ok, well for our purposes the public key wont work and the variable name is very misleading....
but yes
keystore file you may need to created one in geth or some other way
Arman
@SahakyanGit
Aug 23 2017 12:29
there isn't a keystore json file.
kai
@kaista82_twitter
Aug 23 2017 12:29
ok thats why then, it will need that
Arman
@SahakyanGit
Aug 23 2017 12:30
how can i get it?
kai
@kaista82_twitter
Aug 23 2017 12:30
geth account new
is a command in geth or you can use KeyStoreService in neth
Alexander Yarushin
@aayarushin
Aug 23 2017 12:30
since you are using account from the example you kan just copy/paste
kai
@kaista82_twitter
Aug 23 2017 12:31
^ well spotted i didnt realise
and P.S. never do this with your private keys :D:D:D:D
kai
@kaista82_twitter
Aug 23 2017 12:32
well depends on if you like to live on the edge
:D
Alexander Yarushin
@aayarushin
Aug 23 2017 12:32
ha-ha :)
kai
@kaista82_twitter
Aug 23 2017 12:32
:D
Arman
@SahakyanGit
Aug 23 2017 12:32
ha ha
kai
@kaista82_twitter
Aug 23 2017 12:33
ok so copy keystore into keystore folder that geth uses
then try the code again
it should then match the file and decrypt your private key and work
Arman
@SahakyanGit
Aug 23 2017 12:42
Thank you very much guys.The issue has gone.I was overrated it and it worked.The next question is
how can i see the transaction hex on this web https://testnet.etherscan.io/ page to insure that contract has been deployed.
kai
@kaista82_twitter
Aug 23 2017 12:43
oh good
transaction hex?
just do
eth.getCode("0xADDRESS");
in geth
it will output binary
but maybe you can put in the address returned by your deploy transaction to search
Alexander Yarushin
@aayarushin
Aug 23 2017 12:45
I wish I could run etherscan.io locally ...
kai
@kaista82_twitter
Aug 23 2017 12:45
is it not opensource?
Alexander Yarushin
@aayarushin
Aug 23 2017 12:46
is there a good solution for private chain?
kai
@kaista82_twitter
Aug 23 2017 12:46
Juan made a library to search chain i think that hosts in azure
so you can query it via sql
Alexander Yarushin
@aayarushin
Aug 23 2017 12:56
Sorry seating with merge from a techbranch to master that I merg to my tech branch %)
etherscan.io does not seem to have any public repository, only API
kai
@kaista82_twitter
Aug 23 2017 12:57
:( There may be an opensource alternative I've just never looked.
Alexander Yarushin
@aayarushin
Aug 23 2017 12:58
should had asked... this is an off top sorry :)
kai
@kaista82_twitter
Aug 23 2017 12:58
I don't think they are strict on topic ;) and its still related
Arman
@SahakyanGit
Aug 23 2017 13:17
i tried > eth.getCode("0x12890d2cce102216644c59daE5baed380d84830c");
"0x"
can i deploy contract on testnet.etherscan.io locally?
Alexander Yarushin
@aayarushin
Aug 23 2017 13:22
0x12890d2cce102216644c59daE5baed380d84830c is account number.... it is not a contract
Arman
@SahakyanGit
Aug 23 2017 13:23
i need to pass transaction hash right?
Alexander Yarushin
@aayarushin
Aug 23 2017 13:23
yep
Arman
@SahakyanGit
Aug 23 2017 13:29
eth.getCode("0xa9528e8305727cf11efd08cae3ca3cf89785a04060d134192329f586354b9957");
Error: invalid address
at web3.js:3879:15
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at <anonymous>:1:1
i get this error message
' string _getAddress = "./geth.ipc";
        var ipcClient = new Nethereum.JsonRpc.IpcClient.IpcClient(_getAddress);
        //var ipcClient = new Nethereum.JsonRpc.IpcClient.IpcClient(_getAddress);
        var privateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
        var senderAddress = "0x12890d2cce102216644c59daE5baed380d84830c";
        var otherAddress = "0x13f022d72158410433cbd66f5dd8bf6d2d129924";
        var multiplier = 7;
        var passoword = "password";

        var abi = @"[{""constant"":false,""inputs"":[{""name"":""vol"",""type"":""int256""}],""name"":""multiply"",""outputs"":[{""name"":""d"",""type"":""int256""}],""type"":""function""},{""inputs"":[{""name"":""multiplier"",""type"":""int256""}],""type"":""constructor""}]";
        var byteCode = "606060405260405160208060ae833981016040528080519060200190919050505b806000600050819055505b5060768060386000396000f360606040526000357c0100000000000000000000000000000000000000000000000000000000900480631df4f144146037576035565b005b604b60048080359060200190919050506061565b6040518082815260200191505060405180910390f35b6000600060005054820290506071565b91905056";
        var web3 = new Web3(ipcClient);
        var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, passoword, 120);

        var transactionHash = await web3.Eth.DeployContract.SendRequestAsync(abi, byteCode, senderAddress, new HexBigInteger(900000), 7);

        var mineResult = await web3.Miner.Start.SendRequestAsync(6);

        var receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);

        while (receipt == null)
        {
            Thread.Sleep(5000);
            receipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);
        }

        var contractAdress = receipt.ContractAddress;
        var contract = web3.Eth.GetContract(abi, contractAdress);
        var multiplyFunction = contract.GetFunction("multiply");
        var result = await multiplyFunction.CallAsync<int>(7);'
Alexander Yarushin
@aayarushin
Aug 23 2017 13:31
Sorry, not trx hash, but contract address
you are passing your account addressinstead
receipt.ContractAddress;
...in your code
Arman
@SahakyanGit
Aug 23 2017 13:38
Thank you very much,i got it.i wonder can i see it on UI for example https://ropsten.etherscan.io/ by searching contractAddress or transaction.
Alexander Yarushin
@aayarushin
Aug 23 2017 13:38
no, but what you are looking for is a blockchain scraper that will parse your local blockchain
I need one too ;)
Arman
@SahakyanGit
Aug 23 2017 13:40
Can you share some information or links about it?
effectively either create your own or find an open-source one and run locally
if some hosted solutions use dns so can you probably adjust your hosts file or something I wonder?
Arman
@SahakyanGit
Aug 23 2017 13:47
Thanks :blush:
Arman
@SahakyanGit
Aug 23 2017 17:22
does Nethereum support Net Core 2.0 ?
Juan Blanco
@juanfranblanco
Aug 23 2017 17:36
Yes, it is netstandard 1.1
Arman
@SahakyanGit
Aug 23 2017 17:41
ok, Thank you