How do I #Buidl an Ethereum Lite Wallet? — Tutorial Part 1

Trevor Clarke
amberdata
Published in
3 min readMar 27, 2019

Starting to learn blockchain development? Let’s building a simple wallet that reads current account balance and transactions.

TLDR; You can build a lite wallet in less than 15 minutes, but you can view it in less than 1 minute. See this demo for your address →

Tutorial: Getting Account Balance & Transactions

We’re going to build a simple Ethereum wallet utilizing two data sets:

  1. Current Balance — The latest Ether amount for an account
  2. Address Transactions — Historical transactions for an account

What kind of super powers does this give me?

  • Instantly view any address balance on Ethereum without a third party
  • No need to run or sync a node or client
  • Integrate into a dApp you are building without a fuss

Tutorial: Overview

Let’s get started in a few steps:
0. Get an Amberdata API key, to make calls to gas data endpoints
1. Call the first endpoint: Account Balance
2. Call the second endpoint: Transaction History

Step 0: Get a Free Amberdata API Key

Go to Amberdata.io, and click “Get Started” to get a Free Developer API Key. You will need this to access the data in the next steps.

View the current Account Balance

Step 1: Get Account Balance

Using Axios & Amberdata API it is easy to request an Ethereum address balance. See the following snippet:

From the response above, there are a couple key data items:
1. “blockNumber” — This is the latest number of the blockchain, the block checkpoint that returned the address balance.
2. “timestamp” — Epoch timestamp using UTC, including Nanoseconds if the blockchain supports it. (In this example, Ethereum does not.)
3. “value” — The Ether amount the address owns. This is the balance amount the address owner spend or HODL.

View Transaction History

Step 2: Get Transaction History

Using a similar request as account balance, let’s get the address transaction history:

Each transaction is returned in the “records” array. In the snippet above, the “value” key is the Ether amount transacted (sent or received). You could even use the value field to generate a chart!

Step 3: Testing & Fun

Here are some fun addresses to test, each containing very different return values! Can you guess which address is CryptoKitties?

  • 0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98
  • 0x06012c8cf97bead5deae237070f9587f8e7a266d
  • 0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c
  • 0x744d70fdbe2ba4cf95131626614a1763df805b9e

All Done!

Time to add an Ethereum wallet to your dApp or project! If you integrate, send us a link and we’ll showcase your integration!

This is just one of many ways to build using the Amberdata API. In the coming weeks we will be sharing more tutorials, stay tuned!

That’s it for this tutorial, share with colleagues, friends and on social!
We’d love to hear your thoughts in the comments below.

Previous Tutorial:

For more information about Amberdata.io:

--

--

Trevor Clarke
amberdata

VP of Product - Amberdata.io, Passionate Software Engineer 🤓, Hobbyist in 3D Design & Robotics