Tutorial eSealing example and concordium-client

Hi!

I am currently working through the tutorials and are now stuck with the eSealing application.
(From here: concordium-rust-smart-contracts/examples/eSealing at main · Concordium/concordium-rust-smart-contracts · GitHub)

First I try to build/deploy/init the app by following 3 commands (run in order):

cargo concordium build --out dist/module.wasm.v1 --schema-out dist/schema.bin
concordium-client module deploy dist/module.wasm.v1 --sender {concordium_account} --name {contract_name} --grpc-port {grpc_port}
concordium-client contract init {module_id} --sender {concordium_account} --energy 30000 --contract {contract_name} --grpc-port {grpc_port}

These seems to work fine if I set grpc_port == 10001, but if I change it to 20001 as the example suggests, I get following error.
concordium-client: user error (gRPC error: not enough bytes)

So continuing with the port working, I run following:

concordium-client contract update {contract_instance} --entrypoint registerFile --sender {concordium_account} --energy 30000 --parameter-json {file_path} --grpc-port {grpc_port}

Which leads to following error:
Error: Could not parse the json parameter because a no schema was embedded in the module or provided with the --schema flag.

So any suggestions to further progress is welcomed with open arms :slight_smile:

Bonus Question:
In the function definitions:

#[init(contract = "eSealingtest7", event = "Event")]

Is it then possible to use a variable in place for the “eSealingtest7”? To prevent having to change all manually? My attempts so far to create the variable is:

//static CONTRACT_NAME: &str = "eSealing";
//static CONTRACT_NAME_L: &str = CONTRACT_NAME.as_str();

But both cases I get an error stating it expect a string literal? Any way to circumvent?

Thanks in advance and good day! :slight_smile:

  1. The missing schema error is because you did not embed it.
cargo concordium build --out dist/module.wasm.v1 --schema-out dist/schema.bin --schema-embed

should fix that for you (–schema-embed is the relevant flag) if you redeploy the module.

  1. Which version of the client are you using. The latest version needs port 20001, but all previous versions will need 10001 since they work with V1 API.

  2. The name has to be a string literal.

1 Like
  1. Worked perfectly! :slight_smile: But for understanding is this something that should be included normally, or just in specific / this case?

  2. Where can I see which version I am using? Is there a command?

  3. So this has to be a hardcoded string at all positions and not possible to make into a variable defined one place?

Thanks for the insights!

  1. By default the schema is not embedded. You have to choose to embed it every time you build a new contract.

  2. concordium-client --version

  3. Yes, that is correct.