New answers tagged

0

From the docs: When creating a new log filter, the filter_params should be a dictionary with the following keys. address: string or list of strings, each 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate. Have you tried address instead of from?


0

My service Trading Strategy gives you pool liquidity information you are looking for. You can get both historical and real time liquidity added over an API. You can also interactively view this on the website. A liquidity chart example for KLIMA-USDC pair. Read our introduction post on liquidity charts and API. Here is a partial Python example how to get ...


0

This is for those who might want to be clarified on the wallet/account concepts on Ethereum, thanks to @mikko-ohtamaa. The answer is YES and NO. Wallets have nothing to do with the structure being used in blockchains to track down the balances or handle transactions. It is just a file containing accounts' info(public/private keys) and web3.eth.accounts....


0

This is for those who might want to be clarified on the wallet/account concepts on Ethereum, thanks to @mikko-ohtamaa. Wallets have nothing to do with the structure being used in blockchains to track down the balances or handle transactions. It is just a file containing accounts' info(public/private keys) and web3.eth.accounts.wallet-based commands mentioned ...


0

So basically your askin how to monitor the mempool. This is the place where all transactions go after submitting in waiting to be included in some block. Here you can find more details. This also might be helpful


0

You do not need geth to create a wallet. Ethereum account is just a private key that is a large 256-bit random integer. Then this private key can be imported to any wallet software or your own program.


0

Any suggestions for an architecture to reach to Bitcoin's wallet structure for Ethereum? My suggestion is don't. Ethereum is not a UTXO blockhain, but an account-based one. Any Bitcoin like wallet structure on Ethereum is not practical, or not needed. For creating a hot wallet please see this answer.


0

I can't add much to this, except, that this also fixed the issue for me. The same solution was also suggested here: Try restarting your ganache-cli of the forked chain. If you leave it >running for too long this issue may come up. If that doesn't work, and you're using Cloudflare as an HTTP provider, >try using a different HTTP provider, like Infura....


0

I found that calling the contract function first works. This is supposed to clone the contract function (NOT the contract) and return a copy, but it also corrects the args field. I believe this only works if there are zero arguments, however. Example: updated_card = magic_ideas.functions.get_card('731759')().call() Note the extra set of parenthesis before ...


0

Your script is importing dotenv but not actually using it. You must actually call load_dotenv(), not just import it.


1

The issue is that you're using .call() method which is meant to be used when you only want to read the blockchain. If you want to write on the blockchain ( and usually transfer method means you want to transfer particular amount from one wallet to another which is basically writing on the blockchain ) then you have to use the .transact() method. In your case ...


0

Your script establishes a network connection to an Ethereum node running at Infura. This means that you can use the JSON-RPC API to send commands to the node which lets you execute transactions, check balances, etc. web3.py is using that API to let you deploy contracts and interact with them. MetaMask is a browser extension that can also establish a ...


0

The function selector or method id is the first 4 bytes of the hash of the method name and the parameters. This is documentend here https://solidity-by-example.org/function-selector/ More details are also available here What is a function selector? There are also database where you can look these up. For example https://www.4byte.directory/


1

I think you need to specify the router address and not the factory address to execute a trade....


0

For this it is important to understand how function calls are encoded. The first part is to calculate the function selector. This is a 4byte identifier of the method that starts the calldata. (See https://docs.soliditylang.org/en/v0.8.11/abi-spec.html?highlight=Function%20id#function-selector). For you example the function selector would be the keccak hash ...


0

For each of the function defined in the abi there is a defined return type. For the balanceOf method normally a uint256 is expected (at least for most token standards). The error indicates that the value returned cannot be parse into a uint256. This can happen if the contract at the address does not implement the method or implements it with a different ...


0

Try this on a dev net (do not do this on main-net): def fund_with_link... .... # arbitrary gasLimit amount... myAwesomeGasLimit = 50000 funding_tx = link_token.transfer( contract_address, amount, {"from": account, "gasLimit": myAwesomeGasLimit} ) ...


0

You set _address to msg.sender when you define it. Therefore the value is set on deployment of the contract to the deployer and after that never updated. If you want to have the msg.sender of the call to registerUser you need to read msg.sender inside this function. A possible change could look this way: function registerUser( string memory _name,...


1

Create a config.py in the same directory with the file you want to import config, put to this file private="xxxxx" In the file you want to import import config ... print(config.private) // xxxxx And add config.py to .gitignore file


0

So after deploying a few rails apps to heroku -- I realized a better way: A distributed chain where people sign up to host your app, just like heroku does. So miners get paid to host the app. Each app is made available like a torrent in bittorrent seeded by original author and reseeded by others, and this torrent contains the complete image needed to host ...


0

From the documentation you link if you know the last topic is the third then you can include None in first two entries [None, None, B]


0

this might solve your issue. first, instead of passing 1 as a number into the output amount, the router contract has a public function that you can use to get the exact output amount and the result can be passed into where you need to put the output amount. here: function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] ...


0

It does not belong to web3.py itself, but web3.py accesses the smart contract from the uniswap router which is deployed on the ethereum blockchain with the address: 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D https://etherscan.io/address/0x7a250d5630b4cf539739df2c5dacb4c659f2488d The uniswap router source code, including the function swapExactETHForTokens, ...


0

You need to call what was initialised as Web3. in your case, con con.eth.accounts alternatively use the standard web3 or w3 web3 = Web3(Web3.HTTPProvider("HTTP://127.0.0.1:7545")) then your code will work with web.eth.accounts


0

If you interact with a contract, then the contract address will be in the to section of the hash data. To retrieve Holders information, see here API to gather list of top token holders


2

You can achieve this by updating the dictionary units located in the eth_utils/units.py file in the eth_utils that is a dependency of the web3 codebase. For me it lives here C:\Python38\Lib\site-packages\eth_utils\units.py It contains only the units dict of decimal places. You can add the decimals you require like so.. from eth_utils.units import units, ...


0

Method web3.eth.getTransaction(<TX_HASH>); will return an object which will have property value and this is the value parameter passed to the transaction, but represented as wei. To convert it to ETH ( or BNB in your case ) you need to use web3.utils.fromWei(<WEI_AMOUNT>, 'ether');. Now you got the ETH ( or BNB ) amount, if you want to find the ...


Top 50 recent answers are included