Skip to content

Generating addresses & keys for In Wallet cryptocurrencies

Royalynx edited this page Sep 22, 2019 · 14 revisions

ADAMANT's blockchain gives you an opportunity to work with wallets of other cryptocurrencies, Ethirium for example. To start you have to generate with help of eth.js pair key:value, where

  • key — address of Ethirium wallet
  • value — private key to access Ethirium wallet

Module format

input data: passPhrase of user's ADAMANT wallet

output data:

  • account — address of Ethirium wallet
  • privateKey — encripted private key to access Ethirium wallet
func generatePrivateKeyFor(passphrase: String) -> String? {
        guard AdamantUtilities.validateAdamantPassphrase(passphrase: passphrase) else {
            return nil
        }
        guard let keystore = try? BIP32Keystore(mnemonics: passphrase, password: EthWalletService.walletPassword, mnemonicsPassword: "", language: .english, prefixPath: EthWalletService.walletPath),
            let account = keystore?.addresses?.first,
            let privateKeyData = try? keystore?.UNSAFE_getPrivateKeyData(password: EthWalletService.walletPassword, account: account) else {
            return nil
        }
        return privateKeyData?.toHexString()
    }
    ```
2. 

if (!address && passphrase) { const account = utils.getAccountFromPassphrase(passphrase) context.commit('account', account) onInit(context) }

Clone this wiki locally