15
votes
Accepted
Generate AccountId from sr25519::Public
In general you can't unless AccountId is bound to a trait which actually provides you with a conversion function which does what you want.
The frame_system::Config::AccountId which I'd presume you're ...
13
votes
Accepted
What are some good use cases for anonymous proxies?
One good use case is to be able to transfer ownership of a multisig member. Since multisig AccountIds are derived based on their members, changing one member changes the address of the multisig. If ...
11
votes
Accepted
Why is there no `Default` implementation for `T::AccountId`?
Short answer: AccountId is not designed to be bound to Default. A "default" AccountId doesn't make any sense to have and it helped mask a previous issue and so it was removed in a recent ...
10
votes
How to bind an Ethereum H160 address with a Substrate H256 address?
H160 has a few flavors that you might pursue in the context of a Substrate chain:
If you are looking to map H160 Ethereum addresses to, say, SR25519 that is most common in Substrate chains, it is ...
10
votes
Accepted
What are the predefined accounts (ALICE, BOB, etc)?
The Balances pallet supports a Genesis Configuration which allows you to specify a set of accounts and balances that should exist at the genesis of your chain.
For a developer chain (using --dev), ...
10
votes
How to convert a Substrate address to an Etherum address?
The Ethereum address correspond to the last 20 bytes of the keccak-256 hash of the (decompressed) secp256k1 public key.
For example, given the following key generated via subkey tool:
❯ subkey ...
9
votes
Can I have one controller account from which I can handle/control the funds of multiple stash accounts?
You cannot have one controller account to handle/control many stash accounts but you can use proxies to achieve that. Stash<>Controller is a strictly one-to-one relationship but proxies are many-...
9
votes
Accepted
<T::Lookup as StaticLookup>::Source vs T::AccountId?
Shawn has explained a lot.
Let me give you a real example.
I've implemented a custom AccoundIdLookup for Darwinia, which allows transfer from Substrate address to EVM address directly.
https://github....
8
votes
Accepted
Get account transactions using Substrate API
Substrate indeed covers quite many use-cases, not just transferring coins from one account to another, and some of that complexity will leak through any API, even if there are specialized ones in the ...
8
votes
Is it possible to define a custom origin in my pallet?
You can add and create custom origins in pallets.
In your pallet, you define the origin type.
use frame_support::pallet_prelude::*;
use pallet::*;
use sp_runtime::traits::BadOrigin;
#[frame_support::...
7
votes
Accepted
How do treasury accounts compare to end user accounts in FRAME?
I would like to understand how treasury accounts are created and used under the hood
You can see here for a similar explanation on sub-accounts.
To walk through the specific steps here:
Here is the ...
7
votes
<T::Lookup as StaticLookup>::Source vs T::AccountId?
You can start by looking at the trait:
/// Means of changing one type into another in a manner dependent on the source type.
/// This variant is different to `Lookup` in that it doesn't (can cannot) ...
6
votes
Get account transactions using Substrate API
No blockchain is designed to be able to easily get all transactions for an account, as this is a waste of storage for a normal syncing chain.
Substrate provide the ability to run an Archive node, ...
6
votes
Accepted
How to prevent Polkadot{.js} extension from injecting all addresses into the site's JavaScript context
The Polkadot{.js} extension doesn't offer site-specific account permissions the same way that Metamask does.
However, you can set the global visibility of each individual account which will prevent ...
5
votes
How do treasury accounts compare to end user accounts in FRAME?
There is no difference. From the point of view of the runtime, the treasury account is like a normal account. These special system accounts are just public keys, without the private key being known. ...
5
votes
How do parachain crowdloan accounts work?
Each parachain project has a crowdloan account id for its funds pot that is created using the fund_account_id function of the Crowdloan pallet where its account id is generated using the parachain id ...
5
votes
What are the predefined accounts (ALICE, BOB, etc)?
In node/src/chain_spec.rs you will find the functions local_testnet_config
and development_config which contains lines like these
move || {
testnet_genesis(
wasm_binary,
...
5
votes
Accepted
How we can manage the accounts with multiple chains on substrate?
To control another network's account (or in fact any account), what you really need is a wallet - which could be implemented as a portal like Moonbeam
or polkadot.js/apps does it, or as an extension ...
5
votes
Polkadot.js and Ledger device compatibility
Make sure that your Ledger firmware is the latest version: 2.0.2
Make sure that your Polkadot ledger app is the latest version: 11.9170.0
As you mentioned in the comments your derivation path ...
4
votes
Polkadot.js and Ledger device compatibility
Firstly, I would like to advise that you shouldn't contribute DOT using a Ledger account. It becomes problematic when trying to access the crowdloaned tokens. A regular account created on Polkadot....
4
votes
How to convert AccountId32 to T::AccountId?
Did you declare AccountId as AccountId32?
I assume you are writing a unit test and have some sort of mock runtime where you have the following somewhere:
impl frame_system::Config for Runtime {
......
4
votes
What are some good use cases for anonymous proxies?
Another use case would be if you want an account where several different people have different levels of access.
For example, an anonymous proxy of a company might be controlled by a multisig ...
4
votes
Accepted
Using T::AccountId in a custom map
As you specify to it to use a ValueQuery, a default has to exist.
The solution is to use an OptionQuery instead which then returns None:
#[pallet::storage]
#[pallet::getter(fn declaration_map)]
pub(...
4
votes
Accepted
How to pass an AccountId to a parameter of type <T::Lookup as StaticLookup>::Source?
If you have AccountId and you want to Get LookUp<Target = AccountId>, you will have to unlookup. Straightforward way to do is:
let user: AccountId = get_a_user();
let user_lookup = <T::Lookup ...
4
votes
What is a "sovereign" account in Polkadot/Substrate?
In general terms, according to the Cambridge dictionary "sovereign" is defined as:
having the highest power or being completely independent
In regards to Polkadot/Substrate, Moonbeam has a ...
4
votes
Accepted
Is it possible to use ink! with Ethereum-style accounts?
Wondering if anyone knows whether ink! supports AccountIds which are
ethereum-style accounts?
Yes. pallet-contracts will work with the unified account setup you referenced. It is generic over the ...
4
votes
Accepted
adding an account
You are close. You could do something like this:
// Pre-funded accounts
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
get_account_id_from_seed::<...
3
votes
Accepted
How to create an escrow account without runtime upgrade
If you are willing to use Root origin then you can use any account. Assuming you are using 32 byte account IDs, you can just hash something to get an otherwise inaccessible account. Then do a Root ...
3
votes
How can you setup your own pre-configured account in a relay/parachain spec?
Use polkadot-launch to configure and launch the relay chain and parachain seamlessly. Also refer to this cumulus tutorial for additional guidance.
Create relevant accounts and session keys for your ...
3
votes
Accepted
Manually implement `Default` for `AccountId`
The error message actually gives a clue. It says that you are trying to call Default::default() → Self and assign it to key1.
You cannot call a function of a trait, you can only call a function on the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
account × 85pallet × 17
polkadot-js × 8
substrate-node-template × 8
evm × 7
polkadot × 6
runtime × 5
balances × 5
transactions × 5
accountid × 5
parachain × 4
offchain-worker × 4
ink × 3
crowdloan × 3
proxy × 3
ethereum × 3
moonbeam × 3
origin × 3
address × 3
substrate-node × 2
smart-contract × 2
xcm × 2
extrinsic × 2
python × 2
staking × 2