These are chat archives for Nethereum/Nethereum

5th
Oct 2017
hak
@hakart_twitter
Oct 05 2017 07:59
@juanfranblanco one more question how we can Moq Web3.GetContract or contract.GetFunction in unit test without any real call to localhost:8545 ? do we have any way to do that? (BTW I have researched the Nehereum sources related tests)
Juan Blanco
@juanfranblanco
Oct 05 2017 09:32
you could create your IClient
@hakart_twitter
most of the tests are integration tests so there is no mocking
hak
@hakart_twitter
Oct 05 2017 09:34
ok I see, I have an idea just need do create wrapper with interface and moq the wrapper. I just want to make sure thanks!
Juan Blanco
@juanfranblanco
Oct 05 2017 09:35
probably IClient is very low level (just realised) as you will need to mock up the return
of the rpc
hak
@hakart_twitter
Oct 05 2017 09:36
yes thanks
Juan Blanco
@juanfranblanco
Oct 05 2017 09:41
let me know how it goes, I can introduce interfaces for Contract, Function, Function<> , Event and DeployContractService if you want
(obviously not by tomorrow)
hak
@hakart_twitter
Oct 05 2017 09:42
I'll let you know . Thank you!
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:36
Hi Juan this is Rushin Sukhadiya
Juan Blanco
@juanfranblanco
Oct 05 2017 10:36
hi you made it
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:36
yea:)
Juan Blanco
@juanfranblanco
Oct 05 2017 10:37
can you explain in what step you are at the moment?
you have installed geth, mist
you have your project with Nethereum
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:38
yes
and have Ethereum Consortium Blockchain account
Juan Blanco
@juanfranblanco
Oct 05 2017 10:38
so you want to work locally first?
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:39
with azure account
not like personal.newAccount in geth
Juan Blanco
@juanfranblanco
Oct 05 2017 10:41
no you will have to work with your account from geth
you could create a service that will map both accounts
the azure account and the blockchain account
and store the private keys securely in Azure
"account from geth" == your Ethereum account
can be created using Metamask
or you can use Nethereum to create one
or even Geth locally using personal_newAccount()
all are the same, there is a private key behind them
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:44
ohh
Juan Blanco
@juanfranblanco
Oct 05 2017 10:45
in Metamask these are created using a combination of words and from there allow you to create many private keys, but having one single way to recover (the 12 words)
note the private keys do not need to exist (when created) in the blockchain
but they will need to be funded with some Ether, so they can interact with the chain
mainly to "pay" for the transaction cost
this what is called gas
gas is necessary even on a consortium chain as a preventive meassure for things like endless loops which will bring the blockchain to a halt
hopefully it makes more sense
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:48
Actually I m beginner in this
Juan Blanco
@juanfranblanco
Oct 05 2017 10:49
if you just want to create a new key pair you can use the Nethereum.Console
but if you have geth installed you can just use the personal
or you can use the common test account in Nethereum
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:53
Ok I just have created blockchain in azure and have installed geth, mist as per this article https://www.vicompany.nl/nl/magazine/start-with-blockchain-in-dotnetcore
this is my blockchain account **1235gl.westindia.cloudapp.azure.com
Juan Blanco
@juanfranblanco
Oct 05 2017 10:54
ok
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:54
and this showing me "My Account Address: c51422cc940fa7c76b48cd46dc2448323069ca39"
Juan Blanco
@juanfranblanco
Oct 05 2017 10:54
so you have funded your account?
mainly you have now 2 chains
well if you are running geth locally as a private chain (That is one)
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:55
yes have ether balance
now i just want to create contract with this live account address
Juan Blanco
@juanfranblanco
Oct 05 2017 10:56
right the live account address is that not the url of the app page?
which interacts with the chain in azure?
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 10:59
wait let me show u
eac.PNG
Juan Blanco
@juanfranblanco
Oct 05 2017 11:06
right what you can do
is using nethereum point at **1235gl.westindia.cloudapp.azure.com:8545
instead of using your localhost:8545
then if you fund
this address: "0x12890d2cce102216644c59daE5baed380d84830c"
using the web site
you will be able to create an account as following
new Account("0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7") which is the private key
let me post a gist of the code
Juan Blanco
@juanfranblanco
Oct 05 2017 11:22
           var accountPrivateKey = "0xb5b1870957d373ef0eeffecc6e4812c0fd08f554b37b233526acc331bf1544f7";
            var accountAddress = "0x12890d2cce102216644c59daE5baed380d84830c";


            var account = new Account(accountPrivateKey);
            var rpcAddress = "**1235gl.westindia.cloudapp.azure.com:8545";
            var web3 = new Web3(account, rpcAddress);
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 11:24
ok
Juan Blanco
@juanfranblanco
Oct 05 2017 11:24
I have used the address of the Nethereum test address and its private key
you can prefund that address
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 11:24
sure
Juan Blanco
@juanfranblanco
Oct 05 2017 11:25
note that you can create a new account using this code
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 11:26
ok
Juan Blanco
@juanfranblanco
Oct 05 2017 11:27
var ecKey = Nethereum.Signer.EthECKey.GenerateKey();
            //Get the public address (derivied from the public key)
            var address = ecKey.GetPublicAddress();
            var privateKey = ecKey.GetPrivateKey();
then the rest will be as per the video / tutorials sample
have a browse there
BTW i have issues deploying that azure template
right now, did you have any problems?
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 11:29
just cheking
or have somebody deployed it already
Juan Blanco
@juanfranblanco
Oct 05 2017 11:39
ah thanks I use the template directly
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 11:57
and what information should i store in "accountInfo.txt" for executing "startgeth.sh"
Juan Blanco
@juanfranblanco
Oct 05 2017 12:03
oh no
right if you are interacting with the azure consortium that is a chain with the number of nodes you setup
BUT if you want to just launch your private chain
just use the startgeth.bat or sh depending of your os
this will just launch a node
SO use either not in combination
if you launch the private chain from testchain (also i recommend going down to the clique folder as it mines faster using PoA)
then use account in accountInfo.txt
as that is already setup in genesis with some ether
of course you can use that account to transfer to a newly created account
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 12:10
in my case what should I do? I have implemented the above code u given
Juan Blanco
@juanfranblanco
Oct 05 2017 12:11
oh it is all a learning experience
play with both
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 12:11
and getting this Error occurred when trying to send rpc requests(s)
Juan Blanco
@juanfranblanco
Oct 05 2017 12:11
obviously the azure blockchain is a more realistic scenario
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 12:12
I need to run ipc right?
Juan Blanco
@juanfranblanco
Oct 05 2017 12:14
no
to connect to the azure one rpc
just the url
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 12:14
soory ipc mean startgeth.sh
Juan Blanco
@juanfranblanco
Oct 05 2017 12:15
ok do you want to connect to azure?
if so ignore the sh
also if you are in windows ignore it too :)
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 12:16
yes in wondows10
Juan Blanco
@juanfranblanco
Oct 05 2017 12:16
well if you want to launch the local chain use the bat file
and recommend having geth next to
rushinsukhadiya
@rushinsukhadiya
Oct 05 2017 13:41
now getting this error "The method personal_unlockAccount does not exist/is not available" on UnlockAccount statement
Juan Blanco
@juanfranblanco
Oct 05 2017 13:47
yes if you are connecting to Azure you cannot unlock accounts (or mine)
this is why you use your private key
этот товарищ
@etot_tovarisch_twitter
Oct 05 2017 17:45
What is the proper way to send multiple transactions? When I call "SendTransactionAndWaitForReceiptAsync" it takes a lot of time, when I call SendTransactionAsync the second transaction throws exception "replacement transaction underpriced"..