Error while declaring/deploying a contract on Starknet by using starkli

430 Views Asked by At

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.

1

There are 1 best solutions below

1
On BEST ANSWER

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