/register_wallet

Adds another "wallet"/blockchain address to a user handle.

🚧

/register_wallet adds a new wallet to a user with 1 wallet already

The /register_wallet endpoint gives you the ability to register additional wallets to an existing user. To use this endpoint your users will need to have at least 1 wallet already registered to them.

You'll need to ensure that this address isn't already in use on our platform first, and you'll need to verify private key ownership by creating a wallet verification signature.

The /register_wallet endpoint gives you the ability to register additional wallets to an existing user. You'll need to ensure that this address isn't already in use on our platform first, and you'll need to verify private key ownership by creating a wallet verification signature.

After registering a wallet, you will need to generate usersignature headers with that wallet in order to issue tokens to it, transfer from it, redeem from it, fetch details about it, update its nickname/default status, and delete it. See:

To create the wallet_verification_signature, you'll sign the address (as the message) with the private key of the address and send us that value as a hex string, much like how requests are signed. The difference is that this signature is created with the address, not the request body, and the signature will be sent in the request body, not in a header.

For example, to register the address in our signature examples , you would pass in 788e10a73c0548b875b6a2c47b985fc873d32ef14fff85e55791f0fccca6282838a81dd24db9ae72a508bb2bbc02f207ab1a1451ada195554fb9487a253432e61c as the wallet_verification_signature.

Another consideration: if the user has already passed KYC, allow a few minutes for this new address to be added to our whitelist before requesting transactions with this new wallet.

To request issuance to, transfer from, or redemption from this new wallet, generate your usersignature header with this new wallet you've registered when making a transaction request ( /issue_sila , /transfer_sila , or /redeem_sila ).

  

Requests

Both authsignature and usersignature headers are required for this request.

The wallet_verification_signature key is required to verify ownership of the new wallet. To create this value, sign the address with the matching private key.

wallet.blockchain_address is the new blockchain address to register to the requested user_handle.

wallet.blockchain_network is the network on which this address is used. The only acceptable value for now is "ETH".

wallet.nickname is a unique nickname for the blockchain address (like crypto_alias in the /register endpoint). You can optionally use this nickname when specifying a transfer destination in the /transfer_sila endpoint.

The wallet.default key is not required; the value is a boolean

Note - We recently renamed the field auth_handle to app_handle. For backward compatibility, auth_handle is still valid but has been removed from our documentation.

  
POST /0.2/register_wallet HTTP/1.1
Host: sandbox.silamoney.com
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]
Content-Type: application/json

{
  "header": {
    "created": 1234567890, 
    "app_handle": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2", 
    "crypto": "ETH", 
    "reference": "<your unique id>"
  }, 
  "wallet_verification_signature": "(signature generated from signing address as the message)",
  "wallet": {
    "blockchain_address": "(address to register to user_handle)",
    "blockchain_network": "ETH",
    "nickname": "new_wallet_nickname",
    "default": true
  }
}

***

HTTP/1.1 200 OK

{
  "reference": "ref",
  "message": "Blockchain address [address] registered.",
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "171",
  "wallet_nickname": "new_wallet_nickname-123erf"
}
// If you don't have a wallet
const newWallet = Sila.generateWallet();
const res = await Sila.registerWallet(
  userHandle,
  walletPrivateKey,
  newWallet,
  nickname,
  default,
);

// If you already have generated a wallet by other means
const newWallet = {
  address: "The wallet's address",
  privateKey: "The wallet's private key",
};
const res = await Sila.registerWallet(
  userHandle,
  walletPrivateKey,
  newWallet,
  nickname,
  default,
);

// Success Response Object
console.log(res.statusCode); // 200
console.log(res.data.success); // TRUE
console.log(res.data.status);
console.log(res.data.reference); // Random number reference
console.log(res.data.message); // Wallet registered
console.log(res.data.wallet_nickname); // The wallet's nickname associated
payload = {
    "user_handle": "user.silamoney.eth",
    "wallet_verification_signature": "verification_signature",
    "wallet": {
        "blockchain_address": '0x123...890',
        "blockchain_network": "ETH",
        "nickname": "wallet_python_new",
        "default": True
    }
}

response = Wallet.registerWallet(app, payload, user_private_key)

### Success Response Object
{
  "status": 'SUCCESS',
  "status_code": 200,
  "reference": "ref",
  "message": "Blockchain address [address] registered.",
  "success": True,
  "wallet_nickname": "new_wallet_nickname-123erf"
}

### Failure Response Object
{
  "reference": "ref",
  "message": "Error message",
  "success": False
}
Wallet wallet = api.generateWallet();
String walletVerificationSignature = EcdsaUtil.sign(wallet.getBlockChainAddress(), wallet.getPrivateKey()); 

ApiResponse response = api.registerWallet(userHandle, wallet, walletVerificationSignature, userPrivateKey,default);

// Success Response Object
System.out.println(response.getStatusCode()); // 200
System.out.println(((RegisterWalletResponse)response.getData()).getReference());
System.out.println(((RegisterWalletResponse)response.getData()).getMessage());
System.out.println(((RegisterWalletResponse)response.getData()).getSuccess());
System.out.println(((RegisterWalletResponse)response.getData()).getStatus());
System.out.println(((RegisterWalletResponse)response.getData()).getWalletNickname());
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key'; // Hex format
$wallet = $client->generateWallet();
$walletPrivateKey = $wallet->getPrivateKey();
$walletPublicAddress = $wallet->getAddress()
$ecdsaUtil = new EcdsaUtil();
$walletVerificationSignature = $ecdsaUtil->(
    $walletPublicAddress,
    $walletPrivateKey
);

// Call the api
$response = $client->registerWallet(
  $userHandle, 
  $wallet, 
  $walletVerificationSignature, 
  $userPrivateKey
);

// Success 200
echo $response->getStatusCode();
echo $response->getData()->success;
echo $response->getData()->status;
echo $response->getData()->reference;
echo $response->getData()->message;
echo $response->getData()->wallet_nickname;
// If you have not generated a wallet keys by other means
UserWallet newWallet = api.GenerateWallet(); // Create new Wallet
ApiResponse<object> response = api.RegisterWallet(userHandle, registeredWalletPrivateKey, newWallet, nickname, isDefault);

// If you already have generated a wallet by other means
UserWallet generatedWallet = new UserWallet(generatedWalletPrivateKey, generatedWalletBlockchainAddress);
ApiResponse<object> response = api.RegisterWallet(userHandle, registeredWalletPrivateKey, generatedWallet, nickname, isDefault);

// Success Object Response

Console.WriteLine(response.StatusCode); // 200
var parsedData = (RegisterWalletResponse)response.Data;
Console.WriteLine(parsedData.Success); // TRUE
Console.WriteLine(parsedData.Reference); // Reference
Console.WriteLine(parsedData.Message); // Message
Console.WriteLine(parsedData.WalletNickname); // The wallet nickname associated

Key

Type

Description

header

JSON object

Required. Requires these keys in JSON format: created, app_handle, user_handle. See the /check_handle endpoint for the complete list of fields in this object.

wallet_verification_signature

String

Required. Min Length 130, Max 130
Must be a valid signature created by signing the blockchain_address value with its associated private key.

blockchain_address

String

Required. Hex-encoded blockchain address (prefixed with "0x")
Must be globally unique, Min length 42, Max length 42
This value should be match the required address regex pattern: ^0x[a-fA-F0-9] {40}$
Example: 0x1234567890abcdef1234567890abcdef12345678

blockchain_network

String

Optional. UPPERCASE, only valid value is ETH Example: ETH

nickname

String

Optional. Min length 1, Max Length 40 Example: new_wallet_nickname

default

Boolean

Optional. Default false. If set to true and tokens are transferred to this user with the /transfer_sila endpoint and no specific wallet is named, the wallet set as default will be the transfer destination.

  

Responses

The success attribute is a JSON key sent in the response body.

Status Code

success Attribute

Description

200

true

Successfully added new wallet.

400

false

Bad request format or wallet already registered to someone.

403

false

Auth signature is absent, derived address does not belong to app_handle, or could not verify wallet_verification_signature.


Did this page help you?