# "Instantiate contract failed". Contract uploaded to testnet but not initialized on command

**URL:** <https://forum.scrt.network/t/instantiate-contract-failed-contract-uploaded-to-testnet-but-not-initialized-on-command/6418>\
**Category:** Developer Help\
**Created:** [September 24, 2022, 9:53am UTC](https://forum.scrt.network/t/instantiate-contract-failed-contract-uploaded-to-testnet-but-not-initialized-on-command/6418 "2022-09-24T09:53:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ds444](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/ds444/32/3040_2.png) [@Ds444](https://forum.scrt.network/u/Ds444)\
**Post date:** [September 24, 2022, 9:53am UTC](https://forum.scrt.network/t/instantiate-contract-failed-contract-uploaded-to-testnet-but-not-initialized-on-command/6418/1 "2022-09-24T09:53:16Z")

</div>

Hi. What am I doing wrong?

1. I compile this contract without changes: [GitHub - scrtlabs/snip20-reference-impl: This is a reference implementation of the SNIP-20 standard.](https://github.com/scrtlabs/snip20-reference-impl)
2. Compilation:

```auto
cd /home/user/snip20-reference-impl-master

docker run --rm -v "$(pwd)":/contract \
  --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
  --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
  enigmampc/secret-contract-optimizer:1.0.5

```

1. I upload contract.wasm.gz to the test network:  
`secretcli tx compute store /home/user/snip20-reference-impl-master/contract.wasm.gz --from Promelec --gas 6000000 --gas-prices=1.0uscrt`
2. Stored contract: [https://secretnodes.com/pulsar/transactions/A108DA7BF609EAE92F285DA7C0CF2CE6F63EDFB29BBDBBFF414F0ADE2287A9CA](https://secretnodes.com/pulsar/transactions/A108DA7BF609EAE92F285DA7C0CF2CE6F63EDFB29BBDBBFF414F0ADE2287A9CA)
3. I initiate the contract:  
`secretcli tx compute instantiate 12680 '{"name":"secret-secret","symbol":"sSCRT","decimals":6,"prng_seed":"c2VjcmV0","config":{"public_total_supply":true,"enable_deposit":false,"enable_redeem":false,"enable_mint":true,"enable_burn":true}}' --label mycustomtoken1234567 --from Promelec -- gas 6000000`
4. Constantly the same error during different initialization attempts:

```auto
"raw_log": 
"failed to execute message; message index: 0: encrypted: 983wGiMQWjxVzFgNFQY4rNneTTls8kdOgXFnxWyYglqQbBOTyri8HAZadnvX04/QQdObazQeEa44l6jik2E+jmgewATg0ri8e879E6W/3Z1TDYl81Ts5oqr1d+I=: instantiate contract failed"

```

Who managed to initialize this contract after compiling and uploading to the test network, please write a step-by-step algorithm of actions with commands that have values filled in.

---

<div class="post-metadata">

**Author:** ![taariq](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/taariq/32/291_2.png) [@taariq](https://forum.scrt.network/u/taariq)\
**Post date:** [September 24, 2022, 12:45pm UTC](https://forum.scrt.network/t/instantiate-contract-failed-contract-uploaded-to-testnet-but-not-initialized-on-command/6418/2 "2022-09-24T12:45:22Z")

</div>

For the next person to have a look, I also took a stab and got the same error.

The logs point to this [line of code](https://github.com/scrtlabs/SecretNetwork/blob/a527377aadd4b3146522b040d7dab868ed44a659/cosmwasm/enclaves/shared/contract-engine/src/contract_validation.rs#L235) , it’s the only place in the source where this warning is printed…

“WARN [enclave\_contract\_engine::contract\_validation] Got message with malformed contract hash”

I also tried checking out the last 2 tags after master branch, as well as a newer optimizer image, same results.

---

<div class="post-metadata">

**Author:** ![taariq](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.scrt.network/taariq/32/291_2.png) [@taariq](https://forum.scrt.network/u/taariq)\
**Post date:** [September 28, 2022, 5:04pm UTC](https://forum.scrt.network/t/instantiate-contract-failed-contract-uploaded-to-testnet-but-not-initialized-on-command/6418/3 "2022-09-28T17:04:21Z")

</div>

@Ds444 Not sure if that was you in Discord facing the same issue, but I was also using an outdated secretcli version on my local machine.  
After updating secretcli I couldn’t reproduce the issue.

[Here’s a contract I instantiated with your uploaded code id](https://secretnodes.com/pulsar/transactions/348CBF32EF27BC471AB84521636466D6E4C08FDBE7059BB22AC3784D7A11F146)

And here’s the command to init, but I’m hopeful that your own command will work after updating.

```auto
secretcli tx compute instantiate 12680 '{"name":"acme","symbol":"ACX","decimals":6,"prng_seed":"c2VjcmV0","config":{"public_total_supply":true,"enable_deposit":false,"enable_redeem":false,"enable_mint":true,"enable_burn":true}}' --label anothercustomtoken2 --from discord1_test --gas 6000000

```
