Skip to main content
2 of 2
added 7142 characters in body

Unable to add pallets-contracts-rpc crate

When going through this tutorial for adding contracts to the default node template, adding pallets-contracts-rpc, the 4th recommended crate to install, I receive various errors. Things compile fine when only the first 3 crates are installed.

[package]
name = "node-template-runtime"
version = "4.0.0-dev"
description = "A fresh FRAME-based Substrate runtime, ready for hacking."
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
edition = "2021"
license = "Unlicense"
publish = false
repository = "https://github.com/substrate-developer-hub/substrate-node-template/"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }

pallet-aura = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-randomness-collective-flip = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24", optional = true }
pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-block-builder = {  version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24"}
sp-consensus-aura = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-core = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24"}
sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-runtime = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-std = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
sp-version = { version = "5.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }

# Used for the node template's RPCs
frame-system-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }

# Used for runtime benchmarking
frame-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24", optional = true }
frame-system-benchmarking = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24", optional = true }
hex-literal = { version = "0.3.4", optional = true }

pallet-contracts = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-contracts-primitives = { version = "6.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-contracts-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }
pallet-contracts-rpc = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }

# Local Dependencies
pallet-template = { version = "4.0.0-dev", default-features = false, path = "../pallets/template" }

[build-dependencies]
substrate-wasm-builder = { version = "5.0.0-dev", git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.24" }

[features]
default = ["std"]
std = [
    "codec/std",
    "scale-info/std",
    "frame-executive/std",
    "frame-support/std",
    "frame-system-rpc-runtime-api/std",
    "frame-system/std",
    "pallet-aura/std",
    "pallet-balances/std",
    "pallet-grandpa/std",
    "pallet-randomness-collective-flip/std",
    "pallet-sudo/std",
    "pallet-template/std",
    "pallet-timestamp/std",
    "pallet-transaction-payment-rpc-runtime-api/std",
    "pallet-transaction-payment/std",
    "pallet-contracts/std",
    "pallet-contracts-rpc-runtime-api/std",
    "sp-api/std",
    "sp-block-builder/std",
    "sp-consensus-aura/std",
    "sp-core/std",
    "sp-inherents/std",
    "sp-offchain/std",
    "sp-runtime/std",
    "sp-session/std",
    "sp-std/std",
    "sp-transaction-pool/std",
    "sp-version/std",
]
runtime-benchmarks = [
    "frame-benchmarking/runtime-benchmarks",
    "frame-support/runtime-benchmarks",
    "frame-system-benchmarking",
    "frame-system/runtime-benchmarks",
    "hex-literal",
    "pallet-balances/runtime-benchmarks",
    "pallet-grandpa/runtime-benchmarks",
    "pallet-template/runtime-benchmarks",
    "pallet-timestamp/runtime-benchmarks",
    "sp-runtime/runtime-benchmarks",
]
try-runtime = [
    "frame-executive/try-runtime",
    "frame-try-runtime",
    "frame-system/try-runtime",
    "pallet-aura/try-runtime",
    "pallet-balances/try-runtime",
    "pallet-grandpa/try-runtime",
    "pallet-randomness-collective-flip/try-runtime",
    "pallet-sudo/try-runtime",
    "pallet-template/try-runtime",
    "pallet-timestamp/try-runtime",
    "pallet-transaction-payment/try-runtime",
]

...
  error[E0308]: mismatched types
      --> /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/socket.rs:1777:25
       |
  1777 | from!(net::TcpListener, Socket);
       |                         ^^^^^^ expected struct `Socket`, found `()`
       |
      ::: /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:104:16
       |
  104  |             fn from(socket: $from) -> $for {
       |                ---- implicitly returns `()` as its body has no tail or `return` expression

  error[E0308]: mismatched types
      --> /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/socket.rs:1778:23
       |
  1778 | from!(net::UdpSocket, Socket);
       |                       ^^^^^^ expected struct `Socket`, found `()`
       |
      ::: /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:104:16
       |
  104  |             fn from(socket: $from) -> $for {
       |                ---- implicitly returns `()` as its body has no tail or `return` expression

  error[E0308]: mismatched types
      --> /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/socket.rs:1779:15
       |
  1779 | from!(Socket, net::TcpStream);
       |               ^^^^^^^^^^^^^^ expected struct `TcpStream`, found `()`
       |
      ::: /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:104:16
       |
  104  |             fn from(socket: $from) -> $for {
       |                ---- implicitly returns `()` as its body has no tail or `return` expression

  error[E0308]: mismatched types
      --> /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/socket.rs:1780:15
       |
  1780 | from!(Socket, net::TcpListener);
       |               ^^^^^^^^^^^^^^^^ expected struct `TcpListener`, found `()`
       |
      ::: /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:104:16
       |
  104  |             fn from(socket: $from) -> $for {
       |                ---- implicitly returns `()` as its body has no tail or `return` expression

  error[E0308]: mismatched types
      --> /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/socket.rs:1781:15
       |
  1781 | from!(Socket, net::UdpSocket);
       |               ^^^^^^^^^^^^^^ expected struct `UdpSocket`, found `()`
       |
      ::: /Users/g/.cargo/registry/src/github.com-1ecc6299db9ec823/socket2-0.4.4/src/lib.rs:104:16
       |
  104  |             fn from(socket: $from) -> $for {
       |                ---- implicitly returns `()` as its body has no tail or `return` expression

...

It seems on the contracts node template that crate is not installed. https://github.com/paritytech/substrate-contracts-node/blob/main/runtime/Cargo.toml