Whitelabel Wallet

NOTE: To use whitelabel wallets you will need to request access. Please email sales@bitski.com if you are interested.

Using our API

You probably want to create a new ethereum address each time one of your users signs up. That way you can assign that address to the user and then can start transfering assets to their new account.

To do that your backend needs to take the following steps:

  • Get an access token
  • Make a POST request to /v1/accounts using that access token.

Getting an Access Token

First, you'll use your credential id and secret to request an access token using OAuth. Most platforms have a library that can handle this step for you. Your token has a relatively short lifespan, so you should store the expiration date and request a new one when it expires. In order to sign transactions, you must request the scope eth_sign.

POST /oauth2/token HTTP/2
Host: https://account.bitski.com

grant_type=client_credentials
&client_id=YOUR CREDENTIAL ID
&client_secret=YOUR CLIENT SECRET
&scope=eth_sign
HTTP/2 200 OK
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache

{
  "access_token": "YOUR ACCESS TOKEN",
  "token_type": "bearer",
  "expires_in": 3600,
  "scope": "eth_sign"
}

Getting a New Ethereum Address

Once you have an access token, you can go ahead and start creating accounts. Each time you create an account you will get an ethereum address to use. You can then use that address to sign transactions.

POST /v1/accounts HTTP/2
Host: https://api.bitski.com
Content-Type: application/json
Authorization: Bearer YOUR ACCESS TOKEN
X-API-Key: YOUR CLIENT ID
HTTP/2 200 OK
Content-Type: application/json

{
  "ethereumAddress": "0xb60e8dd61c5d32be8058bb8eb970870f07233155"
}

You are now ready to send JSON RPC requests.

Integrating with the Bitski SDKs

You can also use our SDKs with the wallet. Here is an example application using bitski-node that will generate 3 wallets.

// Need to set these before we get started
// export CLIENT_ID=<YOUR CLIENT ID>
// export CREDENTIAL_ID=<YOUR CREDENTIAL ID>
// export CREDENTIAL_SECRET=<YOUR CREDENTIAL SECRET>
// Also need to install a few packages
// npm install bitski-node
// npm install node-fetch
// This will spit out something like this which is a valid CSV
//
// address
// 0x0390dece47f0e43ada3f86fb90decc7606de6a11
// 0x0bd31b20dfa4790d34f60edd5a0033505578bfaa
// 0xe666cc3d4f804e0d0302406d629fd24c2709a7ae

const Bitski = require("bitski-node");
const fetch = require('node-fetch');
const NUMBER_OF_ACCOUNTS_TO_GENERATE = 3;

getAccounts(NUMBER_OF_ACCOUNTS_TO_GENERATE).then((accounts) => {
  console.log('address');
  accounts.forEach((account) => {
    console.log(account.ethereumAddress);
  })
});

async function getAccounts(count) {
  const options = {
    credentials: {
      id: process.env.CREDENTIAL_ID,
      secret: process.env.CREDENTIAL_SECRET
    },
    disableBlockTracking: true,
  };  
  const bitskiProvider = Bitski.getProvider(process.env.CLIENT_ID, options);
  const accessToken = await bitskiProvider.tokenProvider.getAccessToken();
  var accounts = [];
  for (let index = 0; index < count; index++) {
    const accountResult = await fetch('https://api.bitski.com/v1/accounts', {
      method: 'POST',
      headers: {
        authorization: `Bearer ${accessToken}`,
        'X-API-Key': process.env.CLIENT_ID
      }
    });
    const account = await accountResult.json();
    accounts.push(account);
  }
  return accounts;
}