Problem with declaring sample contract to starknet testnet

473 views Asked by At

I'm trying to declare the sample contract as defined here:

https://www.cairo-lang.org/docs/hello_starknet/intro.html#declare-contract

When invoking the

starknet declare --contract contract_compiled.json

I'm still getting:

Got BadRequest while trying to access https://alpha4.starknet.io/feeder_gateway/simulate_transaction?blockNumber=pending. Status code: 500; text: {"code": "StarknetErrorCode.UNINITIALIZED_CONTRACT", "message": "Requested contract address [redacted] is not deployed."}.
Traceback (most recent call last):
  File "/Users/[redacted]/cairo_venv/lib/python3.9/site-packages/services/external_api/client.py", line 117, in _send_request
    raise BadRequest(status_code=response.status, text=text)
services.external_api.client.BadRequest: HTTP error ocurred. Status: 500. Text: {"code": "StarknetErrorCode.UNINITIALIZED_CONTRACT", "message": "Requested contract address [redacted] is not deployed."}
Error: BadRequest: HTTP error ocurred. Status: 500. Text: {"code": "StarknetErrorCode.UNINITIALIZED_CONTRACT", "message": "Requested contract address [redacted] is not deployed."}

I'm expecting to have that being worked :)

I've set everything as it's described in the tutorial above.

1

There are 1 answers

0
Henri On BEST ANSWER

As mentionned by user amanusk, you need a funded account with some ETH in order to be able to declare contract classes. This error happens because you either did not declare an account contract in your CLI yet, or because you haven't sent ETH on it yet, and so it is not initialized. Make sure to:

  • Create an account usable with your CLI
  • Fund it with some ETH
  • Check that it appears as deployed in an explorer