1

Is there a command in the geth javascript console to check if node is running in private net or if it is public?

For now I always had to check it in the left hand corner in mist if it's private or public:

private network sign in the left hand corner

1

yes,

do:

eth.getBlock(0) 

If the hash is 0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3 then it is public, otherwise it is private, test net or any other net that is not Ethereum Main Net.

Though, it is not 100% certain, because you may also run a public net in isolated network, and create a chain split.

| improve this answer | |
  • My other solution would be to compare the balance of the node with the public blockchain. If it‘s the same it is a public node else private. – Flaqz Jun 29 '18 at 8:26
  • Why would the hash for the public blockchain always be the same (0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3)? – Flaqz Jun 29 '18 at 8:31
  • its the hash of the block 0, block 1 will have another hash, but the hash of the first block (block 0) indicates what blockchain are you using – Nulik Jun 29 '18 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.