How can I quantify how much storage space (approximately) do I need for Ethereum transactions? Is it per function/ transaction or how is it calculated? any leads on this is appreciated. I am trying to quantify the storage space needed for the transactions created by my smart contract...
data
field size(when you're sending a transaction calling a smart contract function)
The data
field value could be divided into three parts:
0x
transfer(address,uint256)
=> a9059cbb
The easiest way is to use a library that calculates the size for you. :) For example web3js
function encodeFunctionCall().
Example:
const result = web3.eth.abi.encodeFunctionCall({
name: 'transfer',
type: 'function',
inputs: [{
type: 'address',
name: ''
},{
type: 'uint256',
name: ''
}]
}, ['0x1231231231231231231231231231231231231231', '1']);
console.log(result);
Returns
0xa9059cbb00000000000000000000000012312312312312312312312312312312312312310000000000000000000000000000000000000000000000000000000000000001
a9059cbb
is the function signature0000000000000000000000001231231231231231231231231231231231231231
is the address
type (256bit, 64 hex chars) first argument0000000000000000000000000000000000000000000000000000000000000001
is the uint256
type (256bit, 64 hex chars) second argumentSo the result is 0x
and 136 hex characters, which makes 68 bytes.