0

I'm trying to declare my first contract on Starknet by following the official Starknet tutorial.

The problem is that when I try to declare my contract with this command:

starkli declare path/to/contract.sierra --compiler-version=2.0.1

after having set the environment variables STARKNET_ACCOUNT and STARKNET_KEYSTORE

I get the error:

Error: expected ',' or '}' at line 11 column 3

I don't know what file does this error refer to, but I'm assuming it is not my contract, since the same error appears even when I try to deploy the contract already declared in the tutorial with:

starkli deploy <class hash> ...

I'm using Ubuntu and a Python 3.9 virtual environment. For the rest I followed the tutorial step by step. If you need more info I'll provide it as soon as possible.

Uli Schlachter
  • 9,337
  • 1
  • 23
  • 39
Lapo
  • 882
  • 1
  • 12
  • 28

1 Answers1

1

The error message "Error: expected ',' or '}' at line 11 column 3" indicates an issue with the file path/to/contract.sierra that you're attempting to deploy. In the newer versions of Starkli, it's necessary to use a JSON file, specifically path/to/contract.sierra.json. If you're using Scarb to compile your contract, you'll likely find the JSON file at target/dev/starknetbook_chapter_2_Vote.sierra.json.

Therefore, your declare command should be formatted as follows:

starkli declare target/dev/starknetbook_chapter_2_Vote.sierra.json --rpc <RPC-BEING-USED> --account <PATH-TO-ACCOUNT-DESCRIPTION> --keystore <PATH-TO-SIGNER-JSON>

Please note that The Starknet Book has been updated to include these modifications. For more details, visit the following link: https://book.starknet.io/chapter_2/deploy_call_invoke.html#contract_deployment

David Barreto
  • 8,887
  • 7
  • 32
  • 46
  • Hey, thank you for your answer. I ended up not using starkli, but just the raw Starknet CLI, since it was ok for such a small project as the one I was doing. I hope your answer will be helpful for people with this same problem in the future! – Lapo Jul 27 '23 at 17:44