Hot answers tagged

6

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% fee) tTotal is totalSupply and literally never changes rTotal starts at 127366483000000 and continuously subtracts or adds currentRate Example: You buy 100 ...


5

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


4

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 in python, with something like: proxy_contract = web3.eth.contract(address=address, abi=abi_string) implementation_contract_address = proxy_contract.functions....


3

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 confirmation of only one block would be enough for your need. I think that expending your second option could be a solution. Alternative 1 - Validate double blocks with ...


3

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.build(new HttpService("https://bsc-dataseed.binance.org/")); long chainId = 56; FastRawTransactionManager txMananger = new FastRawTransactionManager(...


3

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 the array of addresses, and it will fetch the balance for each token through the eth-scan smart contract. By default, the library will do a single call for ...


3

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 accounts (since you don't need an account to use these endpoints anyway) If you're looking for a higher rate limit BSC node, you should check out my company moralis....


2

Pancake Swap uses the same formula as Uniswap, but they have a 0.2% fee instead of 0.3% fee, which affects the calculation.


2

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 "0x60806040527f76". Actually.... this is the start of the contract code...most like "pragma solidity bla bla bla" so this must be the Solidity ...


2

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 diminishes exponentially with each new block on the longest known chain. The different blocks you see are candidates and it is not uncommon to have more than one ...


2

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.


2

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 - https://geth.ethereum.org/docs/interface/command-line-options


2

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 Tuesday, March 31, 1970 2:29:59 PM You can go to the pancakeswap router contract (https://testnet.bscscan.com/address/0xd99d1c33f9fc3444f8101754abc46c52416550d1) ...


2

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. However, after the transfer is called by the AMM (from the pair to your address), the token contract burns the 9% tax you are mentioning. This is not captured by ...


2

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 (which is what sites like CoinMarketCap and CoinGecko show). CoinGecko has a free API that will return the data you want, though only includes the more popular ...


2

It depends. In the transaction that you linked to in your question, the person call a function swap() directly on the pair contract. The code of the pair contract is public (verified). So, in that case, yes you can see exactly what the public contract did when called. However, calling the swap() function on a pair directly is a very bad way of doing ...


2

You get the tokens that make up the trading pair by calling following lines on the pair contract: token0 = contract.functions.token0().call() token1 = contract.functions.token1().call() I used the code format you defined in your question above. In your example, the Razor token could be either token0 or token1, depending on the way that pair contract was ...


2

Your contract doesn't have constructor arguments. If some place is asking for those, leave it empty


1

The last parameter in the callback is the event log object. targetContract.on("targetMethod", (...parameters) => { const event = parameters[parameters.length - 1]; console.log(event.transactionHash); })


1

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, and the function returns the token quantity you would receive at that moment. You can then use this data for price calculation.


1

I gave up trying to ethereumjs-tx in the end as I came across this: https://stackoverflow.com/questions/64526925/how-to-swap-tokens-on-uniswap-using-web3-js Managed to get that solution up and running it solved that particular error I was getting.


1

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&utm_medium=web2x&context=3


1

it depends on planning ahead and there might not be enough of that in this case. Think of it like a spaceship you shoot into space, on its way to another planet and going as fast as your engineers know how to make it go. There is no way to catch up to it but you exchange messages by radio signals. So ... if you had the foresight to create a language and send ...


1

I was under the impression that Geth is essentially the node software. Is that not so? It's one of the client implementations, yes. (There are other Ethereum client implementations that adhere to the spec, listed here. As far as I know there's only one implementation for BSC... which is the one controlled by Binance.) If Geth is available on Windows, ...


1

is it possible? Not without a fair amount of work. When they forked Geth they switched the Ethereum Proof of Work consensus mechanism for their own Proof of Staked Authority consensus, called Parlia (basically to centralise it to 21 validator nodes... ) Looking at the relevant GitHub commit, adding Parlia is ~3,000 lines of relatively complex changes and ...


1

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 docs, but let's explain it. Whenever you make a transaction through Ethers, you can set overrides in an object after your arguments. In this case, this is your ...


1

The ERC-20 specification describes some events that a token contract must emit when doing certain actions, like transferring tokens. If you look at the logs for the transaction you linked for example, you can see a few Transfer events in there, including the address they were sent from and to, and the number of tokens that were transferred. web3.eth....


1

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 market - e.g. Uniswap/Pancakeswap - or get a price from a service that provides a weighted average from a selection of different markets. I believe Etherscan/...


1

Sorry to add an answer but i can't comment. I am also looking to add a token/BNB or token/WBNB pair in testnet but it doesn't work. Tried using https://testnet.bscscan.com/address/0xD99D1c33F9fC3444f8101754aBC46c52416550D1#writeContract, remix, truffle, web3, and none allow it. I am able to add a token1/token2 pair but doing the BNB or WBNB doesn't work. ...


1

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 use of the mint() function might be to reward miners (see Rewarding Miners), but since you've deployed on the Binance Smart Chain - which has a centralised set ...


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