A Byte of Blockchain - Week 46
Transaction Data & Value

A Byte of Blockchain - Week 46 Transaction Data & Value


5 min read


Last week we discussed Digital signatures & their importance in linking the underlying cryptocurrencies with their wallets & owners.

Why do we need digital signatures? - Digital signatures prove :

a. Ownership

b. Integrity &

c. Non - Repudiation

We then discussed signature creation & verification at a high level.

This week, let us discuss Value & Data in the context of an Ethereum transaction. Transactions can have

a. Value & Data

b. Only Value

c. Only Data &

d. Neither Value nor Data

When there is only VALUE, that transaction is a PAYMENT.

When there is only DATA, that transaction is an INVOCATION.

When there is both VALUE & DATA, that transaction is both a PAYMENT & INVOCATION.

We know what PAYMENT means, what is INVOCATION ? what is being called or invoked? Let us explore further.

Transaction Value

In very simple terms, we initiate transactions to settle payments. That means we pay someone an amount.

Transaction value is nothing but the amount of Ether that we intend to send through a transaction. The below visualization makes it more clear:

Transaction Components.jpg

Let us understand the other component in an Ethereum transaction called DATA.


Before we get into data field in a transaction, let us understand

Why do we need a data field in a transaction? Wouldn't a transaction ID, originator ID, value & beneficiary ID be sufficient?

In any normal transaction, the transaction value or amount is key. This is applicable in the case of a funds transfer between two Externally Owned Accounts (EoAs). However, not all transactions are payment transactions in Ethereum. In some cases, a transaction interacts with something known as smart contracts. Smart contracts are nothing but code which does some activities in the Ethereum Blockchain depending on the code logic.

So the value in this data field of the transaction calls that portion of the code in the smart contract & executes the code. Sounds complicated?

Let us take a step back & understand something called "function" in a programming language (below example is in python).

A Function is a few lines of code in a program which does one or more activities specified in those lines of code. The below example function only prints "I love Blockchain!!".

There are steps when creating & using a function.

Step 1 - Define the function

def print_name():
      print("I love Blockchain!!")

Step 2 - Call the function


Step 3 - Get the output

I love Blockchain!!

Let us explain the above in very simple terms :

We defined a function whose sole work is only to print "I love Blockchain!!". Whenever we want to print this statement, we "call" this function at any point in our program.

Now imagine a program of 1000s or even tens of thousands of lines of code where we have to print "I love Blockchain!!" at different points in the program. Do we write the above code at different places in the program? That doesn't sound very efficient & what if we want to change the logic later ? This means we have to remember where all we have written these lines amongst thousands of other lines in the code.

This is extremely inefficient, difficult and prone to error. So, what do we do?

We "outsource" the above lines of code to something called a Function. This function will contain only the above lines of code. They do nothing but print "I love Blockchain!!".

So, whenever we want to print the above at any point in the program, we "call" this function by calling its name which in our example is print_name()


Output will be as below :

I love Blockchain!!

So, all we need to do is define a function for what we expect that part of the program to do & put it in one place. We then call this function from any part of the program & get the required output. Functions help organize programs so that there is no repetition of code.

To make it more clear, let us visualize it as below :


Now, let us take it one step further. We saw that the above function prints a sentence. What if we want to to add two numbers?

Let us see our function again :


The above function only prints a sentence & hence does not require any input. Hence, the parenthesis is empty. But if the function is expected to add two numbers, then we need to provide these two numbers to the function & the way it is done is by inputting the numbers as parameters or arguments in the parenthesis.

The function to add two numbers will be as follows :

add_numbers(num1, num2)

So, the value of num1 & num2 will be accessible inside the function to be used. num1 & num2 are called arguments.

Let us write a proper function (called "add_numbers") for adding two numbers.

def add_numbers(num1, num2):
    return num1 + num2

The return command returns the output of the function to the part of the program calling it which means it returns the answer back.

Let us call the above add function using the below command :


The output will be :


num1 & num2 can be anything what we define in our function call. For example :


The output will be :


Just like any part of a code can access a function by calling that function, the data in the transaction field can call or invoke the relevant section of the code in a smart contract & then execute the smart contract accordingly.


If we go to etherscan.io, we can see transactions with their relevant fields. A sample is shown below for reference :