Binance Smart Chain

BNB Transfers

BscTransfers Stream represents all possible native cryptocurrency (BNB) transfers with positive (> 0) value, which can be either
  • a Message Call in an Binance Smart Chain 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
from: address'bsc',
3
to: address'bsc',
4
value: int256,
5
op: string,
6
transaction: {
7
gasUsed: int256,
8
gasLimit: int256,
9
gasPrice: int256,
10
fee: int256,
11
origin: address'bsc',
12
nonce: int256,
13
index: int256,
14
hash: string,
15
blockHash: string,
16
balanceChange: {
17
senderBalanceBefore: int256,
18
senderBalanceAfter: int256,
19
receiverBalanceBefore: int256,
20
receiverBalanceAfter: int256,
21
}
22
},
23
block: {
24
number: int256,
25
hash: string,
26
parentHash: string,
27
coinbase: address'bsc',
28
difficulty: int256,
29
timestamp: int256,
30
header: {
31
gasUsed: int256,
32
nonce: int256,
33
sha3Uncles: string,
34
extraData: string,
35
mixHash: string,
36
stateRoot: string,
37
logsBloom: string,
38
transactionsRoot: string,
39
receiptsRoot: string
40
},
41
rewards: {
42
value: {
43
beneficiary: address'bsc',
44
reward: int256
45
}
46
}
47
}
48
}
Copied!

Code Samples

Simple code to monitor every native transfer on one address
1
stream _
2
from BscTransfers
3
where @to == BSC.address("0xAddress")
4
|| @from == BSC.address("0xAddress")
5
​
6
process
7
emit {@to, @from, @value}
8
end
Copied!
​
To receive the balance of native currency on an address, use this code
1
stream _
2
from BscTransfers
3
where @to == BSC.address("0xAddress")
4
|| @from == BSC.address("0xAddress")
5
​
6
process
7
8
let balance = 0
9
10
if @from == BSC.address("0xAddress") then
11
balance = @transaction.balanceChange.senderBalanceAfter
12
else
13
balance = @transaction.balanceChange.receiverBalanceAfter
14
end
15
16
emit {@to, @from, @value, balance}
17
18
end
Copied!

BEP20 Transfers

BscBEP20Transfers Stream represents all supported Binance Smart Chain based BEP20 Token transfers with positive (> 0) value.

Details

Stream type
1
{
2
from: address,
3
to: address,
4
value: int256,
5
token: {
6
verified: boolean,
7
name: string,
8
symbol: string,
9
contract: address,
10
decimals: int256
11
},
12
transaction: {
13
gasUsed: int256,
14
gasLimit: int256,
15
gasPrice: int256,
16
fee: int256,
17
origin: address,
18
nonce: int256,
19
index: int256,
20
hash: string,
21
blockHash: string
22
},
23
block: {
24
number: int256,
25
hash: string,
26
parentHash: string,
27
coinbase: address,
28
difficulty: int256,
29
timestamp: int256,
30
header: {
31
gasUsed: int256,
32
nonce: int256,
33
sha3Uncles: string,
34
extraData: string,
35
mixHash: string,
36
stateRoot: string,
37
logsBloom: string,
38
transactionsRoot: string,
39
receiptsRoot: string
40
},
41
rewards: [
42
{
43
value: {
44
beneficiary: address,
45
reward: int256
46
}
47
}
48
]
49
}
50
}
Copied!
Code Samples
To monitor every BEP20 transfer on an address
1
stream _
2
from BscBEP20Transfers
3
where @to == BSC.address("0xAddress")
4
|| @from == BSC.address("0xAddress")
5
​
6
process
7
8
let tokenName = @token.name
9
let decimals = @token.decimals
10
let symbol = @token.symbol
11
12
emit {@to, @from, @value, decimals, symbol}
13
14
end
Copied!
To receive notification only when there is a transfer of more than 10 TEST coins, which have 8 decimals
1
stream _
2
from BscBEP20Transfers
3
where @to == BSC.address("0xAddress")
4
|| @from == BSC.address("0xAddress")
5
​
6
process
7
8
let tokenName = @token.name
9
let decimals = @token.decimals
10
let symbol = @token.symbol
11
12
if tokenName == "TEST" && @value >= 1000000000 then
13
emit {@to, @from, @value, decimals, symbol}
14
end
15
16
end
Copied!

Other Tokens Support

Token Standard
Is supported
BEP-20
​
βœ…
​
ERC-721
Work in Progress
Last modified 10d ago