Skip to main content
7 votes
Accepted

Ink cannot derive SpreadLayout and SpreadAllocate for simple struct and enum

SpreadAllocate can't be derived for the enums(issue), so you should implement it manually. You are deriving SpreadLayout wrong=) #[cfg_attr(feature = "std", derive(...)] means - derive it ...
Green Baneling's user avatar
6 votes
Accepted

How to enable chain extensions?

Make sure you have type ChainExtension defined in your runtime: impl pallet_contracts::Config for Runtime { .... type ChainExtension = FetchRandomExtension; } ...as indicated in the docs: ...
Bruno's user avatar
  • 8,335
5 votes
Accepted

Is there a substrate node that contains pallet-contracts and uses instant seal consensus?

The substrate contracts node already uses instant seal. Just update to the latest version.
Alexander Theißen's user avatar
5 votes
Accepted

trait bounds not satisfied with Executive::try_runtime_upgrade()

You are missing features on the pallet crates. The following patch fixed this: diff --git a/runtime/Cargo.toml b/runtime/Cargo.toml index 9a8d59f..4eebddd 100644 --- a/runtime/Cargo.toml +++ b/runtime/...
Oliver Tale-Yazdi's user avatar
5 votes
Accepted

Generate random number ink!

The Keccak256 hash algorithm produces a 256-bit (32-byte) hash, and its associated type Type is [u8; 32]. In your code you always take just output[0] of type u8 and your result is always less than u8::...
Maario's user avatar
  • 659
4 votes
Accepted

How to do contract RPC call?

Looks like your gasLimit is too low. Increase gas limit or simply set it to -1 which will use max. gas available.
Bobo K.'s user avatar
  • 386
4 votes

Call ink contract using rust

With Rust, it's a bit more complicated than with JS/TS. Here's an example of how to call a contract using subxt: // assuming you have `api` and the contract address let mut call_data = Vec::<u8>:...
Oleksandr Mykhailenko's user avatar
4 votes
Accepted

Ink tutorial: substrate-contracts-node does not produce blocks

Substrate contracts node uses instant block seals. You need to send transactions to produce blocks. The instant seal consensus engine, and its cousin the manual seal consensus engine, are both ...
Burak's user avatar
  • 903
4 votes
Accepted

cargo-contract cannot build using the "stable" channel. Switch to nightly

It depends on the cargo-contract version. Pre 2.0.0 versions of cargo-contract use the nightly toolchain of rust. You can get it with rustup toolchain add nightly and then build with cargo +nightly ...
kriko.eth's user avatar
  • 764
3 votes
Accepted

Error when installing substrate-contracts-node (v0.17.0, v0.18.0)

This is likely caused by an old Rust toolchain being used for the installation on your local machine. You can check which toolchain is used by executing rustup show before the cargo install command. ...
cmichi's user avatar
  • 2,800
3 votes

I get a "The executed contract exhausted its gas limit." when attempting to instantiate a contract

Every contract execution whether it is an instantiation or a call needs to set a parameter named gas_limit to cap how much execution it is allowed to perform. This is necessary because whoever sends a ...
Alexander Theißen's user avatar
3 votes
Accepted

Getting ink! contract metadata from the chain

Metadata is not stored on chain to avoid bloat. Only the compiled wasm is uploaded to the chain. This is the same way it works on Ethereum with compiled solidity being stored on-chain. As pointed out ...
forgetso's user avatar
  • 1,514
3 votes
Accepted

What is the best way to make a cross contract call on Ink!

Point one is deprecated, and you can use only the second right now. In the future ink! will support dyn Trait notation. So you will be enough to have a trait to do cross-contract calls. Right now ...
Green Baneling's user avatar
3 votes
Accepted

unable to upload ink! contract in polkadot-JS

The current version of substrate supports a new version of "weights", whereby it is no longer just the execution time (a.k.a "gas") but also accounts for the "proof size" ...
Andrew Jones's user avatar
3 votes
Accepted

`total_supply` function return value on erc20(psp22)

The UI will read your contract metadata and if the argument of the method is Balance then, by default, it will apply the chain-decimals. That is why if you input 1 in for a Balance field in Shibuya it ...
P.Ossun's user avatar
  • 1,219
3 votes

How to change the native token in Substrate to a custom token?

All you need to do is set a custom property for token symbol in the chainspec.rs file in the function where you generate the chainspec config. This is typically a function that goes by the name of ...
Purple_Turtle's user avatar
3 votes

How to change the native token in Substrate to a custom token?

You can create a function like this: https://github.com/darwinia-network/darwinia/blob/2d1c1436594b2c397d450e317c35eb16c71105d6/node/service/src/chain_spec/darwinia.rs#L52-L61 Replace the names and ...
AurevoirXavier's user avatar
  • 10.8k
3 votes
Accepted

contracts.OutofGas when i want to uplooad smart contract

As stated in the comments, the polkadot-js UI unfortunately doesn't support Weights V2 yet. You are better off using https://contracts-ui.substrate.io/ for now.
cmichi's user avatar
  • 2,800
3 votes
Accepted

Substrate node template fees deduction using native token

The default implementation is using the native token. You should revert your stable-coin changes. Balances is the native token pallet. https://github.com/substrate-developer-hub/substrate-node-...
AurevoirXavier's user avatar
  • 10.8k
3 votes
Accepted

Can I deploy an old ink! v3.x contract on the latest version of substrate/polkadot (pallet-contracts >= polkadot-v0.9.37)?

You can deploy old ink! contracts to newer versions of pallet-contracts. The pallet is backwards compatible. Note that you will have to use a cargo-contract version from before 2.0: cargo install ...
cmichi's user avatar
  • 2,800
3 votes

What is the purpose of installing cargo-contract and using it to create Ink! Rust smart contracts?

To develop Ink! smart contracts using Rust, you need to install the cargo-contract tool. cargo-contract is a Cargo subcommand specifically designed for developing smart contracts on the Substrate ...
Arunjot Singh's user avatar
2 votes
Accepted

Mint Fungible Token Development Network

substrate-contracts-node is a template project for smart contract only, for token test you need to add Asset and Nft pallet into runtime like cumulus
Ron's user avatar
  • 608
2 votes

Why is result.status undefined in an extrinsic's SubmittableResult?

This was because I was instantiating the contract with HttpProvider instead of WsProvider. Changing to WsProvider allows the extrinsic result to be a subscription and therefore update with extra ...
forgetso's user avatar
  • 1,514
2 votes

How to speed up compilation

I've written another answer on the general topic here, this might already help you further. But since you specifically tagged for substrate-contracts-node: There are binary releases available at the ...
cmichi's user avatar
  • 2,800
2 votes
Accepted

How to speed up compilation

you can use cargo remote with a cloud server to significantly reduce the build time (few minutes depending on the server power). there is a detailed post about this topic : https://www.chevdor.com/...
Badr Bellaj's user avatar
2 votes

How can I deploy & interact with contract on substrate using rust, not polkadot js?

There are some examples of working with contracts in the subxt tests (see https://github.com/paritytech/subxt/blob/master/testing/integration-tests/src/frame/contracts.rs#L58). There's also this Rust ...
jsdw's user avatar
  • 1,335
2 votes

Error Building Substrate contract Node(error[E0603]: module `group` is private) After switching Substrate dependencies to "polkadot-v0.9.23"

For better old version compatibility. cargo update -p syn --precise 1.0.96 I'm on polkadot-v0.9.23 too. And I don't want to change my stable toolchain. This could be the best option.
AurevoirXavier's user avatar
  • 10.8k
2 votes
Accepted

how to upload contract using substrate-front-end-template

I recommend you read the following tutorials: https://docs.substrate.io/tutorials/smart-contracts Typically the process is as follows: Write your smart contract using ink! Build your ink! smart ...
Bruno's user avatar
  • 8,335
2 votes
Accepted

ink_env::ecdsa_recover is not returning the right public key

So I figured the signature creation in polkadotJS is to receive the raw data and not the hash. More so, I had to generate the public key this way: const mnemonic = mnemonicGenerate(); const keyring = ...
dharjeezy's user avatar
  • 419
2 votes
Accepted

Cannot deploy on Contracts-UI using local node

Looks like you are using the substrate node template repo. Try to use the substrate-contracts-node instead. Install and run the node Clone the repo: git clone https://github.com/paritytech/substrate-...
SebastienPattyn's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible