Comments (25)
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.
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.
when I run the examples/onboard.py file.
from dydx-v3-python.
@Kenadia Can you provide a solution about this problem?
from dydx-v3-python.
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.
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.
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.
The same with you are
from dydx-v3-python.
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.
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.
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.
from dydx-v3-python.
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.
You can see that there is a "API_KEY_PAIRS" there.
from dydx-v3-python.
@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.
from dydx-v3-python.
@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.
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.
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.
- 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.
- 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.
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.
@CNich exactly same as me, it shows that the documentation is not good enough.
from dydx-v3-python.
Hi all. What I need to do if I have no keys in browser? There are only empty brackets
from dydx-v3-python.
Have you connected the wallet e.g. metamask?
from dydx-v3-python.
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.
@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.
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)
- Error: Data issue with get_candles function
- ValueError: STARK public/private key mismatch HOT 1
- get_orders DOES NOT WORK FOR FILLED! HOT 1
- order submission gets an error: Invalid signature for order. HOT 5
- OHLC on DYDX does not match "current price".
- "STOP_MARKET" order ?.
- ImportError: cannot import name 'getargspec' from 'inspect' HOT 3
- {"msg":"Unauthorized"} + limitFee scale of 6 HOT 1
- HTTP 401 on https://api.stage.dydx.exchange/v3/fills?xxxx=yyyy
- Cancel order failing with authorization issues
- Error using the example order.py HOT 1
- Onboarding on Sepolia failes HOT 6
- WebSocket : OrderBook : Data sent is pre-maching-engine data, yielding "invalid" order books
- Python-only onboarding fails at source_client.eth.transfer_token with ERC20: transfer amount exceeds balance
- On opening some trades: 'NoneType' object is not subscriptable HOT 1
- Error: Incorrect padding
- There is not enough liquidity to fill this market order, please try a smaller order amount.
- JSONDecodeError: Expecting value: line 1 column 1 (char 0)
- DydxApiError: DydxApiError(status_code=400, response={'errors': [{'msg': 'Order expiration cannot be less than 1 minute(s) in the future'}]})
- '[Errno 111] Connection refused' when trying to 'get_markets()'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dydx-v3-python.