Giter Site home page Giter Site logo

Comments (25)

caiyundong avatar caiyundong commented on July 28, 2024 3

For my practice, we have tried to use infura and quiknode, unluckily both don't implement the eth_signTyped Data, which is available for the MetaMask though. As it is just a wallet but not a node, I have no idea to set the web3's httpprovider.

Our last straw is to use the STARK_KEY_PAIR, which contains the private key, public key as well as the y-coordinate from the metamask. It can be found at the "Right Click of dydx trading webpage after linking the metamask wallet -> Inspection->Application->Local Storage->http://trade.dydx....->" together with the api key credentials.

One thing to note is that for the Stark keys (private key, public key, public y coordinate), there is a need to modify a bit, e.g. "02312321" ->"0x2312321" in your code, otherwise you might meet the private key/public key mismatch problem.

from dydx-v3-python.

liavkoren avatar liavkoren commented on July 28, 2024 1

Someone opened an issue with web3.py about this, even though it is actually a dydx issue. One of the web3 maintainers has provided a pretty nice answer, it may shed some light: ethereum/web3.py#2097

Maybe one of the DyDx maintainers can help with a web3 issue to return the favor ; )

from dydx-v3-python.

CongZhengithub avatar CongZhengithub commented on July 28, 2024

when I run the examples/onboard.py file.

from dydx-v3-python.

CongZhengithub avatar CongZhengithub commented on July 28, 2024

@Kenadia Can you provide a solution about this problem?

from dydx-v3-python.

bala782 avatar bala782 commented on July 28, 2024

i met the same problem. when using Ganache node, everything is ok, but using the etherum mainnet, this problem happens, i don't know why。anyone can help?

from dydx-v3-python.

Bruhwuh123 avatar Bruhwuh123 commented on July 28, 2024

did you guys find a sollution? It seems to be infura not accepting signing, but what node does accept that? a Private one?

from dydx-v3-python.

fastener avatar fastener commented on July 28, 2024

did you guys find a sollution? It seems to be infura not accepting signing, but what node does accept that? a Private one?

from dydx-v3-python.

liuqiba avatar liuqiba commented on July 28, 2024

The same with you are

from dydx-v3-python.

dyustc avatar dyustc commented on July 28, 2024

Warning: Failed to derive default API key credentials: {'code': -32601, 'message': 'The method eth_signTypedData does not exist/is not available'} Traceback (most recent call last): File "/Users/zhengcong/Documents/hkust/financial math/gitlab_py/apps/DataPlatform/MarketDataService/DYDX/dydxDataWss.py", line 20, in stark_private_key = client.onboarding.derive_stark_key() File "/usr/local/lib/python3.9/site-packages/dydx3/modules/onboarding.py", line 124, in derive_stark_key signature = self.signer.sign( File "/usr/local/lib/python3.9/site-packages/dydx3/eth_signing/sign_off_chain_action.py", line 38, in sign typed_signature = self.signer.sign( File "/usr/local/lib/python3.9/site-packages/dydx3/eth_signing/signers.py", line 51, in sign raw_signature = self.web3.eth.signTypedData( File "/usr/local/lib/python3.9/site-packages/web3/module.py", line 57, in caller result = w3.manager.request_blocking(method_str, File "/usr/local/lib/python3.9/site-packages/web3/manager.py", line 187, in request_blocking return self.formatted_response(response, File "/usr/local/lib/python3.9/site-packages/web3/manager.py", line 168, in formatted_response raise ValueError(response["error"]) ValueError: {'code': -32601, 'message': 'The method eth_signTypedData does not exist/is not available'}

When I try to create the stack key, I find this error. Does someone know how to solve it ?

Can I ask what WEB_PROVIDER_URL you are using for ETH mainnet on metamask?

from dydx-v3-python.

dyustc avatar dyustc commented on July 28, 2024

i met the same problem. when using Ganache node, everything is ok, but using the etherum mainnet, this problem happens, i don't know why。anyone can help?

when using Ganache node, I came across even more bug... Is this relevant to locations?

it said

requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff071f6b1d0>: Failed to establish a new connection: [Errno 61] Connection refused',))

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024

Warning: Failed to derive default API key credentials: {'code': -32601, 'message': 'The method eth_signTypedData does not exist/is not available'} Traceback (most recent call last): File "/Users/zhengcong/Documents/hkust/financial math/gitlab_py/apps/DataPlatform/MarketDataService/DYDX/dydxDataWss.py", line 20, in stark_private_key = client.onboarding.derive_stark_key() File "/usr/local/lib/python3.9/site-packages/dydx3/modules/onboarding.py", line 124, in derive_stark_key signature = self.signer.sign( File "/usr/local/lib/python3.9/site-packages/dydx3/eth_signing/sign_off_chain_action.py", line 38, in sign typed_signature = self.signer.sign( File "/usr/local/lib/python3.9/site-packages/dydx3/eth_signing/signers.py", line 51, in sign raw_signature = self.web3.eth.signTypedData( File "/usr/local/lib/python3.9/site-packages/web3/module.py", line 57, in caller result = w3.manager.request_blocking(method_str, File "/usr/local/lib/python3.9/site-packages/web3/manager.py", line 187, in request_blocking return self.formatted_response(response, File "/usr/local/lib/python3.9/site-packages/web3/manager.py", line 168, in formatted_response raise ValueError(response["error"]) ValueError: {'code': -32601, 'message': 'The method eth_signTypedData does not exist/is not available'}
When I try to create the stack key, I find this error. Does someone know how to solve it ?

Can I ask what WEB_PROVIDER_URL you are using for ETH mainnet on metamask?

There is no web_provider_url for the metamask as it is a wallet not a node. I fetch the keys from the browser. Cannot figure the way to get them from the API.
sc

from dydx-v3-python.

CongZhengithub avatar CongZhengithub commented on July 28, 2024

Warning: Failed to derive default API key credentials: {'code': -32601, 'message': 'The method eth_signTypedData does not exist/is not available'} Traceback (most recent call last): File "dydxDataWss.py", line 20, in stark_private_key = client.onboarding.derive_stark_key() File "/usr/local/lib/python3.9/site-packages/dydx3/modules/onboarding.py", line 124, in derive_stark_key signature = self.signer.sign( File "/usr/local/lib/python3.9/site-packages/dydx3/eth_signing/sign_off_chain_action.py", line 38, in sign typed_signature = self.signer.sign( File "/usr/local/lib/python3.9/site-packages/dydx3/eth_signing/signers.py", line 51, in sign raw_signature = self.web3.eth.signTypedData( File "/usr/local/lib/python3.9/site-packages/web3/module.py", line 57, in caller result = w3.manager.request_blocking(method_str, File "/usr/local/lib/python3.9/site-packages/web3/manager.py", line 187, in request_blocking return self.formatted_response(response, File "/usr/local/lib/python3.9/site-packages/web3/manager.py", line 168, in formatted_response raise ValueError(response["error"]) ValueError: {'code': -32601, 'message': 'The method eth_signTypedData does not exist/is not available'}
When I try to create the stack key, I find this error. Does someone know how to solve it ?

Can I ask what WEB_PROVIDER_URL you are using for ETH mainnet on metamask?

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024

You can see that there is a "API_KEY_PAIRS" there.

from dydx-v3-python.

dyustc avatar dyustc commented on July 28, 2024

@caiyundong Thanks. can you sign dydx private APIs successfully via REST with the web browser keys now? I use the following header, but still got unauthorized error.
截屏2021-10-07 11 42 04

from dydx-v3-python.

dyustc avatar dyustc commented on July 28, 2024

@caiyundong I wrote this according to the dydx documentation, but it seems the stark key isn't used here, kind of strange. Anyway, it isn't working.

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024

Yes, with the credentials of api key, secret and passphase, the private methods are working well. The stark key is only needed for the placing-the-order and withdraw.

from dydx-v3-python.

CNich avatar CNich commented on July 28, 2024

I fetched the keys from the browser as @caiyundong said above and added '0x' to stark keys, and the private endpoints are working except for create_order (haven't tried withdraw yet). I get the error DydxApiError: DydxApiError(status_code=400, response={'errors': [{'msg': 'Invalid signature for order'}]}) . Are my stark keys wrong? How does metamask do the signing?

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024
  1. For the stark_private_key, stark_public_key, stark_public_key_y_coordinate, you can use "stark_private_key = hex(int("0x"+stark_private_key, base=16))" to convert if it doesn't start with 0x, may not just add 0x at the front.
  2. You may check if you have used correct position_id for place_order (position_id = dydx_driver.get_accounts()["accounts"][0]["positionId"])

from dydx-v3-python.

CNich avatar CNich commented on July 28, 2024

Ah, my position_id was wrong, I set it to 1 since I saw that in the docs, didn't realize I needed to use my own. Thanks @caiyundong for the help!

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024

@CNich exactly same as me, it shows that the documentation is not good enough.

from dydx-v3-python.

NumberUn avatar NumberUn commented on July 28, 2024

Hi all. What I need to do if I have no keys in browser? There are only empty brackets
image

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024

Have you connected the wallet e.g. metamask?

from dydx-v3-python.

cfa532 avatar cfa532 commented on July 28, 2024

One thing to note is that for the Stark keys (private key, public key, public y coordinate), there is a need to modify a bit, e.g. "02312321" ->"0x2312321" in your code, otherwise you might meet the private key/public key mismatch problem.

you saved my week!

from dydx-v3-python.

oussamabng avatar oussamabng commented on July 28, 2024

@caiyundong i did everything like u said , but i still have DydxApiError(status_code=400, response={'errors': [{'msg': 'Invalid signature for order'}]}) please help me.

stark_private_key = 'XXX'
STARK_PRIVATE_KEY = hex(int("0x"+stark_private_key, base=16))

account_response = private_client.private.get_account()
position_id = account_response.data['account']['positionId']
print(position_id)

from dydx-v3-python.

caiyundong avatar caiyundong commented on July 28, 2024

You can create a read-only key and send to me ([email protected]). I can give a try. I haven't worked on DYDX for quite a long time. @oussamabng

from dydx-v3-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.