Skip to content

Instantly share code, notes, and snippets.

@franciscoaguirre
Created May 14, 2025 11:33
Show Gist options
  • Select an option

  • Save franciscoaguirre/e7d26c2dd720ca15531f74b3656c0a4f to your computer and use it in GitHub Desktop.

Select an option

Save franciscoaguirre/e7d26c2dd720ca15531f74b3656c0a4f to your computer and use it in GitHub Desktop.
How to get a utility derived account in FRAME
#[test]
fn whats_the_derived_account_id() {
use sp_runtime::AccountId32;
let account_id = AccountId32::from_ss58check("13YMK2ehDHE4hoxL9L2jq4h8zwMFpo4cZnrR7YwzgxxSH8LR").unwrap();
let result = pallet_utility::Pallet::<Runtime>::derivative_account_id(account_id, 0);
let derived_account_id = result.to_ss58check_with_version(42_u16.into());
dbg!(&derived_account_id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment