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

Swift
Kotlin
Java
JS (React Native)
JS (Cordova)
Dart
JSON-RPC
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)
}
}
val curve = EllipticCurve.Secp256k1 //Check supported curves in Card.supportedCurves
val cardId = card.cardId
tangemSdk.createWallet(
curve = curve,
cardId = cardId
) { result ->
when (result) {
is CompletionResult.Success -> {
runOnUiThread {
Log.d(TAG, result.wallet)
}
}
is CompletionResult.Failure -> {
runOnUiThread {
Log.d(TAG, result.error)
}
}
}
}
EllipticCurve curve = EllipticCurve.Secp256k1;
String cardId = card.getCardId();
tangemSdk.createWallet(curve, cardId, null, result -> {
if (result instanceof CompletionResult.Success) {
CreateWalletResponse response = ((CompletionResult.Success<CreateWalletResponse>) result).getData();
Log.d(TAG, response.getWallet());
} else if (result instanceof CompletionResult.Failure) {
TangemError error = ((CompletionResult.Failure<CreateWalletResponse>) result).getError();
Log.d(TAG, error.getCustomMessage());
}
return Unit.INSTANCE;
});
import { EllipticCurve } from 'tangem-sdk-react-native';
const curve = EllipticCurve.Ed25519;
const isPermanent = true;
const cardId = card.id;
TangemSdk.createWallet(curve, isPermanent, cardId)
.then((result) => console.log(result))
.catch((err) => console.log(err));
var curve = 'Ed25519';
var isPermanent = true;
var cardId = card.cardId;
var initialMessage = {"body": "body", "header": "header"};
var callback = function (response, error) {
if (error) {
alert({ "error": error });
} else {
alert({"response": response});
}
};
TangemSdk.createWallet(curve, isPermanent, cardId, initialMessage, callback);
// Request
{
"jsonrpc":"2.0",
"id":1,
"method":"create_wallet",
"params":{
"curve":"secp256r1"
}
}
// Response
{
"jsonrpc":"2.0",
"result":{
"cardId":"c000111122223333",
"wallet":{
"publicKey":"5130869115a2ff91959774c99d4dc2873f0c41af3e0bb23d027ab16d39de1348",
"curve":"secp256r1",
"settings":{
"isPermanent":true
},
"totalSignedHashes":10,
"index":1
}
},
"id":1
}
Last modified 11mo ago
Copy link
On this page
Request parameters
Response
Example