Ethereum

ETH Transfers

Transfers Stream represents all possible native cryptocurrency (ETH) transfers with positive (> 0) value, which can be either
  • a Message Call in an Ethereum Transaction from Externally Owned Account (EOA) (where User owns the private keys and controls it) to other EOA or Contract Account (CA) (which contains EVM code and is controlled by it)
  • an Inner Message Call (Blockchain explorers often refer to it as Internal Transaction) from CA to other CA or EOA

Details

Stream type
1
{
2
action_type: string,
3
parent_block_hash: string,
4
block_hash: string,
5
block_number: int256,
6
block_timestamp: int256,
7
tx_index: int256,
8
action_pattern: string,
9
code_address: address'eth',
10
from: address'eth',
11
gas: int256,
12
gas_price: int256,
13
gas_used: int256,
14
input_data: string,
15
origin: address,
16
output_data: string,
17
params_type: string,
18
reward_type: string,
19
to: address'eth',
20
value: int256,
21
tx_hash: string,
22
sender_balance_before: int256,
23
sender_balance_after: int256,
24
receiver_balance_before: int256,
25
receiver_balance_after: int256,
26
tx_type: int256,
27
gas_tip_cap: int256,
28
gas_fee_cap: int256,
29
tx_fee_savings: int256
30
}
Copied!
action_type - the action type of a Transfer
parent_block_hash - the parent block's hash
block_hash - the current block's hash
block_number - the current block's number
block_timestamp - the current block's timestamp (in seconds since the epoch according to UNIX Time)
tx_index - the current transaction's index in the block
action_pattern - Ethereum's action pattern, where possible values are:
  • Call
  • Reward
  • TokenTransfer
  • Deployment
  • Suicide
  • Log
code_address - address of currently executed code (Smart Contract)
from - the address that initiated the Transfer
gas - gas limit set for the underlying Transaction
gas_price - gas price for each unit of gas (in wei)
gas_used - the amount of gas used for this Transfer
input_data - hex represented byte data of the input (message) for the message call
In case there is no message provided (in case of a simple straightforward crypto value transaction), the input_data is equal to β€œ0x”
origin - the address that initiated the Transfer by signing and syncing to the network the transaction that contains it
output_data - hex represented byte data of the execution result
In case there is no execution result for the message call, the output_data is equal to β€œ0x”
params_type - not supported
reward_type - not supported
to - the recipient address of the Transfer
value - value of the transfer (in wei)
The value of Transfer is always > 0
sender_balance_before - senders balance before transaction happened (in wei)
sender_balance_after - senders balance after transaction happened (in wei)
receiver_balance_before - receivers balance before transaction happened (in wei)
sender_balance_after - receivers balance after transaction happened (in wei)
tx_type - Reflects transaction type, 0 for legacy and 2 for the EIP-1559 transaction. block_base_fee_per_gas - Base fee per gas for the block of this transaction.
gas_tip_cap - User-set value represents the part of the transaction fee that goes to the miner.
gas_fee_cap - The maximum amount that a user is willing to pay for their transaction (including block_base_fee_per_gas and gas_tip_cap).
tx_fee_savings - Represents transaction fee saved using the following formula: (gas_fee_cap - (block_base_fee_per_gas + gas_tip_cap)) * gas_used.

Code Samples

To monitor every balance change on a particular address
1
stream BalanceChanges
2
from Transfers
3
where @to == ETH.address("0xAddress") || @from == ETH.address("0xAddress")
4
​
5
process
6
emit { @from, @to, @value, @block_timestamp }
7
end
Copied!
​
If ypu want your Smart Trigger to notify you when a withdrawal of more than 0.001 ETH
1
stream BalanceChanges
2
from Transfers
3
where @from == ETH.address("0xAddress")
4
​
5
process
6
if @value >= 100000000000000 then
7
emit { @from, @to, @value, @block_timestamp }
8
end
9
end
Copied!

Token Transfers

TokenTransfers Stream represents all supported Ethereum based Token transfers with positive (> 0) value.

Support

Token Standard
Is supported
ERC-20
​
βœ…
​
ERC-721
​
βœ…
​
ERC-1155
Work in Progress

Details

Stream type
1
{
2
action_type: string,
3
parent_block_hash: string,
4
block_hash: string,
5
block_number: int256,
6
block_timestamp: int256,
7
tx_index: int256,
8
action_pattern: string,
9
code_address: address'eth',
10
from: address'eth',
11
gas: int256,
12
gas_price: int256,
13
gas_used: int256,
14
input_data: string,
15
origin: address,
16
output_data: string,
17
params_type: string,
18
reward_type: string,
19
to: address'eth',
20
value: int256,
21
tx_hash: string,
22
verified: boolean,
23
erc20: {
24
name: string,
25
decimals: int256,
26
symbol: string,
27
value: int256
28
},
29
is_erc721: boolean,
30
is_erc20: boolean,
31
erc721: {
32
name: string,
33
token_id: int256,
34
symbol: string
35
}
36
}
Copied!

Code Samples

To monitor ERC20 tokens transfers on one address
Every ERC20 token
One Specific ERC20 token
1
stream BalanceChanges
2
from TokenTransfers
3
where @to == ETH.address("0xAddress")
4
|| @from == ETH.address("0xAddress")
5
​
6
process
7
​
8
let decimals = @erc20.decimals
9
let symbol = @erc20.symbol
10
emit {@from, @to, @value, decimals, symbol}
11
12
end
Copied!
1
stream BalanceChanges
2
from TokenTransfers
3
where @to == ETH.address("0xAddress")
4
|| @from == ETH.address("0xAddress")
5
​
6
process
7
​
8
let decimals = @erc20.decimals
9
let symbol = @erc20.symbol
10
11
if @erc20.symbol == "TEST" then
12
emit {@from, @to, @value, decimals, symbol}
13
end
14
15
end
Copied!
To monitor transfers of ERC721 (NFTs) tokens on one address
1
stream _
2
from TokenTransfers
3
where @to == 0xAddress || @from == 0xAddress
4
&& @is_erc721
5
process
6
​
7
let tokenName = @erc721.name
8
emit {@to, @from, tokenName}
9
10
end
Copied!
You can also get more info about NFT deals on OpenSea, such as last sale, statistics and more, by using our OpenSea API wrapper functions​
To monitor transfers of ERC721 (NFTs) tokens within one contract (collection)
Every NFT
One Specific NFT
1
stream _
2
from TokenTransfers
3
where @code_address == 0xContractAddress
4
&& @is_erc721
5
process
6
​
7
let tokenName = @erc721.name
8
emit {@to, @from, tokenName}
9
10
end
Copied!
1
stream _
2
from TokenTransfers
3
where @code_address == 0xContractAddress
4
&& @is_erc721
5
&& @erc721.token_id == TokenID
6
process
7
​
8
let tokenName = @erc721.name
9
emit {@to, @from, tokenName}
10
11
end
Copied!
Last modified 10d ago