Hot answers tagged

14 votes

Binance Smart Chain tokens: What are tTotal, rTotal, tSupply, rSupply, rOwned, tOwned which I see everywhere?

It' a bit of an algorithm, or really just some math, to to the balance of an account. Instead of using the default "tokenSupply". Constants Fee is 1% (assuming no burn, just a general 1% ...
user avatar
  • 183
13 votes
Accepted

How do I get the implementation contract address from the proxy contract address?

Most proxy contracts typically have a public variable defined as a: address public implementation; Which defines the address of the implementation contract. You could then call it as a view function ...
user avatar
11 votes
Accepted

Is there an Infura equivalent for BSC?

If you are looking for a fully managed third party RPC provider for BSC, you can use: Quiknode Ankr If you want complete chain data, you can use their snapshots
user avatar
  • 1,522
10 votes
Accepted

ethers gasLimit gasPrice

Let's break this into two parts, with the caveat that you should look at the second before doing anything about the first. Setting the gasLimit and gasPrice in Ethers Here's the relevant part in the ...
user avatar
  • 1,108
9 votes

Understand price impact and liquidity in pancakeswap

Disclaimer: I don't think this is the correct method to calculate the price impact but it's almost 100% accurate for price impacts of less than 1%. This calculation method assumes that multi-hop is ...
user avatar
  • 156
7 votes
Accepted

Binance Smart Chain RPC Rate Limit

Since these are public endpoints, they are probably monitoring your usage by your IP address. So you can only do 10K requests/5min from your IP. It doesn't matter if you have more applications or ...
user avatar
  • 749
6 votes
Accepted

How to point web3j to other networks such as BSC?

If you are using the smart contact wrapper then you usually need to give one of the available transaction managers as a parameter and then give the chain Id when you initialize it Web3j web3 = Web3j....
user avatar
  • 2,536
5 votes
Accepted

Token Price from pancakeswap

You do not need to go through this hassle, you can use getAmountsOut on the PancakeSwap router contract to make this a lot simpler. You provide a path&amount of the first token in the path to use, ...
user avatar
  • 631
4 votes

How to fork the binance chain?

it's seems ganache-cli suport forking bsc network. ganache-cli -f https://bsc-dataseed.binance.org https://www.reddit.com/r/ethdev/comments/nih0zx/how_to_fork_bsc_mainet/gz3vhex?utm_source=share&...
user avatar
4 votes
Accepted

What is the BNB decimal on BSC

BNB has 18 decimals on Binance Smart Chain (like other EVM native token) and 8 decimals on Binance Chain. Based on your use of ethers, I’m guessing your interacting with BNB on BSC (and therefore use ...
user avatar
4 votes
Accepted

Fail with error 'TransferHelper: TRANSFER_FROM_FAILED' even approved in contract

The issue is that you need to approve the pair and not the router. Looking at the transaction you linked you can see that it revert on the transfer from 0xa89C6f52Ce3Ce1BFF6CAac1E1c98b4f9b3AA5f63 (...
user avatar
  • 3,859
4 votes

Why chi token save 50% and not more?

Gas refund cap is a limitation of the Ethereum protocol. Since London update the 1/2 gas cost refund cap was changed to 1/5 max refund. go-ethereum/params/protocol_params.go - // The Refund Quotient ...
user avatar
  • 2,533
3 votes

tx fee (2.11 ether) exceeds the configured cap (1.00 ether), how to bypass default cap?

The --rpc.txfeecap param on node should be changed to 0: --rpc.txfeecap value Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap) (default: 1) info ...
user avatar
  • 131
3 votes

tx fee (2.11 ether) exceeds the configured cap (1.00 ether), how to bypass default cap?

What is your setup environment? Hardhat? Truffle? Using ethers.js or web3.js? Anyway, I just solved it. I am using Hardhat with ethers.js For the error message: 'ProviderError: exceeds the configured ...
user avatar
  • 1,470
3 votes

Get list of tokens balances from wallet address via web3?

You cannot do this through regular JSONRPC calls, but it is possible to limit the number of calls needed by using a smart contract. You can use the library eth-scan to do this for you. Simply pass in ...
user avatar
  • 5,139
3 votes
Accepted

How can we get the current spot price for a BEP20 token used web3?

How would we get the price data points from web3? Web3 has no concept of token value, as the value is speculative and differs between different markets. You can either get the price from a particular ...
user avatar
3 votes
Accepted

Ensuring correct block order with subscribe on "newHeads"

Basically, what you want is to have a confirmation that a given block was included in the canonical chain. I assume that you do not need very high security because based on your examples a ...
user avatar
  • 3,257
3 votes
Accepted

How can I register my NFTs on opensea

Opensea did not supports the BSC network. But you can mint the NFTs on Polygon for cheaper fees. Polygon is supported by Opensea platform. Reference: Which blockchains does OpenSea support?
user avatar
3 votes
Accepted

Same ERC20 token on both BSC & Ethereum networks

You need to deploy compatible token contracts on both networks, ideally not ERC-20 but ERC-677, and then set up a two-way bridge on both networks. You should look into ChainSafe's Chain Bridge or POA ...
user avatar
  • 31.5k
3 votes
Accepted

Why are all ethersjs & web3js calls to BSC network failing?

Try changing provider. I use Chainstack and it works great. Follow these steps to sign up on Chainstack, deploy a node, and find your endpoint credentials: Sign up with Chainstack. Deploy a node. ...
user avatar
  • 376
2 votes

Retrieve price data from PancakeSwap [BSC]

Pancake Swap uses the same formula as Uniswap, but they have a 0.2% fee instead of 0.3% fee, which affects the calculation.
user avatar
  • 3,257
2 votes
Accepted

Why I am not able to decompile this contract?

You can decompile it here. Simply paste the bytecode from here. You must remove the leading 0x before decompiling.
user avatar
2 votes

Running BSC node in light mode?

You can't. BSC does not "officially" support light mode. However, BSC 1.1.3 implemented something called diffsync, which has security characteristics of light mode. Diffsync, when activated ...
user avatar
  • 3,257
2 votes
Accepted

Is possible to identify a transaction that deploy a new token in BSCScan API?

After give a look here and check this log and this transaction I tempted to conclude I'm just need to check the data of transaction. I conclude all contract deployment data I found starts with "...
user avatar
  • 304
2 votes
Accepted

How to fork the binance chain?

Binance provide instructions how to run a full node. Then you can enable http requests and use the localhost endpoint with ganache to fork it. There's ganache-cli that is headless.
user avatar
  • 29.6k
2 votes

What is it mean by minting token?

why should I mint token after creating it? If you want to increase the total supply at a later date. (See Introduction to Supply and Demand [external link]. See also Creating ERC20 Supply.) Another ...
user avatar
2 votes

Ensuring correct block order with subscribe on "newHeads"

Proof-of-work chains like Ethereum are probabilistic. The "longest chain" rule helps nodes determine the canonical chain but much ambiguity exists at the head of the chain. Uncertainty ...
user avatar
  • 51.9k
2 votes

Failing to add liquidity to pancakeswap on bsc testnet

Yes, I believe this problem is due to the deadline parameter of the addLiquidity method. In your tx you have submitted a deadline of 7741799 which corresponds (https://www.epochconverter.com/) to ...
user avatar
  • 145
2 votes
Accepted

swapExactTokensForTokens ignore amountOutMin parameter

The AMM is only checking that it is sending you the amountOutMin, not that you are receiving it. In other words, it calls a transfer for that token for an amount greater than or equal amountOutMin. ...
user avatar
  • 3,257
2 votes

BEP20 Price and Market Cap API

I am able to get the token price from PancakeSwap api. This is the PancakeSwap price, which is one particular market, and may or may not be similar to the aggregate price across multiple markets (...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible