1

Cargo Contract is a popular tool for developing ink! contracts.

This tool is known to work well with the substrate contracts node, and I thought it should work with other chains that support pallet contracts as well.

I'm currently trying to adapt cargo contract to work with Substrate chains that use the AccountId20 type and EthereumSignatures instead of the more "normal" AccoutId32 type.

My question is, what is the content and purpose of the contracts_runtime.scale file? If I had to guess I would guess that it is scale encoded metadata from the substrate contracts node. But is that right? And if so, do I need to supply my own encoded metadata to make cargo contract work with my chain?

2 Answers 2

1

The metadata was downloaded from a running substrate-contracts-node and is used to generate the APIs and types required for constructing contract extrinsics and querying storage from a compatible node.

Therefore, at the moment cargo-contract will only work against nodes which are compatible with these types. Supporting nodes using different types and configurations will indeed require downloading and storing the metadata for each different target node.

So for compatibility with multiple node configurations will require making the codebase generic over the environment types e.g. AccountId and Balance, and additionally supporting the metadata for multiple nodes.

It is a hugely important goal for us to support this functionality for any type of chain which uses pallet-contracts.

Related issue: https://github.com/paritytech/cargo-contract/issues/1168

0

I found some helpful context in the docs for the subxt macro https://docs.rs/subxt/0.29.0/subxt/attr.subxt.html

I guess this macro generates a strongly typed API from the metadata. So I guess in the case of changing the AccountId type, I would need to re-generate the metadata.

I still don't know the exact binary format, but that doesn't matter so much to me.

Your Answer

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

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