/register_wallet

Adds a wallet to a user handle.

🚧

ECDSA ONLY - /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.

When using legacy ECDSA authentication

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 ).

When using Authentication Tokens

The use of this endpoint creates a new wallet without the need to supply an address or a wallet_verification_signature.

Requests

When using legacy ECDSA authentication

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.

When using Authentication Tokens

Neither the authsignature or usersignature headers are required for this request.

wallet.nickname and wallet.default are both optional, and similar in use to an ECDSA-authenticated request. If a wallet.nickname is not provided, one with the form wallet-[8 hex digits] will be generated.

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
sandbox.silamoney.com
Content-Type: application/json
// if using OAuth2
Authorization: Bearer [GENERATED JWT TOKEN HERE]
// if using ECDSA
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]

{
  "header": {
    "created": 1234567890, 
    "app_handle": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2", 
    "reference": "<your unique id>"
  }, 
  "wallet": {
    "nickname": "new_wallet_nickname",
    "default": true
  }
}

***

HTTP/1.1 200 OK

//ECDSA
{
  "reference": "<your unique id>",
  "message": "Blockchain address [address] registered.",
  "success": true,
  "status": "SUCCESS",
  "response_time_ms": "171",
  "wallet_nickname": "new_wallet_nickname-123erf"
}

//Authentication Tokens
{
  "success": true,
  "message": "New ledger account created, id: 5eae53c1-09ae-4229-a9fd-2c4427046a63",
  "reference": "<your unique id>",
  "wallet_nickname": "wallet-5eae53c1",
  "wallet_id": "5eae53c1-09ae-4229-a9fd-2c4427046a63",
  "status": "SUCCESS",
  "response_time_ms": "42"
}
// If you don't have a wallet
const newWallet = Sila.generateWallet();
const res = await Sila.registerWallet(
  userHandle,
  walletPrivateKey,
  newWallet,
  nickname,
  default,
  statementsEnabled
  statementsEnabled
);

// 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,
  statementsEnabled
  statementsEnabled
);

// 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,
      	"statements_enabled": 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",
  "statements_enabled": True
}

### Failure Response Object
{
  "reference": "ref",
  "message": "Error message",
  "success": False
}
Wallet wallet = api.generateWallet();
String walletVerificationSignature = EcdsaUtil.sign(wallet.getBlockChainAddress(), wallet.getPrivateKey()); 
wallet.setStatementsEnabled(true); // Optional
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());
System.out.println(((RegisterWalletResponse)response.getData()).isStatementsEnabled());
$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;
echo $response->getData()->statements_enabled;
// 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
KeyTypeDescription
headerJSON objectRequired. 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.
nicknameStringOptional. Min length 1, Max Length 40 Example: new_wallet_nickname
defaultBooleanOptional. 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 Codesuccess AttributeDescription
200trueSuccessfully added new wallet.
400falseBad request format or wallet already registered to someone.
403falseAuth signature is absent, derived address does not belong to app_handle, or could not verify wallet_verification_signature.