# Starknet Devnet

**URL:** <https://community.starknet.io/t/starknet-devnet/69>\
**Category:** Site Feedback\
**Tags:** tooling, devnet\
**Created:** [November 25, 2021, 11:49am UTC](https://community.starknet.io/t/starknet-devnet/69 "2021-11-25T11:49:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [November 25, 2021, 11:49am UTC](https://community.starknet.io/t/starknet-devnet/69/1 "2021-11-25T11:49:48Z")

</div>

This is a topic for issues, requests and news on Starknet Devnet.

---

<div class="post-metadata">

**Author:** ![henrli](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/henrli/32/6_2.png) [@henrli](https://community.starknet.io/u/henrli)\
**Post date:** [November 25, 2021, 1:52pm UTC](https://community.starknet.io/t/starknet-devnet/69/2 "2021-11-25T13:52:23Z")

</div>

Starknet Devnet repo is here [GitHub - Shard-Labs/starknet-devnet: A local testnet for Starknet](https://github.com/Shard-Labs/starknet-devnet)

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [November 29, 2021, 9:22am UTC](https://community.starknet.io/t/starknet-devnet/69/3 "2021-11-29T09:22:34Z")

</div>

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

> **[Release v0.1.8 · Shard-Labs/starknet-devnet](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.8)**
>
> What's Changed
> 
> Upgrade to v0.1.8 by @FabijanC in #14
> 
> Usage
> 
> Prevent Internal Server Error if deploying a contract compiled with an old compiler version.
> Make the result of starknet tx\_status more...

- Prevent `Internal Server Error` if deploying a contract compiled with an old compiler version.
- Make the result of `starknet tx_status` more similar to that of Alpha testnet.
- Support `starknet get_storage_at`.
- Support `starknet get_code`.
- Add lists of supported and unsupported Starknet CLI commands to Readme.

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [November 29, 2021, 1:13pm UTC](https://community.starknet.io/t/starknet-devnet/69/4 "2021-11-29T13:13:33Z")

</div>

The version released this morning was not compatible with Python versions 3.7 and 3.8. Thanks to [Jakub Ptak](https://github.com/Solpatium) for fixing this and helping release v0.1.9:

> **[Release v0.1.9 · Shard-Labs/starknet-devnet](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.9)**
>
> What's Changed
> 
> Fix "'type' object is not subscriptable" error for python versions \< 3.9 by @Solpatium in #16
> Upgrade to v0.1.9 by @FabijanC in #17
> 
> New Contributors
> 
> @Solpatium made their first co...

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 1, 2021, 8:54am UTC](https://community.starknet.io/t/starknet-devnet/69/5 "2021-12-01T08:54:07Z")

</div>

Forking was proposal in last week’s community call and in a GitHub issue yesterday: [Mainnet forking · Issue #18 · Shard-Labs/starknet-devnet · GitHub](https://github.com/Shard-Labs/starknet-devnet/issues/18)  
Don’t hesitate to share your thoughts!

---

<div class="post-metadata">

**Author:** ![henrli](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/henrli/32/6_2.png) [@henrli](https://community.starknet.io/u/henrli)\
**Post date:** [December 1, 2021, 12:31pm UTC](https://community.starknet.io/t/starknet-devnet/69/6 "2021-12-01T12:31:42Z")

</div>

An interesting page to help designing this

> <https://ethereum.stackexchange.com/questions/103184/how-does-the-ganache-cli-fork-work/103783#103783>

Devnet already allows executing smart contracts against local state, correct?  
The missing piece seems to be being able to pull part of the global starknet state from the sequencer?

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 1, 2021, 1:03pm UTC](https://community.starknet.io/t/starknet-devnet/69/7 "2021-12-01T13:03:53Z")

</div>

Thanks for the link! Yes, I think you’re right.

---

<div class="post-metadata">

**Author:** ![henrli](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/henrli/32/6_2.png) [@henrli](https://community.starknet.io/u/henrli)\
**Post date:** [December 1, 2021, 3:37pm UTC](https://community.starknet.io/t/starknet-devnet/69/8 "2021-12-01T15:37:34Z")

</div>

Hey,  
With these APIs you can query the code and the state of a contract at a specific block. Is that enough?

```auto
get_storage_at 

```

and

```auto
get_code 

```

[https://starknet.io/starknet-cli/](https://starknet.io/starknet-cli/)

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 2, 2021, 8:21am UTC](https://community.starknet.io/t/starknet-devnet/69/9 "2021-12-02T08:21:03Z")

</div>

I’m not sure how all the cases should be covered; in fact I’m not even sure which cases there are. There could be mainnet contracts, and newly deployed contracts only available on the fork. So if the devnet gets an invoke/call request, it should first check its own state, then query the mainnet.

But I’m not sure about the L2-L2 interaction case: What if one contract is on mainnet and the other is on devnet; how would they interact?

Also, if there is an invoke request that changes the state of a previously deployed contract, how should the new state be preserved on the fork only? Could that previously deployed contract be copied to the fork when such need arises?

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 2, 2021, 8:26am UTC](https://community.starknet.io/t/starknet-devnet/69/10 "2021-12-02T08:26:23Z")

</div>

Also, the APIs you mentioned (`get_storage_at`, `get_code`), they seem useful for our use case, but I’m not sure if it’s directly them that should be called. Because these are the subcommands (tasks) of the `starknet` CLI tool. The devnet would probably not call the CLI tool, but perform HTTP requests in case it doesn’t encounter the requested data in its own state. The devnet already mimicks the testnet HTTP endpoints, so in those endpoints, it could pass on the same request, but to a different host (mainnet, testnet, whichever).

---

<div class="post-metadata">

**Author:** ![bbrandtom](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/bbrandtom/32/9_2.png) [@bbrandtom](https://community.starknet.io/u/bbrandtom)\
**Post date:** [December 2, 2021, 9:52am UTC](https://community.starknet.io/t/starknet-devnet/69/11 "2021-12-02T09:52:11Z")

</div>

I think an easy way to do it is to assume a state is `unknown` unless it was already recovered from the forked state (by either `get_code` or` get_storage`). I don’t think there should be “mainnet” state and “devnet” state, but you just assume all the state is a snapshot of a specific block, and you discover it upon need.

> But I’m not sure about the L2-L2 interaction case: What if one contract is on mainnet and the other is on devnet; how would they interact?

They should just interact regularly, but you should fill in the state for `unknown` slots by making the calls mentioned above.

The only problem I can see with this approach is that the interaction with StarkNet is pretty slow at the moment, so it might make the interaction with the snapshot really slow.  
Hopefully it will be faster, and once API service like Infura/Figment will provide support for Starknet (yes it will happen sooner rather than later), they can also be used for that!

---

<div class="post-metadata">

**Author:** ![fracek](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fracek/32/23_2.png) [@fracek](https://community.starknet.io/u/fracek)\
**Post date:** [December 2, 2021, 11:19am UTC](https://community.starknet.io/t/starknet-devnet/69/12 "2021-12-02T11:19:37Z")

</div>

> [@FabijanC](#):
>
> Also, if there is an invoke request that changes the state of a previously deployed contract, how should the new state be preserved on the fork only? Could that previously deployed contract be copied to the fork when such need arises?

My understanding is that when the forked node receives a transaction that changes state, it applies the transaction to the mainnet state and store it in the fork. The challenge is then knowing what state is in the devnet fork and what is on mainnet. Ganache does that in their [implementation of the state trie](https://github.com/trufflesuite/ganache/blob/develop/src/chains/ethereum/ethereum/src/forking/trie.ts).

---

<div class="post-metadata">

**Author:** ![henrli](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/henrli/32/6_2.png) [@henrli](https://community.starknet.io/u/henrli)\
**Post date:** [December 3, 2021, 4:59pm UTC](https://community.starknet.io/t/starknet-devnet/69/13 "2021-12-03T16:59:37Z")

</div>

> [@bbrandtom](#):
>
> m I can see with this approach is that the interaction with StarkNet is pretty slow at the moment, so it might make the interaction with the snapshot really slow.  
> Hopefully it will be faster, and once API service like Infura/Figment will provide support for Starknet (yes it will happen sooner rather than later), they

Hello!  
Check this out [What's the API endpoint for Starknet? - #3 by fracek](https://community.starknet.io/t/whats-the-api-endpoint-for-starknet/53/3)  
We have not documented the http API yet, but somebody infered it:  
[What's the API endpoint for Starknet? - #3 by fracek](https://community.starknet.io/t/whats-the-api-endpoint-for-starknet/53/3)

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 4, 2021, 1:10am UTC](https://community.starknet.io/t/starknet-devnet/69/14 "2021-12-04T01:10:33Z")

</div>

Well, the devnet already provides basically the same HTTP API as testnet. Adding a `--fork` option to the devnet would just enable altering how the HTTP endpoints behave (sometimes communicate with testnet/mainnet). Hopefully next week I’ll be able to use the ideas mentioned here and see where that takes us.

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 15, 2021, 5:06pm UTC](https://community.starknet.io/t/starknet-devnet/69/15 "2021-12-15T17:06:14Z")

</div>

New version of `starknet-devnet` (v0.1.10) has been released ([GitHub](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.10)):

- Adapt to work with cairo-lang v0.6.2.
- Replicate the new transaction statuses (transactions are now `ACCEPTED_ON_L2`).

Features to come (most likely not in the next version): supporting `starknet get_block`, supporting `starknet get_transaction_receipt`, L1-L2 interaction, testnet/mainnet forking.

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [December 22, 2021, 4:44pm UTC](https://community.starknet.io/t/starknet-devnet/69/16 "2021-12-22T16:44:22Z")

</div>

So, the command `starknet get_code`:

- receives a `contract_address`
- returns an object with two parts:
  - `abi`
  - `bytecode`

I don’t understand two things

1. How can `abi` and `bytecode` be used to reconstruct the state? Can a `StarknetContract` or its `StarknetState` be reconstructed in the testing framework using those artifacts? Or, hypothetically speaking, could it be possible to redeploy a contract from those two artifacts?
2. `get_code` also receives a block identifier (hash or number) - how does that come into play? Does the code change over time?

I’ve only been able to make little progress on this topic, mostly because of dealing with other project-related issues; I apologize for not having done more.

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [January 12, 2022, 12:20pm UTC](https://community.starknet.io/t/starknet-devnet/69/17 "2022-01-12T12:20:53Z")

</div>

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

> **[Release v0.1.11 · Shard-Labs/starknet-devnet](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.11)**
>
> Usage
> 
> Add block support.
> Add partial receipt support (missing for deploy transcations; coming with next version of cairo-lang).
> Use official hash calculation function (instead of numbering tx hash...

- Add block support.

- Add partial receipt support (missing for deploy transactions; coming with next version of cairo-lang).

- Use official hash calculation function (instead of numbering tx hashes in order; block hash calculation coming with next version of cairo-lang).

- Refactor to prepare for the incoming forking support.

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [January 14, 2022, 9:56am UTC](https://community.starknet.io/t/starknet-devnet/69/18 "2022-01-14T09:56:42Z")

</div>

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

> **[Release v0.1.12 · Shard-Labs/starknet-devnet](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.12)**
>
> Usage
> 
> Prevent Internal Server Error (500) to arise if deployment fails.
> Ignore duplicate deployments (e.g. in case of same salt).
> 
> Dev
> 
> No developer-specific changes with this release.
> 
> PRs
> 
> Fix t...

- Prevent Internal Server Error (500) from arising if deployment fails.
- Ignore duplicate deployments (e.g. in case of same salt).

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [January 21, 2022, 6:06pm UTC](https://community.starknet.io/t/starknet-devnet/69/19 "2022-01-21T18:06:04Z")

</div>

New version of `starkent-devnet` (v0.1.13) has been released:

> **[Release v0.1.13 · Shard-Labs/starknet-devnet](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.13)**
>
> Usage
> 
> Use cairo-lang 0.7.0 for internal execution (will allow deploying contracts compiled with 0.7.0).
> Support arrays of structs in function inputs.
> Include execution info in deploy transactions....

- Use cairo-lang 0.7.0 for internal execution (will allow deploying contracts compiled with 0.7.0).
- Support arrays of structs in function inputs.
- Include execution info in deploy transaction receipt.
- Calculate block hash correctly.
- Improve logging if case of version mismatch (mismatch between version used for compilation and version used by devnet).

---

<div class="post-metadata">

**Author:** ![FabijanC](https://dub1.discourse-cdn.com/flex005/user_avatar/community.starknet.io/fabijanc/32/39_2.png) [@FabijanC](https://community.starknet.io/u/FabijanC)\
**Post date:** [February 2, 2022, 11:26am UTC](https://community.starknet.io/t/starknet-devnet/69/20 "2022-02-02T11:26:00Z")

</div>

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

> **[Release v0.1.14 · Shard-Labs/starknet-devnet](https://github.com/Shard-Labs/starknet-devnet/releases/tag/v0.1.14)**
>
> Usage
> 
> Include events in transaction receipts.
> Allow transactions/calls with no signature (so far empty signature was accepted, but some tools provide no signature at all, e.g. starknet.js)
> In tran...

- Include events in transaction receipts.
- Allow transactions/calls with no signature (so far empty signature was accepted, but some tools provide no signature at all, e.g. starknet.js).
- In transaction and receipt objects, rename `transaction_failure_reason` to `tx_failure_reason`:
  - This enables the `--error_message` option of `starknet tx_status`.

[Next page](https://community.starknet.io/t/starknet-devnet/69.md?page=2)
