Starknet Devnet

Hello!

I have been having some difficulty with Devnet. I was hoping that I might get some direction. I will set out detail below. There may be a simple answer to my issue. I have just begun experimenting with Devnet to assist with developing for StarkNet. To start with, I have just used contract.cairo from the Hello, StarkNet tutorial as a starting point. It would appear that I can deploy the contract successfully. However, when I come to invoke the increase_balance function the invocation fails with the following error:

No contract at the provided address (0x076b1b7dc0ff2f07e02f670f21e949ba5a3db0f3e7070859ec454c9901e122a1)

I am using the Devnet docker image. This is running the image and the output from the transactions below:

docker run -it -p 127.0.0.1:5000:5000 shardlabs/starknet-devnet

  • Running on all addresses.
    WARNING: This is a development server. Do not use it in a production deployment.
  • Running on http://172.17.0.2:5000/ (Press CTRL+C to quit)

172.17.0.1 - - [08/Feb/2022 04:32:52] “POST /gateway/add_transaction HTTP/1.1” 200 -
172.17.0.1 - - [08/Feb/2022 04:34:00] “GET /feeder_gateway/get_transaction_status?transactionHash=0x0093bb167b667a00828fa2be1c08bf6b9f78e4d633fed2776ad16c73679f32c0 HTTP/1.1” 200 -
172.17.0.1 - - [08/Feb/2022 04:34:54] “GET /feeder_gateway/get_block?blockHash=0x038b3c5078754e95fe70390814b44c52ee3d04a13d88d3a1ae62fc143b7c7238 HTTP/1.1” 200 -
172.17.0.1 - - [08/Feb/2022 04:36:04] “POST /feeder_gateway/call_contract?blockNumber=pending HTTP/1.1” 500 -

Deployment of the contract:

starknet deploy --feeder_gateway_url http://127.0.0.1:5000/feeder_gateway/ --gateway_url http://127.0.0.1:5000/gateway/ --contract ./build/contract_compiled.json
Deploy transaction was sent.
Contract address: 0x03f2ed603357926a00c1ccf0151a0a5c634335bb1a16d26d5760037d91143b94
Transaction hash: 0x0093bb167b667a00828fa2be1c08bf6b9f78e4d633fed2776ad16c73679f32c0

Transaction status:

starknet tx_status --feeder_gateway_url http://127.0.0.1:5000/feeder_gateway/ --gateway_url http://127.0.0.1:5000/gateway/ --hash 0x0093bb167b667a00828fa2be1c08bf6b9f78e4d633fed2776ad16c73679f32c0
{
“block_hash”: “0x038b3c5078754e95fe70390814b44c52ee3d04a13d88d3a1ae62fc143b7c7238”,
“tx_status”: “ACCEPTED_ON_L2”
}

Contract invocation and error:

starknet invoke --feeder_gateway_url http://127.0.0.1:5000/feeder_gateway/ --gateway_url http://127.0.0.1:5000/gateway/ --address 0x03f2ed603357926a00c1ccf0151a0a5c634335bb1a16d26d5760037d91143b94 --abi ./build/contract_abi.json --function increase_balance --inputs 1234
Got BadRequest
Traceback (most recent call last):
File “/Users/david/cairo_venv/lib/python3.7/site-packages/services/external_api/base_client.py”, line 116, in _send_request
raise BadRequest(status_code=response.status, text=text)
services.external_api.base_client.BadRequest: HTTP error ocurred. Status: 500. Text: No contract at the provided address (0x076b1b7dc0ff2f07e02f670f21e949ba5a3db0f3e7070859ec454c9901e122a1).
Error: BadRequest: HTTP error ocurred. Status: 500. Text: No contract at the provided address (0x076b1b7dc0ff2f07e02f670f21e949ba5a3db0f3e7070859ec454c9901e122a1).

The above works correctly using alpha-goerli but not in devnet. Any ideas what I am doing wrong? Or, is there a known issue causing this error?

Hi, thanks for reaching out.
What’s your Starknet version and what’s your Docker image tag?

1 Like

Actually your problem is probably caused by interacting with your contract.cairo through a wallet. This is done implicitly when you’re using Starknet CLI with STARKNET_WALLET variable set. The address that’s reported as missing is actually the address of your account which is deployed only on alpha-goerli (as witnessed here: StarkNet - Alpha Block Explorer), that’s why it works only there.

You can either use the --no_wallet flag when running starknet invoke or you can unset STARKNET_WALLET.

Also an important note, Devnet currently doesn’t support interaction through Accounts; we’re waiting for the next cairo-lang version, which will hopefully have what we need to support Accounts.

EDIT: corrected the flag after @davek’s note

2 Likes

Thanks @FabijanC I will try that and report back.

1 Like

Thanks @FabijanC that was my problem. I thought that I should also note, in case others read this thread, that the correct flag is --no_wallet not --no-wallet.

3 Likes

New version of starknet-devnet (v0.1.15) has been released:

Include postman L1 <> L2 interaction with local test networks

  • 2 new HTTP POST endpoints added: /postman/load_l1_messaging_contract and /postman/flush
  • Details of usage specified in Readme
3 Likes

New version of starknet-devnet (v0.1.16) has been released:

  • Support cairo-lang version 0.7.1.
  • Endpoints for new parts of the API (get_full_contract and get_state_update) not yet introduced.
2 Likes

New starknet-devnet version (v0.1.17) has been released:

  • You can now save and load your Devnet instance to save setup time: docs.
  • Supported starknet get_full_contract (get_state_update still pending).
  • Improved L1-L2 communication (postman)

Dump:

$ starknet-devnet --dump-path <PATH> --dump-on <WHEN>

Load:

$ starknet-devnet --load-path <PATH>

New starknet-devnet version (v0.1.18) has been released:

  • Support devnet dumping/loading on macOS.
  • Support starknet get_state_update (command that was introduced with cairo-lang 0.7.1).
1 Like

New starknet-devnet version (v0.1.19) has been released:

  • Reduce Docker image size (635 MB → 232 MB)
  • Support cairo-lang 0.8.0:
    • Add estimate_fee endpoint (currently not able to charge accounts with actual fees).
    • Add get_transaction_trace endpoint.

We plan to change the default port soon and apply some optimization techniques as these are two things users have complained about.

1 Like

WOW!!!
so good!!!
amazing!

New starknet-devnet version (v0.1.20) has been released:

  • Support cairo-lang 0.8.1.
  • Performance related optimizations:
    • Use a faster server container.
    • Introduce --lite-mode (skips block and tx hash calculation).

New version of starknet-devnet (v0.1.21) has been released:

New version of starknet-devnet (v0.1.22) has been released:

  • Fixed interaction of Starknet CLI and hardhat plugin when they are using the --wallet functionality.
  • Fixed syscall get_block_timestamp (will not return 0 anymore; more timestamp-related functionality to come)

New version of starknet-devnet (v0.1.23) has been released:

  • Enable normal fee estimation through plugin
  • Add actual_fee to get_transaction_receipt response.

New version of starknet-devnet (v0.2.0) has been released:

  • Changed default host and port to 127.0.0.1:5050:
    • This is a BREAKING change
    • Rationale: issues with docker and mac integration
  • Reduced deployment time
  • Introduced ARM Docker images:
    • Append -arm to image tag to use the ARM counterpart (e.g. shardlabs/starknet-devnet:0.2.0-arm)
1 Like

New version of starknet-devnet (v0.2.1) has been released:

  • Adapted to cairo-lang 0.8.2:
    • Pending block support will be added in future versions.
  • Introduced speed-up troubleshooting

New version of starknet-devnet (v0.2.2) has been released:

  • Introduce timestamp management endpoints (for setting time and increasing time offset: read more)
  • Fix timestamp support in lite-mode
  • Include max_fee in get_transaction response
  • Include failure reason in tx_status and get_transaction response.

New version of starknet-devnet (v0.2.3) has been released:

  • Supported starknet/cairo-lang v0.9.0 features:
    • declare - Contract class declaration
    • get_class_hash_at
    • get_class_by_hash
  • Now predeploying a set of prefunded accounts:
  • Transactions with max_fee set to 0 are still allowed.
  • Using C++ implementation of pedersen hash for better performance.
  • Fixed events property of transaction receipts (was missing when used through accounts).

New version of starknet-devnet (v0.2.4) has been released:

  • Fixed deployment done with the deploy syscall.
  • Added an endpoint for loading dumped Devnet instances: /load.
  • Updated the OpenZeppelin implementation used by predeployed accounts.
  • Added support for JSON-RPC calls: docs.
  • Redeploying the same contract with the same salt is reintroduced (it was removed, but shouldn’t have been as this is a feature of alpha-goerli).
  • The crypto-cpp-py dependency was updated to have wheels for more macos versions.