The Upvest Blockchain API

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

Get Started     Tutorial     API Reference

Python 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

  • The library is published on PyPi
  • The source code is on GitHub

Please make sure you have Python version 3.0 or higher installed locally or in your venv, and continue installing the Upvest client library via your terminal:

pip install upvest


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:

from upvest.tenancy import UpvestTenancyAPI
tenancy = UpvestTenancyAPI('YOUR_API_KEY', 'YOUR_API_SECRET', 'YOUR_API_PASSPHRASE')

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

user = tenancy.users.create('username', 'password')
recovery_kit = user.recovery_kit
print(recovery_kit)

The user.recovery_kit 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.

from upvest.clientele import UpvestClienteleAPI
clientele = UpvestClienteleAPI('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', 'username', 'password')

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

asset_id = 'deaaa6bf-d944-57fa-8ec4-2dd45d1f5d3f'
ethereum_wallet = clientele.wallets.create(asset_id, 'password')

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

all_wallets = clientele.wallets.all()
wallet_address = all_wallets[0].address
print(wallet_address)

The wallets.all() 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.

# Retrieve the wallet
all_wallets = clientele.wallets.all()
wallet = all_wallets[0]
recipient = '0x05b3Ca5e520583e3BBfb4DdDf5bd212CB19b2169'
asset_id = 'deaaa6bf-d944-57fa-8ec4-2dd45d1f5d3f'

# Send the transaction
transaction = wallet.transactions.create('password', asset_id, 100000000000000000, 4000000000000000, recipient)
transaction_hash = transaction.txhash
print(f'https://ropsten.etherscan.io/tx/{transaction_hash}')

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


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.

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