Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Oct 15 16:26
    EddyDomingo commented #2183
  • Oct 15 15:36
    kclowes commented #2181
  • Oct 15 15:34
    hotbroker commented #2181
  • Oct 15 15:29
    kclowes closed #2181
  • Oct 15 15:29
    kclowes commented #2181
  • Oct 15 15:11

    kclowes on master

    Clean up `elif` statement (#217… (compare)

  • Oct 15 15:11
    kclowes closed #2179
  • Oct 15 15:10
    kclowes edited #2179
  • Oct 15 15:09
    kclowes closed #2183
  • Oct 15 15:09
    kclowes commented #2183
  • Oct 15 09:51
    liusirsir commented #1928
  • Oct 15 01:40
    minhvutnt commented #2056
  • Oct 15 00:36
    sammiee5311 commented #2179
  • Oct 15 00:34
    sammiee5311 synchronize #2179
  • Oct 14 22:13
    EddyDomingo edited #2183
  • Oct 14 22:10
    EddyDomingo opened #2183
  • Oct 14 19:49

    kclowes on master

    Fix link for websockets documen… (compare)

  • Oct 14 19:49
    kclowes closed #2173
  • Oct 14 17:58
    kclowes commented #2180
  • Oct 14 17:50
    kclowes commented #2179
Works completely fine back to block 0 with web3.js Contract.getPastEventLogs().
Mikko Ohtamaa
@brschkv You cannot query too big chunks. You need to paginage your queries.
because it puts too big strain on their database and then timeouts because it cannot reply fast enough
I did with varying chunk sizes (1000 blocks to 50_000 blocks), but always the same error at around the same time.
LATEST_BLOCK = 10226095
STEP_SIZE = 100_000

for i in range(0, int(1_000_000 / STEP_SIZE)):
    filter_builder = cDAI.events.LiquidateBorrow.build_filter()
    filter_builder.fromBlock = LATEST_BLOCK - ((i + 1) * STEP_SIZE)
    filter_builder.toBlock = LATEST_BLOCK - (i * STEP_SIZE)
    filter_instance = filter_builder.deploy(w3)
    entries = filter_instance.get_all_entries()
    if len(entries) > 0:
        print(i, entries)
Mikko Ohtamaa
@brschkv does it crash on a specific block
I would assume the start of the historical chain is empty, util you start to see much activity after the launch
and you can simply workd around it by decreasing the step size and starting when cDAI was launched
I will try and find out if it crashes on a specific block. It does crash around the same time (about a month in the past) with each step_size, but definitely after cDAI was launched.
Mikko Ohtamaa
@brschkv Usually to make things developer friendly (if you ever develop smart contracts) add a running counter index to your events so they are easier to query
you can ask events 0-100, 100-200, etc.
:+1: will definitely do!
Mikko Ohtamaa
@brschkv What I have done myself when querying token balances is exponential backoff
have batch size 100, 1000, 10000 blocks
and even you get the first event
go back to 100
because there are time periods when you get a lot of events and time periods when you get less events
but still, the same query as above works perfectly fine with web3.js all the way back to block 0
in one shot
Mikko Ohtamaa
@brschkv I think the best way to debug - would be try to run your own node and test against it
so you get more visibility what is going on on the node side
maybe there is a difference how web3.py and web3.js construct the query
so you could also sniff that from HTTP traffic
Yes, that is what the infura support hinted in the issue linked above. I have not looked into the code yet, but would be willing to help fixing this.
There are some things, that web3.js still does better. And it annoys me personally because I like web3.py a lot better and would like to use it exclusively. But I constantly have to jump back to web3.js for certain tasks... :-(

@brschkv I think the best way to debug - would be try to run your own node and test against it

I don't have the infrastructure at hand to do that unfortunately...

maybe there is a difference how web3.py and web3.js construct the query

I hope I can make some time to look into that later.

There's also an open issue for this already: ethereum/web3.py#1523
Nick Mudge
Mikko Ohtamaa
@mudgen The standard seems to propose a more complicate upgrade proxy. I read through quickly, but not really understand what's the unique selling point here.
good to know, thank you!
Ed Noepel
Nick/Piper: I believe I resolved concerns with ethereum/web3.py#1620 three weeks back. What's the process for getting this merged and into a release? Thanks in advance.
<carver> @Piper I don't have any context on this, is this good to go? ^
Nick Mudge
@miohtama Thanks for taking a look. @miohtama One of the big selling points is that it solves the 24KB max size contract limit. Another thing it does is provide a simpler way to handle complex contract interaction.
@miohtama The Diamond Standard is a more complicated upgrade proxy but it is a simpler way to handle larger sets of contracts that need to interact with each other.
A new Python tool was released today for automating the upgrade process of Ethereum Diamonds: http://joeyzacherl.com/2020/06/diamond-setter-ethereum-smart-contract-manager/
Mikko Ohtamaa
Though in practice it cannot be a single command, as most of the critical contracts are managed by multisigs or DAOs :)
Manuel Montenegro

Hi, I have a problem sending a raw transaction. I'm following the example in documentation, but Python returns an error. I'm not sure if it's a bug or just I'm doing it in the wrong way.

I have deployed a Hyperledger Besu network. So I'm using Web3 middleware. And I want to send a transaction using local keys. I can make the transaction using Metamask, so I think Besu network is not the problem.

Well, I first sign the transaction using the key of an account, after i send the signed transaction and by last I wait for transaction receipt. Here is the code:

w3 = Web3(Web3.HTTPProvider(""))
w3.middleware_onion.inject(geth_poa_middleware, layer=0)
accountKey = '0x...'
transaction = {
    'to': '0x...',
    'value': w3.toWei(0, 'ether'),
    'gas': 2000000,
    'gasPrice': 100,
    'nonce': 0,
    'chainId': 5403
signed = w3.eth.account.sign_transaction(transaction, accountKey)
txHash = w3.eth.sendRawTransaction(signed.rawTransaction)
txReceipt = w3.eth.waitForTransactionReceipt(txHash)

And here is the weird thing: I can run this python3 script once! (and it works as expected). But the second time I run, I get this error:

Manuel Montenegro
Ok, forget it. This is the answer if someone has a similar problem: I forgot to manage the nonce number of the transaction... I always send a nonce = 0
Mikko Ohtamaa
@manumonti the most efficient way to share information like this is to open a question on ethereum.stackexchange.com and then answer your question yourself.
ethereum.stackexchange.com is very searcahble and answers also rank high in Google
hello everyone I am a developer a long time ago but I started this year with all this block-chain I would like to learn more about web 3 but I cannot install the library with pip this is my mistake:
Building wheels for collected packages: lru-dict, cytoolz, bitarray
Building wheel for lru-dict (setup.py): started
Building wheel for lru-dict (setup.py): finished with status 'error'
Running setup.py clean for lru-dict
Building wheel for cytoolz (setup.py): started
Building wheel for cytoolz (setup.py): finished with status 'error'
Running setup.py clean for cytoolz
Building wheel for bitarray (setup.py): started
Building wheel for bitarray (setup.py): finished with status 'error'
Running setup.py clean for bitarray
Failed to build lru-dict cytoolz bitarray
Installing collected packages: lru-dict, cytoolz, eth-utils, eth-keys, eth-keyfile, bitarray, rlp, parsimonious, eth-abi, eth-rlp, eth-account, websockets, web3
Running setup.py install for lru-dict: started
Running setup.py install for lru-dict: finished with status 'error'
someone that want help me please..
Marc Garreau
@francocoin1701 there is some documentation for getting a clean environment set up: https://web3py.readthedocs.io/en/stable/troubleshooting.html#setup-environment
Ajmal Hassan
Hello Everyone,
how do you find the account number given the private key in web.py?
arjuna sky kok
from eth_keys.backends.native.ecdsa import private_key_to_public_key
from eth_keys.utils.address import public_key_bytes_to_address
from eth_utils import to_normalized_address

public_key = private_key_to_public_key(private_key)
address = public_key_bytes_to_address(public_key)
normalized_address = to_normalized_address(address)