Testing Blockchain Transactions with Cryptocurrency

This is a guest post by Dee Ann Pizzica.

Blockchain technology is becoming increasingly prevalent in software development. But testing on blockchains presents an interesting set of constraints. Not all cryptocurrency test scenarios are the same; each wallet and exchange will provide different services and features.

If you’re new to blockchain or you’re curious about crypto, this is a beginner’s introduction to some of the basic domain knowledge for testing blockchain transactions in a cryptocurrency wallet.

What makes blockchain different

In order to understand why testing blockchain data is different from testing in a centralized database, let’s begin with a little bit about what a blockchain is and how it works.

Blockchain data is decentralized. Blockchains rely on data being verified by a number of different sources controlled by different entities, instead of a central repository. This means that no one entity is responsible for maintaining the information. Information is confirmed by multiple disparate sources, and each piece of information builds on the previous one.

In the case of Bitcoin, the trailblazing and most well-known use of blockchain technology, this information consists of transactions of digital currency. The blockchain is a ledger of transactions detailing how currency has moved from one address to another, with multiple versions being updated simultaneously and continuously by multiple parties. Once transactions are confirmed and verified by multiple sources, you have an immutable source of information that cannot be changed or hacked.

When testing digital currency transactions on a blockchain, there are some important constraints:

  • You cannot manipulate or change data to create certain outcomes
  • There are limited options for testing without real assets
  • It’s difficult to control the timing of your transactions

Let’s examine some of the challenges these constraints present for the tester examining a digital wallet, as well as some of the details specific to digital currency that testers should verify.

Modern Test Case Management Software for QA and Development Teams

When data manipulation isn’t possible

The ability to manipulate the data on a staging server in order to create situations needed for testing is a powerful tool testers often use. At times you need a bunch of accounts created. Other times you need to manufacture an error where a certain field received malformed data or an unexpected null. Whatever the case may be, if your organization has access to a development version of a database, you can probably make that happen. When you’re testing on a public blockchain, however, you have no control over where crucial transaction data is sourced or stored.

If you’re in a situation where you need to see how well a wallet with 500 bitcoin (BTC) transactions over the course of three years loads in your production wallet, you can’t just insert a bunch of rows into the database and backdate them. To create transactions on the public blockchain, you need to transact in real-time.

It helps to catalog a number of wallets that fit different scenarios you may need. At any given time you may need a wallet with a certain amount of total funds, a specific creation date, or a configuration of assets.

Funding your tests: real and test transactions

When you have the choice, it’s nice to test with fake money instead of real money. Each blockchain has its own nuances, so let’s focus on bitcoin for this part of the discussion.

There are two separate bitcoin blockchains to consider: the mainnet chain and the testnet chain. The mainnet chain is the real bitcoin chain. Transactions here utilize the genuine digital currency. Testnet transactions function in the same way, except these are test currency and are never supposed to have any value.

Addresses on testnet are different from those on mainnet. This prevents attempts to send testnet funds to the mainnet blockchain.

Testnet can be a great way to test transactions. You can send as much as you want, and there’s no real cost to your organization. You still need to get the funds, though. One of the easiest ways to acquire testnet funds is to use a faucet. Faucets are websites set up by other Bitcoin developers with funds that can be shared.

There are drawbacks and limitations to using testnet, however. Not all currencies have a testnet set up, and not all companies have features that are pointed to a testnet environment.

Timing is everything

Something else you really can’t control is timing. When you’re setting up tests for blockchain transactions, you may need to be prepared to wait. Block confirmations take time. There are techniques to improve the chances that your transaction will process more quickly, but there’s nothing that will guarantee that process will be fast.

Sometimes the network is congested, especially in times of high volatility. The more transactions processing on the network, the higher the chances that the network will slow down.

One way to try to get your transactions picked up by the network more quickly is to send higher amounts of money. Generally, you’ll be charged a higher fee for sending a larger amount. If you’re trying to send only a few dollars at a time, your transaction is less lucrative than others that may broadcast to the network at the same time, making your transaction less desirable than others competing for confirmations.

Your wallet may allow you to control the fees you assign to your transaction. By paying a higher fee, miners may be more inclined to pick up your transaction sooner.

Of course, sending larger amounts or paying higher fees cuts into your testing budget, and if you need to test several transactions, your balance can disappear quickly. You have to weigh the risk of taking more time against the cost of your test.

Another situation where timing can be a problem is when your wallet syncs directly with the public blockchain. If this is the case, you may be stuck waiting hours for an old restored wallet to sync. Syncing may require your application to run through every confirmed block since your wallet was created, or even to the beginning of the chain you’re working with. Tests that involve a full sync require advanced planning.

What to verify in a crypto wallet transaction

Now that you’re set up and thinking more about testing on the blockchain, you have to make sure everything is working correctly. But what exactly do you need to look at in order to test a transaction? When you’re new to crypto, this can be a little overwhelming.

One tool that will be invaluable to you as a tester is a good block explorer. A block explorer is a website that allows you to search for transactions on the blockchain. You can search and quickly find a number of reliable options; many are set up for a variety of blockchains. Blockchair.com is one I use frequently.

Because we’re looking at public blockchains like Bitcoin or Ethereum, any transactions are searchable in the block explorer. In order to search the blockchain, you can enter the addresses of the sending wallet or the receiving wallet, or you can search by transaction hash, a long string of alphanumeric characters that serves as the unique identifier for the transaction.

When you’re testing a cryptocurrency transaction, you’ll be cross-checking several data points against the broadcast to the network. That information will be available to you in the block explorer. Here are five of the main aspects you should be looking to verify.

Cryptocurrency addresses

Crypto investors have the ability to transact with anonymity. Your crypto address is created by the wallet and tied to a private key that is stored on your device. Your address is available publicly but not tied to any of your personal identifying information.

Your address is often a long string of alphanumeric characters that would be exceedingly difficult to memorize. Depending on the configuration of the blockchain you’re working on, there will be unique rules for addresses.

On some networks, your address remains static no matter how many times you transact. However, on the Bitcoin network, addresses are intended to be for a single-use. In order to maintain user privacy, every time a transaction is created and funds are transferred from an address, new addresses are created automatically by most wallets.

Say you have two wallets, Wallet A and Wallet B. Wallet A has an address that holds .5 BTC. You send .2 BTC from Wallet A to Wallet B. When the transaction completes, new addresses will be created for the remaining .3 bitcoin in Wallet A, as well as the received .2 bitcoin in Wallet B.

Transaction accuracy

There are a number of things to test to ensure your transaction has been registered properly on the blockchain and with the expected receive destination. We verify transactions in three locations: the sending wallet, the receiving wallet, and on the blockchain.

When you’re testing a wallet tool, one of the core features that must be perfect every time is that money consistently moves from one location to the other and that the amounts are exactly what you expected at every step of the process. You will be able to check the block explorer for the exact amount of crypto included in the transacting addresses.

In addition to searching for transactions by address, you can also search by transaction hash.

Block confirmations

Blockchain transactions need to be confirmed before they can be finalized. Some wallets may have rules about when to display a transaction as pending or completed, based on the number of block confirmations.

You can also use the block explorer to view the number of confirmations on any transaction. As the number grows, it indicates more independent sources have agreed that your transaction occurred and is valid on the blockchain. You’ll want to ensure that the number of confirmations from the network matches the number displayed in your wallet. You may want to verify the number of confirmations as well as the actual block number that your transaction was confirmed in.

Block confirmations are especially important for those who hold cryptocurrency because you cannot spend your funds until they have been confirmed.

Memos or tags

Other key pieces of information, such as memos or tags, are important for certain tokens. For example, Ripple’s digital currency, XRP, uses a destination tag with transactions. This identifier helps ensure that transactions on the XRP blockchain are routed correctly.

Fees or gas

Each digital currency has its own rules and fee structure. We talked a little bit about Bitcoin fees earlier, so this time let’s look at fees on the Ethereum network. The Ethereum blockchain has a number of currencies that can be exchanged, called ERC20 tokens. Unlike Bitcoin, whose fees are paid in bitcoin, any fees on the Ethereum blockchain are paid in ethereum, instead of the token you are sending.

The ethereum fee that you pay to transact is called gas. This can be confusing for people who are new to cryptocurrency and the Ethereum network. When you set up your test to transact with an ERC20 token, you’ll need to make sure that you hold some ethereum before you attempt to send any money.

Keep learning

Like any new domain, blockchain presents a seemingly never-ending place to learn and explore. On the surface, some aspects of this technology are easy to understand, but things get complex very quickly. Learn as much as you can about all the rules of any given chain. It can be overwhelming at first, but there are a wealth of online sources.

Once you dedicate some time to understanding how blockchains and digital currencies operate, you can overcome the inherent constraints that keep you from using some of the testing techniques you normally would have in the past. Not only will you be able to effectively test the basics of cryptocurrency transactions, but you can also work your way up into many more exciting user scenarios and challenge yourself in new ways. Learn more about cryptocurrencies and compare different wallet options and learn how to choose the best one for your cryptoassets.


Dee Ann is a passionate and curious software tester. She has over 15 years of experience in support of small and enterprise-scale custom mobile and web applications with highly complex business logic for clients across a wide variety of industries. Dee Ann is currently working as the Director of Engineering at BRD where she collaborates with a talented team on a cryptocurrency wallet app for iOS & Android.

In This Article:

Sign up for our newsletter

Share this article

Other Blogs

General, Agile, Software Quality

How to Identify, Fix, and Prevent Flaky Tests

In the dynamic world of software testing, flaky tests are like unwelcome ghosts in the machine—appearing and disappearing unpredictably and undermining the reliability of your testing suite.  Flaky tests are inconsistent—passing at times and failin...

General, Continuous Delivery

What is Continuous Testing in DevOps? (Strategy + Tools)

Continuous delivery is necessary for agile development, and that cannot happen without having continuity in testing practices, too.Continuous delivery is necessary for agile development, and that cannot happen without having continuity in testing practices,...

General, Business, Software Quality

DevOps Testing Culture: Top 5 Mistakes to Avoid When Building Quality Throughout the SDLC

Building QA into your SDLC is key to delivering quality. Here are the mistakes to avoid when building quality throughout the SDLC.