I am trying to couple substrate node-template to frame support in order to use trait currency. Link to github link

Error -

error: failed to run custom build command for `node-template-runtime v4.0.0-dev (/data/substrate-node-template/runtime)`

Caused by:
  process didn't exit successfully: `/data/substrate-node-template/target/release/build/node-template-runtime-55554732df6f82a1/build-script-build` (exit status: 1)
  --- stdout
  Information that should be included in a bug report.
  Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/data/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--profile" "release"
  Using rustc version: rustc 1.65.0-nightly (02654a084 2022-08-30)

  --- stderr
     Compiling node-template-runtime v4.0.0-dev (/data/substrate-node-template/runtime)
  warning: unused import: `frame_support::traits::Currency`
   --> /data/substrate-node-template/runtime/src/lib.rs:9:5
  9 | use frame_support::traits::Currency;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: `#[warn(unused_imports)]` on by default

  error[E0277]: the trait bound `u128: Currency<AccountId32>` is not satisfied
     --> /data/substrate-node-template/runtime/src/lib.rs:272:19
  272 |      type Currency = Balance;
      |                      ^^^^^^^ the trait `Currency<AccountId32>` is not implemented for `u128`
      = help: the trait `Currency<<T as frame_system::Config>::AccountId>` is implemented for `pallet_balances::Pallet<T, I>`
  note: required by a bound in `pallet_template::Config::Currency`
     --> /data/substrate-node-template/pallets/template/src/lib.rs:36:18
  36  |         type Currency: Currency<Self::AccountId>;
      |                        ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `pallet_template::Config::Currency`

  For more information about this error, try `rustc --explain E0277`.
  warning: `node-template-runtime` (lib) generated 1 warning
  error: could not compile `node-template-runtime` due to previous error; 1 warning 

emittedenter code here

1 Answer 1


I suspect you need to write type Currency = Balances, not Balance. While Balances is an instance of pallet_balances, Balance is just an alias for u128. It's the former that implements the Currency trait, not the latter.


Your Answer

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

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