Zilliqa/zilliqa-js

cannot deploy a contract

euj1n0ng opened this issue · 7 comments

I wanted to deploy a contract on Zilliqa chain (testnet) with my wallet but couldn't do it by using Contract.prototype.deploy of @zilliqa-js/contract.

I was able to get the contract address by using Contract.prototype.deployWithoutConfirmation, and with this address, confirmed its deployment status (isDeployed returned true, isRejected returned false and the contract's ContractStatus was 0.)
However, inspite of all these, I couldn't find the corresponding transaction history on Block exploerer for testnet and couldn't import the deployed contract on IDE, either.

Node.js app always tells the contract has been deployed but nothing could be from the truth.

I confirmed this repo's example code works correctly but when I substituted the private key with mine, a contract wasn't deployed even after 33 attempts.
My current balance is 278.864 ZIL so it was sufficient to do the transaction.

Could you help me understand this circumstance?

Hey, can you provide your contract code (and init.json)? Would like to see the detail of your deploying script.

https://github.com/arnavvohra/document-store/blob/master/DocumentStore.scilla
[ { type: 'ByStr20', value: ${publicKey}, vname: 'contract_owner' }, { type: 'String', value: 'NextCertStore', vname: 'name' }, { type: 'String', value: '1.0', vname: 'version' }, { vname: '_scilla_version', type: 'Uint32', value: '0', } ]

https://github.com/Zilliqa/Zilliqa-JavaScript-Library/blob/dev/examples/deployContract.js
[ // this parameter is mandatory for all init arrays { vname: '_scilla_version', type: 'Uint32', value: '0', }, { vname: 'owner', type: 'ByStr20', value: ${address}, }, ]

The obvious thing is that when I tested your example code, I just changed only the private key value with mine. After that, it stopped working. Really weird to me.
Thanks for your response.

Simple change of an account (private and public key change) resolved my issue.
How can I get a stable wallet account?

{ type: 'ByStr20', value: ${publicKey}, vname: 'contract_owner' } should be ${address} not public key. To get a test account, you can try https://dev-wallet.zilliqa.com, try to generate one and get some test zils.

You can also join our discord, https://discord.gg/aRyReY

Okay, thanks.