Search…
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
{
from: address'bsc',
to: address'bsc',
value: int256,
op: string,
transaction: {
gasUsed: int256,
gasLimit: int256,
gasPrice: int256,
fee: int256,
origin: address'bsc',
nonce: int256,
index: int256,
hash: string,
blockHash: string,
balanceChange: {
senderBalanceBefore: int256,
senderBalanceAfter: int256,
receiverBalanceBefore: int256,
receiverBalanceAfter: int256,
}
},
block: {
number: int256,
hash: string,
parentHash: string,
coinbase: address'bsc',
difficulty: int256,
timestamp: int256,
header: {
gasUsed: int256,
nonce: int256,
sha3Uncles: string,
extraData: string,
mixHash: string,
stateRoot: string,
logsBloom: string,
transactionsRoot: string,
receiptsRoot: string
},
rewards: {
value: {
beneficiary: address'bsc',
reward: int256
}
}
}
}

Code Samples

Simple code to monitor every native transfer on one address
stream _
from BscTransfers
where @to == BSC.address("0xAddress")
|| @from == BSC.address("0xAddress")
process
emit {@to, @from, @value}
end
To receive the balance of native currency on an address, use this code
stream _
from BscTransfers
where @to == BSC.address("0xAddress")
|| @from == BSC.address("0xAddress")
process
let balance = 0
if @from == BSC.address("0xAddress") then
balance = @transaction.balanceChange.senderBalanceAfter
else
balance = @transaction.balanceChange.receiverBalanceAfter
end
emit {@to, @from, @value, balance}
end

BEP20 Transfers

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

Details

Stream type
{
from: address,
to: address,
value: int256,
token: {
verified: boolean,
name: string,
symbol: string,
contract: address,
decimals: int256
},
transaction: {
gasUsed: int256,
gasLimit: int256,
gasPrice: int256,
fee: int256,
origin: address,
nonce: int256,
index: int256,
hash: string,
blockHash: string
},
block: {
number: int256,
hash: string,
parentHash: string,
coinbase: address,
difficulty: int256,
timestamp: int256,
header: {
gasUsed: int256,
nonce: int256,
sha3Uncles: string,
extraData: string,
mixHash: string,
stateRoot: string,
logsBloom: string,
transactionsRoot: string,
receiptsRoot: string
},
rewards: [
{
value: {
beneficiary: address,
reward: int256
}
}
]
}
}
Code Samples
To monitor every BEP20 transfer on an address
stream _
from BscBEP20Transfers
where @to == BSC.address("0xAddress")
|| @from == BSC.address("0xAddress")
process
let tokenName = @token.name
let decimals = @token.decimals
let symbol = @token.symbol
emit {@to, @from, @value, decimals, symbol}
end
To receive notification only when there is a transfer of more than 10 TEST coins, which have 8 decimals
stream _
from BscBEP20Transfers
where @to == BSC.address("0xAddress")
|| @from == BSC.address("0xAddress")
process
let tokenName = @token.name
let decimals = @token.decimals
let symbol = @token.symbol
if tokenName == "TEST" && @value >= 1000000000 then
emit {@to, @from, @value, decimals, symbol}
end
end

Other Tokens Support

Token Standard
Is supported
BEP-20
ERC-721
Work in Progress
Last modified 8mo ago