Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'property' object is not callable #38

Closed
Netherdrake opened this issue Mar 19, 2018 · 3 comments
Closed

TypeError: 'property' object is not callable #38

Netherdrake opened this issue Mar 19, 2018 · 3 comments

Comments

@Netherdrake
Copy link

  • Version: web3-py latest
pip install -U web3
...
Successfully installed eth-keys-0.1.0b4 eth-utils-0.8.1
  • Python: 3.6
  • OS: osx and linux

What was wrong?

Signature class won't initialize. It fails with error:

TypeError: 'property' object is not callable
@pipermerriam
Copy link
Member

pipermerriam commented Mar 19, 2018

Please provide full stack trace as well as the code that causes the error.

@Netherdrake
Copy link
Author

def recover_address(data: Union[str, bytes], signature: str) -> str:
    signature = binascii.unhexlify(remove_0x_prefix(signature))
    if type(data) == str:
        data = keccak(text=data)

    # web3js outputs in rsv order
    vrs = (
        ord(signature[64:65]) - 27,
        big_endian_to_int(signature[0:32]),
        big_endian_to_int(signature[32:64]),
    )
    sig = KeyAPI.Signature(vrs=vrs)
    return sig.recover_public_key_from_msg(data).to_address()

This works fine in eth-keys-0.2.0b3.

However in current web3 pypi package, I get:

data = b'A\xb1\xa0d\x97R\xaf\x1b(\xb3\xdc)\xa1Un\xeex\x1eJL:\x1f\x7fS\xf9\x0f\xa84\xde\t\x8cM'
signature = b'B\x0f5Qu\xb5\xc2\xa9h-\xde\x10r\xa9X\xfb\x19;\xdc\xef\x84\x9c\x02\xf0\x90\x00\x19I)\x08\x86B\x17\x81\\\x1ej\xa2\x84\xfa\x83Y\xbc\x02\x06@\xf2tiR\x1e,\xd5\x89\xee\x86\xa6\xb4\x18!\xf1\xc2T\xd3\x1b'

    def recover_address(data: Union[str, bytes], signature: str) -> str:
        signature = binascii.unhexlify(remove_0x_prefix(signature))
        if type(data) == str:
            data = keccak(data)
    
        # web3js outputs in rsv order
        vrs = (
            ord(signature[64:65]) - 27,
            big_endian_to_int(signature[0:32]),
            big_endian_to_int(signature[32:64]),
        )
>       sig = KeyAPI.Signature(vrs=vrs)
E       TypeError: 'property' object is not callable

../../src/core/eth.py:52: TypeError

@pipermerriam
Copy link
Member

You should go look up the API in the README.md. You are trying to use the KeyAPI class directly however it needs to be instantiated (at least in the older versions of the library).

See docs here: https://github.com/ethereum/eth-keys#keyapibackendnone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants