Same address for per-order blockchain

+3 votes

Hi,

In one of your blogs "moving-on-from-big-blockchains", it has been mentioned that you can use the same address for per-order blockchain? How do I do that? Because everytime I create a new chain, it creates a new set of parameters, new port numbers(both blockchain and rpc), new passwords for rpc connection?  

 

asked Mar 28, 2016 by amanc

1 Answer

+1 vote

After creating a new blockchain, but before launching it, you can modify the necessary parameters in params.dat to make sure that the addresses in both chains are the same. These relevant parameters are:

address-pubkeyhash-version

address-scripthash-version

private-key-version

address-checksum-value

You may also find the multichain-util clone ... command useful for doing this, although it will copy across all the other blockchain parameters as well, including the default-network-port and default-rpc-port which you will definitely want to be different for different chains.

answered Mar 28, 2016 by MultiChain
Hi,
I have used the clone command to create a duplicate chain but the all 4 parameters mentioned above changed in the copied version. So I got a different address and different rpc password for the new  admin node.

I also manually copied the 4 parameters mentioned above for the new chain, still a different address was generated for the admin node.
Ah, you're quite right - sorry about that. In that case you'll have to edit the params.dat manually after cloning, to set those four parameters to be identical. We should add this as an option for multichain-util clone in future.
Hi,
You didn't read my 2nd comment, I also manually copied the 4 parameters mentioned above for the new chain, still a different address was generated for the admin node. So not able to get same address in both options- manual or cloning.
Sorry I missed the second comment - let me explain. Just because two blockchains have the same address parameters doesn't mean that you'll get the same address when you start nodes on both chains. Every address is generated randomly. BUT if two chains have the same address parameters you can export/import addresses between them, using the dumpprivkey/importprivkey APIs, and then you can assign admin and other permissions as appropriate to those imported addresses.
Ok. Now I manually copied the 4 parameters for the cloned chain and then changed the rpc and network port for the cloned chain so that I can run them parallelly but the new chain is not starting stating "Parameter set for blockchain <mychain> is invalid. You may generate new network using these parameters by running".

Can we not change the port numbers for the cloned chain? Are they related to the above 4 parameters?
You need to first run multichain-util create/clone to create a params.dat file without a checksum, then make the modifications you want, then run multichaind for the first time. This puts a checksum in the file to prevent further accidental modifications.
Are you talking about the "address-checksum-value" or some other checksum value? I commented the address-checksum-value and that doesn't work, I mean my chain doesn't start.
No, it's the chain-params-hash, which you can't modify yourself, and is used to ensure there are no accidental modifications to a params.dat file.
Thanks, it works now!!
...