Closed kushti closed 8 years ago
yeah I guess 0x020000 works well, right?
yes, but published json contains "0x20000"
Hello @romanman ,
I am trying to connect to morden using 0x020000 in the genesis file (https://github.com/ethereum/wiki/wiki/Morden) but ethereumj raises a INCOMPATIBLE_PROTOCOL during the connection to my geth peer (which is connected to morden).
Is it because of the different genesis hashes? Are you running Ethereumj in Morden?
Thanks in advance!
Ethereumj -> genesisHash=c31c07282c5f803da583b8b65f3aa0b5cce411f3ffa6ae11c5e0adb3e057ef4a
Geth -> genesisHash=0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303
Message -> Removing EthHandler for pub1.dh-hfc.web.com/my_ip:30303 due to protocol incompatibility Send: [DISCONNECT reason=INCOMPATIBLE_PROTOCOL]
Log:
17:11:39.174 INFO net - auth exchange done
17:11:39.180 INFO net - To: pub1.dh-hfc.web.com/my_ip:30303 Send: [HELLO p2pVersion=4 clientId=Ethereum(J)/v1.0.0-stage_2/Dev/Linux/Java capabilities=[eth:60 eth:61 eth:62] peerPort=30391 peerId=6b81c5ec2107873465066bfb2f4ca2e7f8aeba3caba0f8258ee6ed5aff037d9f8108fec5b3362f945a8551b5be18ace2fd69de8cbca0deadbdb2c00817c1a385]
17:11:39.182 INFO wire - MessageCodec: Buffer bytes: 176
17:11:39.183 INFO net - From: pub1.dh-hfc.web.com/my_ip:30303 Recv: [HELLO p2pVersion=4 clientId=Geth/v1.3.2/linux/go1.5.1 capabilities=[eth:63 eth:62 eth:61] peerPort=0 peerId=233de6a782bad197dca8c67efb7b6120036c23b27e0b341e6103be0a29320e8046c78ace3b25d591cf43e0f66592d45af53561482141226cb2417b06743d74d9]
17:11:39.185 INFO net - P2P protocol activated
17:11:39.194 INFO net - EthV62 [ address = pub1.dh-hfc.web.com/my_ip:30303 | id = 233de6a7 ]
17:11:39.195 INFO net - ETH protocol activated
17:11:39.206 INFO net - To: 233de6a7 | pub1.dh-hfc.web.com/my_ip:30303 Send: [STATUS protocolVersion=62 networkId=2 totalDifficulty=020000 bestHash=c31c07282c5f803da583b8b65f3aa0b5cce411f3ffa6ae11c5e0adb3e057ef4a genesisHash=c31c07282c5f803da583b8b65f3aa0b5cce411f3ffa6ae11c5e0adb3e057ef4a]
17:11:39.241 INFO net - From: 233de6a7 | pub1.dh-hfc.web.com/my_ip:30303 Recv: [STATUS protocolVersion=62 networkId=2 totalDifficulty=97813d4bab bestHash=3669b12dbfe54f9307a57167f963bda5647e571320d477f648866e8be34dc119 genesisHash=0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303]
17:11:39.242 INFO net - Removing EthHandler for pub1.dh-hfc.web.com/my_ip:30303 due to protocol incompatibility
17:11:39.262 INFO net - To: 233de6a7 | pub1.dh-hfc.web.com/my_ip:30303 Send: [DISCONNECT reason=INCOMPATIBLE_PROTOCOL]
0x020000 and 0x20000 should be equal values. Do you have other values in genesis equal (including leading zeros)?
Hi @Nashatyrev ,
I copied the genesis.json from https://github.com/ethereum/wiki/wiki/Morden and I changed only the difficulty. This is the file contained in my frontier-custom-morden.json:
{
"nonce": "0x00006d6f7264656e",
"difficulty": "0x020000",
"mixhash": "0x00000000000000000000000000000000000000647572616c65787365646c6578",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x",
"gasLimit": "0x2FEFD8",
"alloc": {
"0000000000000000000000000000000000000001": { "balance": "1" },
"0000000000000000000000000000000000000002": { "balance": "1" },
"0000000000000000000000000000000000000003": { "balance": "1" },
"0000000000000000000000000000000000000004": { "balance": "1" },
"102e61f5d8f9bc71d0ad4a084df4e65e05ce0e1c": { "balance": "1606938044258990275541962092341162602522202993782792835301376" }
}
}
My geth peer is started in a standard way: geth --testnet --verbosity 1 --port 30303 --rpc --rpcport 8400 --rpcaddr localhost --rpccorsdomain "*" --mine --unlock 0 console
0x020000 and 0x20000 are the same the value, but is the generated genesisHash the same in both cases? I am wondering if the problem is related to the difficulty or am I missing something.
Morden genesis file is now in resources.
Morden peer can be launched with ./gradlew runMorden
May I use
./gradlew runMorden -PmainClass=org.ethereum.samples.PrivateMinerSample
./gradlew runMorden -PmainClass=org.ethereum.samples.TestNetSample
to run these sample that mentioned by README.md
in testnet(Morden)
does the testnet blockchain must sync complete and the sample can start to work
@cheershendtco
All samples overrides default config either from config Bean exposed in sample itself or from TestNetSample
inheritance, so you need to create your own sample with either disabled config Bean (this way you'll use config from runMorden), or config modified for your own needs.
I don't see any logic in TestNetSample
, so it'll do just synchronization. Some samples need full sync before logic breaks in, like CreateContractSample.java
.
PrivateMinerSample
as you can see from code, starts two nodes, one is mining and other pushing transactions in the net, so you will need to modify it to adopt to Morden, you don't need regular peer there. When running on private network it will not require full sync as it will be new network with just genesis block and you will mine other blocks in it yourself.
@zilm13 Thanks for replying.I am new here please let ask more detail.
take TestNetConfig
in TestNetSample.java
for example
there is a line "database.dir = testnetSampleDb \n" +
will it overrides default config (which is ethereumj-develop/ethereumj-core/src/main/resources/ethereumj.conf)
Let`s say I have my default config like this
database {
dir = database-morden
after I run TestNetSample , it will start a node
and
dir = database-morden
will be override by dir = testnetSampleDb
for this node
protected abstract static class TestNetConfig {
private final String config =
/*
cut some code not relate to my question
*/
// special genesis for this test network
"genesis = frontier-test.json \n" +
"blockchain.config.name = 'testnet' \n" +
"database.dir = testnetSampleDb \n" +
"cache.flush.memory = 0";
Thanks a lot
@cheershendtco yeah, it will use values from config you've exposed with bean, so it will put test db in testnetSampleDb, use test genesis and id of network which identifies TestNet (161).
You could comment this line https://github.com/ethereum/ethereumj/blob/develop/ethereumj-core/src/main/java/org/ethereum/samples/TestNetSample.java#L48 and it will use default config, morden config, for example, if you use it with runMorden
.
according to mtgran`s comment
My geth peer is started in a standard way: geth --testnet --verbosity 1 --port 30303 --rpc --rpcport 8400 --rpcaddr localhost --rpccorsdomain "*" --mine --unlock 0 console
should I run geth before I run ethereumj?
@cheershendtco You don't need geth for this sample. There was original issue a year ago with no Morden genesis in resources, but it's currently included in package.