These are chat archives for Nethereum/Nethereum

8th
Dec 2018
hessam94
@hessam94
Dec 08 2018 02:02
PLEASE HELP ME: I tried to set up my test network but it just gives me the cannot send request error. if I use localhost:8545 it says the machine refuses the request , and if set my client ip and port (169.254.84.189:30303) it says that underlying connection closed. its seems to me that i am making mistake because i think 8545 is http port and 30303 is tcp port and no realtion. It worked with your test networks(startgeth.bat) but with this one it doesn't.
I need to set up my network on two clients thats why i dont use your testchain
hessam94
@hessam94
Dec 08 2018 02:18
it seems to me that you set some special commands in your .bat file, because it works with that network , but with my test network "the target machine actively refuses 127.... 8545"
hessam94
@hessam94
Dec 08 2018 03:24
if i use your startgeth.bat i cannot run it on two different machines because there is a extra data in the file , unique for each account, so both machines need to have the same genesisifile to be peered
hessam94
@hessam94
Dec 08 2018 04:24
there is a EXTRADATA parameter in your genesis file, if we dont put it into the file the C# code cannot connect send request and waits forever.
YOUR WORK IS GREAT "BUT" i wish you had better documentation , there are lots of guys here have similar problems. don't you have any simple sample with a test network, not your test network??
hessam94
@hessam94
Dec 08 2018 06:22
and also there is "clique" in your genesis file, removing this part preventing the connection. it seems this property change the head every time that I get admin.nodeInfo and so on two different pc they cannot be connected
Juan Blanco
@juanfranblanco
Dec 08 2018 06:36
@hessam94 we use clique or parity poa as it is the fastest / simplest way to create a test chain (single node I know) to test the smart contracts.
If you are setting up two nodes connecting to each other on the same pc, you will need to disable or use a different port RPC same goes for IPC.
hessam94
@hessam94
Dec 08 2018 06:38
yeah i set ZERO for clique and it works, becuse i wanted to test on two devices
on two different pc, so far it works but I have to set same extra data on both side , which does not make sense but I have to ...
if the genensis files are different the nodes on two pcs cannot connect to each other
Yeah genesis is the genesis
hessam94
@hessam94
Dec 08 2018 06:42
the problem i found setting some values for clique causes the head changes, every time that i run the command admin.nodeInfo the head is different
so two nodes cannot connect by the way
thats why i set it to zero
Juan Blanco
@juanfranblanco
Dec 08 2018 06:49
Yes the genesis needs to be the same, it is mainly the configuration of the client/network
That guide I posted is pretty complete, just read it :) probably what you need. If you play with that it will allow you to understand the settings. Oh and check the sealers configuration
But overall good feedback, we will put in the todo a clique / poa network with more than one node.
Also you could, launch it in Azure
Mainly everything is done for you there but that is parity poa
Juan Blanco
@juanfranblanco
Dec 08 2018 07:23
@hessam94 "just read it" was meant to say I have just read it
English can be interpreted so bad sometimes
turtlewen
@turtlewen
Dec 08 2018 08:18
@juanfranblanco hi i meet a problem
Nethereum.JsonRpc.Client.RpcClientUnknownException: 'Error occurred when trying to send rpc requests(s)'
i meet this error
i trying to use quorum
and specify my second nodes with ip address and port number
the geth cmd i also got modify --rpcapi quorum
but still appear this error
var url = "http://192.168.43.13" + ":" + "30303";
var web3 = new Web3Quorum(url);
this is the code i trying to specify the ip address
Juan Blanco
@juanfranblanco
Dec 08 2018 08:20
i will ask the obvious is that your ip address and the port configured for that node?
turtlewen
@turtlewen
Dec 08 2018 08:21
@juanfranblanco the ipaddress actually is another nodes ip address
me and second node is in the same network
Juan Blanco
@juanfranblanco
Dec 08 2018 08:21
ah they many not have rpc enabled or that port
something to check
turtlewen
@turtlewen
Dec 08 2018 08:22
Test-NetConnection -ComputerName 192.168.43.13 -Port 30303
when i using window power shell to run testing to the port
actually is ping succeed
Juan Blanco
@juanfranblanco
Dec 08 2018 08:22
ah also check for --rpcaddr "0.0.0.0"
to allow any ip to access the other node
turtlewen
@turtlewen
Dec 08 2018 08:23
geth --networkid 4224 --mine --minerthreads 1 --datadir "." --rpc --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net,quorum --unlock 0 --password ./password.sec
Juan Blanco
@juanfranblanco
Dec 08 2018 08:23
yeah add the --rpcaddr "0.0.0.0"
turtlewen
@turtlewen
Dec 08 2018 08:23
okok thanks
Juan Blanco
@juanfranblanco
Dec 08 2018 08:23
@hessam94 that might help you too
btw usual warning, you are allowing any ip to access that node
turtlewen
@turtlewen
Dec 08 2018 08:27
if i only want to specify certain ip address
Juan Blanco
@juanfranblanco
Dec 08 2018 08:27
you can do that too
turtlewen
@turtlewen
Dec 08 2018 08:28
--ipaddr "192.168.43.13", "192.168.56.1"
??
Juan Blanco
@juanfranblanco
Dec 08 2018 08:28
but first test it with 0.0.0.0
turtlewen
@turtlewen
Dec 08 2018 08:28
\"
okok
Juan Blanco
@juanfranblanco
Dec 08 2018 08:28
that is a deployment consideration
Juan Blanco
@juanfranblanco
Dec 08 2018 08:40
@a7coretryan hi I have tested it now with parity poa in azure
yes there is an issue when using null values, you need to use it in this format
var filterTransferEventsForContractAllReceiverAddress2 = transferEventHandler.CreateFilterInput(null, new []{receiverAddress2});
turtlewen
@turtlewen
Dec 08 2018 08:41
@juanfranblanco still same error
Nethereum.JsonRpc.Client.RpcClientUnknownException: 'Error occurred when trying to send rpc requests(s)'
Juan Blanco
@juanfranblanco
Dec 08 2018 08:42
what is the undelying stack trace
turtlewen
@turtlewen
Dec 08 2018 08:45
2 inner exception
HttpRequestException: An error occurred while sending the request.
WebException: The underlying connection was closed: The connection was closed unexpectedly.

when i admin.peers

network: {
inbound: true,
localAddress: "172.20.10.6:30303",
remoteAddress: "172.20.10.12:60128",
static: false,
trusted: false
},

the value i get
var url = "http://172.20.10.12" + ":" + "30303";
var web3 = new Web3Quorum(url);
var contract = web3.Eth.GetContract(devops_data2ABI, devops_data2Address);
return contract;
i try to connect like that
geth --networkid 4224 --mine --minerthreads 1 --datadir "." --rpc --rpcaddr "0.0.0.0" --rpcport "8545" --port "30303" --rpccorsdomain "*" --nat "any" --rpcapi eth,web3,personal,net,quorum --unlock 0 --password ./password.sec
Juan Blanco
@juanfranblanco
Dec 08 2018 08:49
ah
you are using the wrong port
your rpc port is 8545
i did not see that
turtlewen
@turtlewen
Dec 08 2018 08:57
i tried used 8545
also cannot
Nethereum.JsonRpc.Client.RpcClientTimeoutException: 'Rpc timeout after 20000 milliseconds'
this the error i try use port 8545
Juan Blanco
@juanfranblanco
Dec 08 2018 09:15
oh well at least you are getting somewhere ish
it looks like you are not getting any response from the server
can you see a webpage when you navigate to the url?
turtlewen
@turtlewen
Dec 08 2018 09:16
yup
Juan Blanco
@juanfranblanco
Dec 08 2018 09:16
http yourip :8545
turtlewen
@turtlewen
Dec 08 2018 09:16
wait i try
image.png
web pages take too long to reponse
Juan Blanco
@juanfranblanco
Dec 08 2018 09:17
ok so you cannot see it
can you see it on that pc?
turtlewen
@turtlewen
Dec 08 2018 09:33
854737e7-306a-4077-870c-8009d56350b0.jpg
empty page
turtlewen
@turtlewen
Dec 08 2018 10:20
so how??
Juan Blanco
@juanfranblanco
Dec 08 2018 10:39
Sorry I had to go, I meant if you to the pc and use localhost to see the RPC working, if you don't a timeout might be ok
Another test would be to curl
A method like get accounts, check the JSON RPC help in geth for info (on my phone now)
If all that works mainly you are having connectivity problems from pc A to pc B
Roy
@Shammah
Dec 08 2018 16:14
What exactly is the difference between EthGetFilterChangesForBlockOrTransaction and EthGetFilterChangesForEthNewFilter? They seem to both call eth_getFilterChanges, and I can only find a difference in RPC return types, namely string[] and FilterLog[].
Documentation for both response handlers is identical as well
hessam94
@hessam94
Dec 08 2018 16:46
is there any function to add peers by code, as of now I have to write a command in geth which is extremely annoying....
Juan Blanco
@juanfranblanco
Dec 08 2018 17:21
@Shammah mainly depending on the input you have different outputs so in c# we need two requests
The comments match the RPC docs for reference
In this scenario pending or block return hashes the other the logs
You just use the filter id
That is in web3.Admin.AddPeer
turtlewen
@turtlewen
Dec 08 2018 17:51
@juanfranblanco i think i will try another computer and see whether the rpc can work or not
@juanfranblanco any way using nethereum to get account through meta mask??
or maybe get the account from the private blockchain
hessam94
@hessam94
Dec 08 2018 18:22
thanks a lot, sorry for lots of Qs. but i cannot find web3.Admin , I've already downloaded all of DLLs,
and is there any way to get all smart contracts addresses, because each time I have to write down the address and add it to second application on remote machine. I didnt find the right command to get all contract addresses by geth even
Roy
@Shammah
Dec 08 2018 18:57
Ooh I see, the string[] is an array of hashes, that makes sense. Thanks
Juan Blanco
@juanfranblanco
Dec 08 2018 18:59
@hessam94 no you cannot
You need to keep track of deployments
@turtlewen check the keystore docs workbook to access the private keys from geth
The admin module is part Nethereum.Geth
Web3Geth
From metamask you can load your backup words in Nethereum.hdwallet or export private keys
Juan Blanco
@juanfranblanco
Dec 08 2018 19:04
Interop has been done in browser with unity3d webgl and blazor but I am yet to create a component look at the samples if needed
@Shammah yeah
hessam94
@hessam94
Dec 08 2018 19:44

I want to get the return result of transaction, the funcitons works grate but the reuslt is just the transaction receipt, I need the "return int" value. function AddPlayer() public returns(int)
{
// address(0) is same as null or empty string
if (XPlayer == address(0))
{
XPlayer = msg.sender;
return 1;
}
else if (OPlayer == address(0))
{
OPlayer = msg.sender;
return 2;
}
return 3;
}

var handler = client.Eth.GetContractTransactionHandler<AddPlayerFunction>();
var add = new AddPlayerFunction();
var result= await handler.SendRequestAndWaitForReceiptAsync(add, contractAddress);

[Function("AddPlayer","int")]
public class AddPlayerFunction
Juan Blanco
@juanfranblanco
Dec 08 2018 20:22
You cannot return any value from a transaction that is committed / stored in the ledger
What you can is raise an event which will write to the log
Check the docs on how to work with events
Roy
@Shammah
Dec 08 2018 20:40
I want to unit test some functionality that depends on some instances such as EthApiFilterService and EthApiBlockService. They don't have interfaces I can mock, and I'm afraid booting up geth with a testchain isn't the right course of action. Is there any particular reason not extract interfaces and inherit from them for a lot of the api services?
Preferably I'd be able to use something like Moq to stub return values of those services in my unit tests
Alternatively I could write my own wrapper, but that would be a bit silly