ethereum / ethereumj

DEPRECATED! Java implementation of the Ethereum yellowpaper. For JSON-RPC and other client features check Ethereum Harmony
GNU Lesser General Public License v3.0
2.19k stars 1.09k forks source link

Strange behavior on peers #311

Closed mikkazan closed 9 years ago

mikkazan commented 9 years ago

Hi EthereumJ team, I have 3 servers running and connected. All servers have port 30303, but when I check peers on each server I see strange info. On some servers I see duplicated remote server peer with port 9. To get Peers info I use Ethereum().getPeers().

On my localhost (duplicated server1 and server2 with different peerId with port 9) - Windows

[{"address":"server2","port":30303,"peerId":"4ac6275191ec6e4e44db1fbf09869a7b27c551365092ade1503bea0d9b8088fc67e8486648ef9f48c99b50214d33a1c19ea0bf19439100dfa320d692d341f8d1", "capabilities":[{"name":"eth","version":60,"eth":true}, {"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0},

{"address":"server2","port":9,"peerId":"142c6dc101d20cfeb1468ec5c749af577b4d977c08792d8dc566de880cc646905fc58796055a8f1d788c81e2c48a72e4e48172a5e8d0bd2cdee08507466cccb1", "capabilities":[{"name":"eth","version":60,"eth":true}, {"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0},

{"address":"server1","port":30303,"peerId":"a4494a4075f4c1ca7652a6054b9275ff1eb364cb8448e3194d06f61464286b70e0d07f7e12af1a5cd97f36e32d2e38643a4b88480932b437fb7999195beeca0a", "capabilities":[{"name":"eth","version":60,"eth":true}, {"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0},

{"address":"server1","port":9,"peerId":"f973e204977c93e7ed5760e70cd6eb244f9406af0576b9b1ea58a774becec2e55538e43c48818da0677579cbca118ca7fb9c596b5d41e3d0f0dc5aaab016030a", "capabilities":[{"name":"eth","version":60,"eth":true}, {"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0}]

On remote server 1 (no duplication) - Linux

[{"address":"server2","port":30303,"peerId":"4ac6275191ec6e4e44db1fbf09869a7b27c551365092ade1503bea0d9b8088fc67e8486648ef9f48c99b50214d33a1c19ea0bf19439100dfa320d692d341f8d1", "capabilities":[{"name":"eth","version":60,"eth":true},{"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0},

{"address":"my_windows_host","port":30303,"peerId":"ab3562725ee728041bb70e8f008d72a38b55828ecf3b372954555727da706e7d02d3596cc3539b7661c17403953f277f65eac5f980d9cb1af30571f15d375515", "capabilities":[{"name":"eth","version":60,"eth":true},{"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0}]

On server2 (duplicated server1 with different peerId with port 9) - Linux

[{"address":"server1","port":30303,"peerId":"a4494a4075f4c1ca7652a6054b9275ff1eb364cb8448e3194d06f61464286b70e0d07f7e12af1a5cd97f36e32d2e38643a4b88480932b437fb7999195beeca0a", "capabilities":[{"name":"eth","version":60,"eth":true},{"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0},

{"address":"server1","port":9,"peerId":"7c850f6cf9afb91128554d4953cbb762c04dc6efdcb8b065643548c2a817e82ef0becdc080dc068054861d5403942c8db037c700afb9149a24690bc5dbbe9e6c", "capabilities":[{"name":"eth","version":60,"eth":true},{"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0},

{"address":"my_windows_host","port":30303,"peerId":"ab3562725ee728041bb70e8f008d72a38b55828ecf3b372954555727da706e7d02d3596cc3539b7661c17403953f277f65eac5f980d9cb1af30571f15d375515", "capabilities":[{"name":"eth","version":60,"eth":true},{"name":"eth","version":61,"eth":true}],"handshakeHelloMessage":null,"statusMessage":null,"online":false,"lastCheckTime":0}]

Is this expected behavior?

romanman commented 9 years ago

@Nashatyrev : I think I remember that 9 as a mock port in discovery part

Nashatyrev commented 9 years ago

Yep, that's how our discovery works. You may just ignore the peers with such port number.

romanman commented 9 years ago

anton, yeah but I think the api should return the connected peers not discovery peers, that is what @mikkazan expect to see

mikkazan commented 9 years ago

If it is not the issue then I guess I'm OK with it :). Just mention it somewhere in the docs so people won't get confused.

Nashatyrev commented 9 years ago

Hm, Ethereum().getPeers() refers to org.ethereum.net.peerdiscovery which is deprecated. The peers are added there from p2p PEERS_MESSAGE. I think we need to revise this part

mikkazan commented 9 years ago

Hi guys, I did not want to open a new ticket. Honestly, I'm not sure the question I want to ask is the issue. Here we go - We have .sol file created and submitted to geth. Since I'm working on ethereumJ I need to do the same. Do I have to compile it using solidity compilers and then what? I've tried to find how to deploy contract in ethereumJ but cannot find any docs how to do it. Is there any way to submit .sol to ethereumJ?

mikkazan commented 9 years ago

Anyone? Guys? Can you answer my previous question?

Nashatyrev commented 9 years ago

@mikkazan Yes you definitely have to compile the contract with solc, since we have no Solidity compiler. Deploying the binary is the same as submitting any transaction to the network, the address needs to be empty and the data should contain the contract binary