1

I tried to add Chain bridge and example to our existing substrate relay-chain, but I got an error during this import

(use sp_io::hashing::blake2_128;)

Please let me know how to add this import . I have also attached a screenshot to this post.

Thanks in advance.enter image description here

1
  • Can you share the Cargo.toml?
    – Alex Bean
    Commented Nov 8, 2023 at 9:06

3 Answers 3

1

you can run cargo update for find and remove old packages and update that to new version . i faced this problem and it fixed by this command .

-1

It appears that there might be a duplicate dependency in your cargo.toml file, or you might have overlooked adding a dependency to your std. Could you kindly provide the link to your code so that we can investigate the cargo toml?

1
  • Thanks for your reply Please check the above answer from the post I have posted because in the comment section I am not able to upload the screenshot.
    – support
    Commented Aug 31, 2023 at 6:04
-2

Hi Thanks for your response ,

The below file is my cargo.toml code inside the runtime folder please check and let me know here.I want to add this line in inside the lib.rs file (use sp_io::hashing::blake2_128;)

name = "node-template-runtime"
version = "4.0.0-dev"
description = "A fresh FRAME-based Substrate node, ready for hacking."
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
edition = "2021"
license = "MIT-0"
publish = false
syn = "1.0.94"
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.6.1", default-features = false, features = ["derive"] }
scale-info = { version = "2.5.0", default-features = false, features = ["derive"] }
pallet-aura = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-balances = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-support = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-system = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-sudo = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }

frame-try-runtime = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", optional = true , branch = "polkadot-v1.0.0" }
pallet-timestamp = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
pallet-transaction-payment = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
frame-executive = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-block-builder = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-consensus-aura = { version = "0.10.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-consensus-grandpa = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-core = { version = "21.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-inherents = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-offchain = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-runtime = { version = "24.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-session = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-std = { version = "8.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-transaction-pool = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-version = { version = "22.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-io = {version = "2.0.0",default-features = false }

# 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-v1.0.0" }
pallet-transaction-payment-rpc-runtime-api = { version = "4.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }

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

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

[dependencies.chainbridge]
default-features = false
git = 'https://github.com/ChainSafe/chainbridge-substrate'
package = 'chainbridge'
tag = 'v1.3.0'

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

[features]
default = ["std"]
std = [
    "sp-io/std",
    "frame-try-runtime?/std",
    "frame-system-benchmarking?/std",
    "frame-benchmarking?/std",
    "codec/std",
    "scale-info/std",
    "frame-executive/std",
    "frame-support/std",
    "frame-system-rpc-runtime-api/std",
    "frame-system/std",
    "frame-try-runtime/std",
    "pallet-aura/std",
    "pallet-balances/std",
    "pallet-grandpa/std",
    "pallet-sudo/std",
    "pallet-template/std",
    "pallet-timestamp/std",
    "pallet-transaction-payment-rpc-runtime-api/std",
    "pallet-transaction-payment/std",
    "sp-api/std",
    "sp-block-builder/std",
    "sp-consensus-aura/std",
    "sp-consensus-grandpa/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",
    "substrate-wasm-builder",   
    "chainbridge/std",
    
]
runtime-benchmarks = [
    "frame-benchmarking/runtime-benchmarks",
    "frame-support/runtime-benchmarks",
    "frame-system-benchmarking/runtime-benchmarks",
    "frame-system/runtime-benchmarks",
    "pallet-balances/runtime-benchmarks",
    "pallet-grandpa/runtime-benchmarks",
    "pallet-sudo/runtime-benchmarks",
    "pallet-template/runtime-benchmarks",
    "pallet-timestamp/runtime-benchmarks",
    "sp-runtime/runtime-benchmarks",
]
try-runtime = [
    "frame-try-runtime/try-runtime",
    "frame-executive/try-runtime",
    "frame-system/try-runtime",
    "frame-support/try-runtime",
    "pallet-aura/try-runtime",
    "pallet-balances/try-runtime",
    "pallet-grandpa/try-runtime",
    "pallet-sudo/try-runtime",
    "pallet-template/try-runtime",
    "pallet-timestamp/try-runtime",
    "pallet-transaction-payment/try-runtime",
]

enter image description here

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.