Skip to main content
As you can imagine, if your deployed contract instance or the code that backs it is archived, it can’t be loaded to execute your invocations. Remember, there’s a distinct, one-to-many relationship on the chain between a contract’s code and deployed instances of that contract: We need both to be live for our contract calls to work. Let’s work through how these can be recovered. The recovery process is slightly different for a convenient reason: we don’t need simulation to figure out the footprints. Instead, we can leverage Contract.getFootprint() to get the ledger key of the contract instance (in Python, Go, and Java, we build the same key from the contract address). That key doesn’t cover the backing WASM code, so we read the instance entry once to find its WASM hash and build the code’s ledger key from it. Unfortunately, we still need simulation to figure out the fees for our restoration. This, however, can be easily covered by the SDK’s Server.prepareTransaction() helper, which will do simulation and assembly for us. The Go SDK has no such helper, so the Go tab defines a small prepareTransaction. The Java SDK has prepareTransaction, and the Java tab’s methods go in the SubmitTx class.
This guide makes use of the (aptly named) submitTx function (submit_tx in Python) we created in another guide.