Is that possible to recover the pub/private key in multichain.?

+2 votes
1. We generating the address, public and private key for users to create wallet. In our application we using the signed transactions using private key. What will happen if user lost the private key. How to recover it.?

is there any function to recover it?

2. Is that possible to generate the pub/pri keys using the users details.?
asked Jun 10 by Rakesh

1 Answer

0 votes
1. You cannot recover a private key from a public key. If you are concerned about users losing their private key, you may want to consider offering them an encrypted backup service, where their private key is encrypted by some password (on their client) and then uploaded to your servers for safekeeping. That way they can recover their private key if they remember their password.

2. Yes, you could deterministically generate a private key from some user details, or any string of data. The technique is called a "brain wallet" and you can find much information and source code relating to this from the bitcoin world. See also https://www.bitaddress.org/ which gives you an example. But you should be very cautious about this because, if someone else can guess the input data, they can also calculate the private key.
answered Jun 10 by MultiChain
i have generated key pairs based on input data through brain wallet . But  it throws me error code -5.
Please see this error given below:

{"method":"importaddress","params":["13dBCcRPNZkBx24DBvHQxhTwsGtSw8VU9F"],"id":"84590604-1560773523","chain_name":"ehr_rpqb"}

error code: -5
error message:
Invalid MultiChain address or script
If you use a bitcoin compatible address generator, you need to set up your MultiChain blockchain to use bitcoin compatible addresses.

The blockchain parameter values you need are explained here: https://www.multichain.com/developers/address-key-format/

Alternatively you could modify the brain wallet script to create addresses that are compatible with your MultiChain blockchain. The technical details you need for this are on that same page.
Hello Sir,
Thanks for your all reply and finally i have generated private key and address .
But i am getting response in below format:

Address {hashBuffer: Uint8Array(20), network: Network, type: "pubkeyhash"}

please help me how could i generate actual address out of this?

thanks
If you have an array of 20 bytes (8-bit integers), the chances are that you have something which represents the output of step 4 of the "How to create a MultiChain address" section on this page: https://www.multichain.com/developers/address-key-format/

So you should be able to complete the process. If you want to make life easy, you should use bitcoin-compatible addresses on your MultiChain blockchain (as described above) then you will probably find a library that will convert this 20-byte array into a bitcoin-compatible address.
...