The Upvest Blockchain API

A multi-protocol blockchain API for building blockchain-interacting applications.

Get Started     Tutorial     API Reference

Javascript Quickstart

Create a wallet on Ethereum Ropsten

This quickstart tutorial will give you a taste of what is possible using the Upvest Blockchain API.
We will take a look at the basic functionality of creating a wallet on the Ethereum Ropsten Blockchain.

Step 1: Create an Upvest account and obtain your API keys

In order to obtain your API credentials you must create an account with Upvest.


Step 2: Install a client library in order to interact with the Upvest API

Please make sure you have the most recent Node version installed and continue installing the Upvest client library via your terminal:

npm i @upvest/tenancy-api


Step 3: Create your first Upvest User

To create a User you must use API Key authentication. API Key authenticated requests are made easy using the UpvestTenancyAPI class.
Insert your API credentials obtained in Step 1 into the code example below:

const { UpvestTenancyAPI } = require('@upvest/tenancy-api');
const tenancy = new UpvestTenancyAPI(
  'https://api-playground.eu.upvest.co/1.0/',
  'YOUR_API_KEY',
  'YOUR_API_SECRET',
  'YOUR_API_PASSPHRASE',
);

Using the UpvestTenancyAPI class, go ahead and create a User under your Tenancy:

const username = 'username';
const password = 'password';

(async () => {
  try {
    const user = await tenancy.users.create(username, password);
    const recoveryKit = user.recoverykit;
    console.log(recoveryKit);
  } catch (err) {
    err.response.status === 409 && console.log("User with this name is already exists");
  }
})();

The user.recoveryKit property now contains the recovery kit of the User as an SVG.
This is the information the user needs present to the tenant in order to reset a forgotten password.

Step 4: Create an Ethereum Wallet for the User

The user owns his wallets, so to create an instance of the Wallet class the request needs to be authenticated using OAuth.
These OAuth requests are made easy by using the UpvestClienteleAPI class.
In this step, the client credentials can be found on the dashboard from Step 1 and the specific user's username and password are required too.

npm i @upvest/clientele-api
const { UpvestClienteleAPI } = require('@upvest/clientele-api');
const clientele = new UpvestClienteleAPI(
  'https://api-playground.eu.upvest.co/1.0/',  
  'YOUR_CLIENT_ID',
  'YOUR_CLIENT_SECRET',
  'username',
  'password',
);

Creating a Wallet requires the password as well as an assetId.
In this tutorial we are providing you with the assetId of Ethereum Ropsten, one of Ethereum's public testnets.
Nevertheless, you can see and try out other assetIds by querying the Asset API.

const ASSET_ID = 'deaaa6bf-d944-57fa-8ec4-2dd45d1f5d3f';
(async () => {
  try {
    const ethereumWallet = await clientele.wallets.create(ASSET_ID, 'password');
    console.log(ethereumWallet);
  } catch (err) {}
})();

To see the newly created wallet on Ethereum Ropsten, retrieve the wallet address:

(async () => {
  try {
    const allWalletsGenerator = clientele.wallets.list();
    const allWallets = await allWalletsGenerator.next();
    console.log(allWallets.value.address);
  } catch (err) {}
})();

The wallets.list() function is returning a list of Wallets, as there can be multiple Wallets related to one User.


Step 5: Send a transaction

Finally, let’s transfer some Ether to the user’s wallet, so we can transfer some assets between our users.
Go to the Ropsten Faucet, enter the user's wallet address in the testnet account address input field and click the “Send me test Ether” button.
After the wallet is funded with some Ether on the Ropsten testnet, we will be able to send our first transaction.

(async () => {
  try {
    // Retrieve the walletId
    const allWalletsGenerator = clientele.wallets.list();
    const allWallets = await allWalletsGenerator.next();
    const walletId = allWallets.value.id;
    const amount = 100000000000000000; // 0.1 ETH * 10^18 = 100000000000000000 WEI
    const fee = 4000000000000000; // 0.004 ETH * 10^18 = 4000000000000000 WEI

    // Send the transaction
    const recipient = '0x05b3Ca5e520583e3BBfb4DdDf5bd212CB19b2169';
    const transaction = await clientele.transactions.create(
      walletId,
      password,
      recipient,
      ASSET_ID,
      amount,
      fee
    );
    const transactionHash = transaction.txhash;
    console.log(`https://ropsten.etherscan.io/tx/${transactionHash}`);
  } catch (err) {}
})();

With the transaction hash you are now able to check out your transaction on https://ropsten.etherscan.io/tx/<transactionHash>.


Congrats! You successfully finished the Quickstart Python Tutorial!
From here you can further explore the API endpoints.
In case of any questions your are welcome to contact us.

Javascript Quickstart


Create a wallet on Ethereum Ropsten

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.