User Account in Bitcoin, Ethereum and IOTA

In cryptocurrency systems like Bitcoin, Ethereum and IOTA, user is represented by user account. Each user account has address(es) and the balance associated to the address. Different systems handle address and balance differently. In this article I try to put them together.

This article by no means provides any investment recommendation. I first examine Bitcoin user account, how address is created and balance is calculated. Later in Ethereum and IOTA we can easily make comparison from this relatively mature system.

While these systems come with intuitive Graphical User Interface (GUI), I use command line interface (CLI) or any equivalent to explore the account detail. CLI always brings better information than “canned” GUI.

Private Key, Public Key and Address

We need first to give some quick introduction on these three concepts, as they are in almost all cryptocurrency systems.

Private Key: It is the key user needs to keep secret. The private key is used to sign message. Only the private key owner can make such signature and this signature is verifiable by others. In cryptocurrency system, by signing a transaction the user unlocks a record and can use the fund.

Public Key: It is another part of key, and can be visible to others. Public key is generated mathematically from a private key, and therefore they are always in pair. There is no way to generate “back” the private key from public key. In cryptocurrency systems, in general, a fund is locked by public key and only its corresponding private key can unlock and then use the fund.

Address: It is the contact point in cryptocurrency systems. Every user is represented by an address (or by several addresses). Account balance is always associated in address. Address is again mathematically related to either public key (e.g. Bitcoin and Ethereum) or private key (e.g. IOTA).

A Quick Summary


Bitcoin is a payment system with native currency bitcoin. It provides a simple way for sending and receiving bitcoins among users.

Bitcoin is of the longest history among the three systems. It is recognized as the first large-scale implementation of distributed ledger using blockchain technology. The Bitcoin system (or network) keeps running since 2009 without major issues.

Bitcoin Address

Bitcoin address begins with private key, a 256-bit random number. The public key and address are derived from the private key.

A simplified flow of Bitcoin address generation is shown below.

It is always a one-to-one mapping from private key to public key and then to Bitcoin address. In Bitcoin wallets, one can generate numerous Bitcoin addresses, each of which has a corresponding private key. There is no direct relationship among these private-key-address pairs, and no way to associate any private-key-address pair to any individual wallet (and user), unless some external mechanism is added. At least Bitcoin does not require so.

Here I am using Bitcoin Testnet for exploration. I have downloaded the bitcoin core (Bitcoin-Qt) wallet and a bitcoin.conf sample with some values modified for my demo.

With this, we can safely start the Bitcoin-Qt from Application folder. You can see Testnet is used and the icon is green in colour (It is orange for the real Bitcoin network).

If it is the first time, the full Testnet blockchain is to be downloaded. Luckily it is not as big as the real Bitcoin blockchain and it takes me several hours to download it completely (see the tick sign on the bottom right corner).

As mentioned above, I am using the command line to interact with these systems. Here I install the bitcoin-cli.

When using command line, add -t or --testnet to specify Testnet.

To get basic information, use this command,

To get the address list of my wallet (my account name is blank) use this command

These are several address currently in my wallet. As said before we can generate numerous addresses in this wallet. This is done with this command,

Now we see a new address mrg…c7R is generated.

Bitcoin-cli allows you to get back the private key from the address. But this does not mean that the private key is derived from the address. Instead, bitcoin-cli returns the private key that generates the address in this wallet. You can try to use this command with the public keys shown above and find no way to get back my private key.


In Bitcoin blockchain, there are records of unspent transaction which is “locked” by an user’s address. Only the owner of the private key, from which that address is derived, can “unlock” them and use the fund in the records.

The records are called Unspent Transaction Outputs (UTXO). It is called “output” because UTXO is always an output of a previous transaction. If someone has sent me an amount of bitcoin to my Bitcoin address, it will become a UTXO in the blockchain. After I spend that amount of bitcoin, this UTXO will be “spent” and no longer “unspent”, i.e., no longer a UTXO.

My wallet keeps track the UTXO that match my addresses from the blockchain, and reports those belonging to me. We use this command to inspect the UTXO.

Here we see two UTXO, which means these amount can be spent by my wallet as my wallet holds the private key corresponding to the addresses n21…JDH and mt8…Tyf. Each is 1.3 bitcoin in amount and was sent by someone before. Those addresses not shown here means no UTXO are found in them .

To show the total balance of my wallet, we can use

The total amount is correct: 2.6 Bitcoin, summation of the two UTXO found before.

Now we move forward to Ethereum, another blockchain-based cryptocurrency which is very close to how Bitcoin is implemented.


Ethereum is a smart contract platform enabling distributed application (DApp). Its native cryptocurrency “ether” is used for deploying smart contracts and accessing DApp through executing functions in the smart contracts.

The ledger in Ethereum is also implemented in blockchain technology, and therefore we see much similarity between Ethereum and Bitcoin. There are other important aspects on Ethereum but in this article we just focus on the address and the balance.

Ethereum Address

Ethereum comes with two types of account: Externally Owned Account (EOA) and Contract Account. Here we talk about EOA, that is, the account is owned by an user externally.

Ethereum address also begins with private key, a 256-bit random number. The public key and account address are derived from private key.

A simplified flow of Ethereum account generation is shown here.

Similar to Bitcoin, it is also a one-to-one mapping from private key to public key and then to Ethereum address.

Private key is encrypted with passphrase and stored in a key file in JSON format. When address is created, a passphrase is required. Later whenever we send ether to other addresses or execute a function in any smart contract, we need to first unlock our account with passphrase.

I use Go Ethereum (geth) and work on a private chain (stored in ~/ethereum/chaindata). Geth is both a command line (like bitcoin-cli) and a console. When creating an account, a subdirectory keystore is created if it does not exist before. This keystore subdirectory keeps the account information.

Note that the account generated by geth can be used in all Ethereum networks, no matter whether it is the mainnet, testnet, or private ethereum chain. Also this account generation does not require live ethereum blockchain. It can be generated offline.

To create a new account, we can use the following method.

The file name of each file is composed of the time (in UTC) when the account is created, and the public address of this account (20 bytes = 160 bits). This file contains all information about that account.

Here is the content of that file in better JSON format. We will not see the private key as it is properly encrypted.


In Ethereum system, the balance of an account is a state for that account. The balance is obtained from the state and the transactions of that account stored in blockchain. This keeps the account state updated.

To see the balance, we need a live blockchain. I run my private blockchain with this.

And in another terminal, attach a console to this private blockchain

Now we are in geth console. Using this command to check account and balance.

We see the four accounts (as as in keystore subdirectory), and the newly created one is accounts[3]. The balance is zero as it is just created. I have some other accounts in my geth client which hold some ether. On accounts[0], we see a large amount of value. It is the amount in wei, the smallest denominator of ethers. We can convert it using a web3 function called web3.fromWei(). Now we see the amount is around ~2884 ethers.

Ethereum is account based. Every transaction is initiated by an account. We can have multiple accounts, each of which can contain certain amount of ether. But when sending transaction or executing a function of smart contracts, we need to specify an account (e.g. main account), in which ether is spent for making that transaction.

We will now move to IOTA, a totally different approach compared to both Bitcoin and Ethereum system.


IOTA is designed for IOT (Internet of Things) and economy of things (e.g. micropayment between machines). As this requires huge scalability and low (or zero) transaction fee, IOTA takes a different approach from blockchain-based ledger technology. The DAG (Directed Acyclic Graph) is the alternative.

IOTA implements DAG, names it Tangle, and promises to remove the transaction fee and address the scalability challenge blockchain systems encounter today. In this article we are focusing on the address and balance handling.

IOTA Address

IOTA address is a deterministic scheme. The scheme begins with a seed and the private-key-address pairs are generated from this seed.

A simplified illustration of IOTA address generation.

Note that IOTA uses ternary system, not our conventional binary system. Instead of using bit (0 and 1) in binary system, ternary system has three “trits”, namely, -1, 0 and 1. We are not deep-diving into this. Just treat “tryte” (like “byte” in binary system) as a character between A-Z and 9 (a 27-character set). We will see how it looks like later in the command line.

Everything begins with the “seed”. The seed is of 81 trytes. By combining a positive integer (key index), a private-key-address pair is generated. The algorithm is fixed, which means that the same key and the same index will always generate the same pair of key and address, no matter who generates this, where and when.

There are various ways to generate the 81-tryte seed. I generate one with MacOS command.

Here is the result.

Let’s copy this seed here as we need to refer this seed later. Note that it is a 81 characters (or 81 trytes to be accurate) from the character set A-Z and 9.

IOTA does not come with command line tools or client, but a Javascript library. Here we will use node console. After loading the library we can issue commands to interact with Tangle.

We are using directory ~/iota_learning/ as my working directory.

We are now in the node terminal.

Note that I’m using IOTA Testnet for my demo. There are several providers for accessing Testnet. In case p102 does not work, you can try p101 or p103.

We now try to use API to get the node information. Here is the api call.

Note that all my iota api call is over-simplified and for demo purpose only. For better coding, we should address the error portion in the call back function.

Here we see the result.

Now we are ready to generate the key based on the seed and the key index. To generate new key, we are using another api.

We vary the index and a different addresses are generated accordingly.

We now have three completely different addresses (note: private keys are not shown here) per key index 0, 1 and 2. They are,

If we generate index 0 again, we will get the same result (see the last command).

Similar to Ethereum, it is purely a client-side address generation.


The balance is associated to individual address. For example, if a seed has generated 3 addresses, and these addresses have been given some iotas before, the balance is the summation of all these three addresses.

Just for illustration purpose,

Here I omit some interesting aspects of IOTA, such as address attachment, zero balance of address, etc.

The balance of individual address is stored in the Tangle. To obtain the balance from the seed, we can use this api call.

I am using another seed which I has some balance for illustration. (Note that I keep the result to a variable accountData, as this is for later inspection. You can directly console log the success as usual.)

Let’s take a look what’s inside the output.

  • latestAddress: this is the next address to those in addresses
  • addresses: used addresses list sequentially, with index from 0.
  • transfers: the information of transactions from and to this seed (wallet)
  • inputs: here is the balance of addresses. Not all addresses have balance. We see addresses indexed 3 and 4 have balance, 100 and 1,400 iotas respectively.
  • balance: total balance of all addresses, which is 1,500 iotas.


We have shown the user account (that is the address and balance) of three different cryptocurrency systems. Bitcoin and Ethereum are blockchain based, and therefore we see some similarity on them. IOTA adopts DAG as their ledger technology, and the handling of address and balance is of a bit difference.

While many are debating which system is superior to another, I don’t see we currently can draw conclusion. Blockchain-based systems have been running for years. IOTA is targeting their shortcoming, but is still under development. We may need some more time before the system is stable and able to demonstrate what they have promised.

Written by

Happy to share what I learn on blockchain. Visit for my works. or reach me on

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store