Create wallet

Generate wallet's public and private keys.

Wallets can be generated by the card during production, according to the personalization config, or directly using the CreateWallet command.

CreateWallet command creates a wallet on the card. At this moment, by using a certified true random number generator (TRNG), the chip generates a random private key and then computes a corresponding public key from it. No one from outside the chip, including Tangem, can ever know what the private key is.

Each wallet on the card contains a pair of public and private keys. A public key is used to compute a unique address in the blockchain. A private key is used to sign transactions originating from this address. So only the owner of the private key can initiate the transfer of funds from this address.

Regardless of where and when the wallet was generated, neither Tangem nor anyone else has access to the private key. The private key cannot under any circumstances be declassified. This is one of the main advantages of the Tangem cards. In other words, whoever owns the private key owns the crypto funds.

You can generate up to 40 wallets on one card with different curves.

This method can be protected with a Passcode.

Request parameters

curve <EllipticCurve> Elliptic curve.

cardId <String> CID, Unique Tangem card ID number.

initialMessage <Message> [optional] This message will be shown in the NFC session dialog. Default: "Tap the card to your phone exactly as it shown above".

Response

This command will return the Card.Wallet (click to see more) object in response.

Example

let curve = EllipticCurve.secp256k1 //Check supported curves in Card.supportedCurves
let cardId = card.cardId

tangemSdk.createWallet(curve: curve, cardId: cardId) { result in
    switch result {
    case .success(let response):
        let newWallet = response.wallet
        print(newWallet)
    case .failure(let error):
        print(error)
    }
}

Last updated