The Upvest Blockchain API

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

Get Started     Tutorial     API Reference

Transactions and Fees

Learn how to conduct transactions on the blockchain protocols.

You can conduct transactions on any of the supported blockchain protocols. A transaction is technically an atomic event that updates the underlying protocol’s distributed “data store.”

If the word transaction conjures up a financial transaction in your mind, this is appropriate. However, not all blockchains limit their utility to payment transactions. The Ethereum blockchain also stores other kinds of information. For example, it could be a program stored on the Ethereum blockchain that tracks deed ownership to housing properties. The program could revert ownership if the mortgage is overdue, or it could transfer ownership to someone when they turn 18 years old.

Transaction Fees

Miners, which are powerful computers on the network, validate and add transactions to blockchains. The miners spend computing power and electricity in return for a financial reward. Every block (a collection of transactions) added to the blockchain comes with a block reward in addition to the fees sent with the transactions. Miners have a financial incentive to prioritize the validation of transactions with a higher fee attached.

Specifying Amounts

Like other currencies, cryptocurrencies are usually specified as rational number. In computing, however, floating-point arithmetic is arithmetic using a formulaic representation of real numbers as an approximation to support a trade-off between range and precision.

A number is, in general, represented approximately to a fixed number of significant digits (the significand) and scaled using an exponent in some fixed base; the base for the scaling is typically two, ten, or sixteen. A number that can be represented exactly is of the following form:

where significand is an integer, base is an integer greater than or equal to two, and exponent is also an integer. For example:

Floating-Point Accuracy Problems

The fact that floating-point numbers cannot precisely represent all real numbers, and that floating-point operations cannot precisely represent true arithmetic operations, leads to many unexpected situations. This is related to the finite precision with which computers generally represent numbers.

Amounts as Integers

To mitigate the floating-point accuracy problems, we can represent amounts as integers. If we look at the Ether token as an example, it has an exponent of 18. The integer representation of 1 ETH is 1000000000000000000 Wei.

However, as computers have a maximum of representing integers, we pass it as a string.

Here is an example to transfer 0.1 ETH on behalf of a user via the curl command-line HTTP client:

curl -H 'Authorization: Bearer wdNAngDP64kDkYF4DI1ZhQny2Ck6Ej' \
-d 'password=user_password' \
-d 'wallet_id=7166bacb-edf8-4291-bfa3-460a671f123d' \
-d 'asset_id=1e84a803-006a-55b3-9ff8-db46f2dedeca' \
-d 'quantity=100000000000000000' \
-d 'fee=1300000000000000' \
-d 'recipient=0xcde1ff3c0a7e039aeebadc7ce86cee3f2dde262e' \

Transactions and Fees

Learn how to conduct transactions on the blockchain protocols.

Suggested Edits are limited on API Reference Pages

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