0

I am using the Pallet-contract module in my Substrate chain and I would like to upload a smart contract. I have the following questions:

enter image description here

What should I put in the code input field? Do I need to upload the Wasm file or the .contract file?

What is the deposit limit, and how can I set it?

What is determinism, and how can I ensure that my smart contract is deterministic?

Any help and guidance on this topic would be greatly appreciated. Thank you!

1 Answer 1

1

In the code of your Smart Contract you run:

  cargo contract build

And this will generate the following files:

    Your contract artifacts are ready. You can find them in:
/Users/dev-docs/flipper/target/ink

- flipper.contract (code + metadata)
- flipper.wasm (the contract's code)
- metadata.json (the contract's metadata)

What you have to put on the code input field is the .contract file, this file contains the bundled Wasm blob and metadata.

The storage_deposit_limit is the maximum amount of balance that can be charged from the caller to pay for the storage consumed. So you as the creator of the contract can limit the amount of deposit that can be charged.

In order for the nodes in a blockchain network to reach agreement on the state of the chain, all operations must be completely deterministic. Check this previous answer in StackExchange about the determinisim of the contracts in ink: Is the WASM blob created from ink! contract always deterministic.

Finally as a guide about how to upload SC I suggest you to use the Contracts-UI tool in allows you to connect to any chain and your local chain and it has an UI that makes easier to execute the extrinsics needed for the deployment.

You can also use the tool cargo-contract which is a CLI tool which helps you develop smart contracts in Parity's ink!.

cargo contract build
cargo contract upload --suri //Alice
cargo contract instantiate --suri //Alice --args true

For more information check this tutorials:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.