Multiple deploys with same Contract Id

Hello, I’m pretty new to FuelVM and Sway and I was going through the docs and the “Getting Started” flow yesterday deploying to beta-2.

There’s a couple of things I don’t fully understand and would appreciate any help you can give me clearing them up:

The Counter contract I deployed had the same exact Contract Id that was present in the “Getting Started” page. I’m not sure if I’m correctly understanding the Contract ID computing formula but it seems that given the same exact contract bytecode, without the addition of salt to the sha256, the Contract ID will always be the same. Is this correct?

If that is the case then how are multiple deploys of the same bytecode (without salt) are handled?
I deployed the same contract twice and after the second deployment it seemed like the storage of the previous deployment was reset.

You can find the transactions in question

The zeroth output for both of them are the same Contract ID.

I’m sorry if this is a dumb question but I don’t really understand what’s happening here.


Not a dumb question - the client should indeed be forbidding duplicate contract Ids (i.e. requiring salt to distinguish contracts with identical bytecode and initial storage configuration).

We fixed this here, and should be pushing this to the testnet very shortly.


Thanks for taking the time to reply and clearing things up, I was feeling pretty lost as to what I was missing :pray:

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.