2

I'd like to create an account that is only usable through the root origin like the treasury account. It should be possible to transfer funds to it, but sending from it should only be possible through the logic of the pallet that I'm developing.

I could just instanciate the treasury pallet, but I would like to dynamically create them on user request.

How would I do that?

1 Answer 1

3

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 dispatch of balances.force_transfer.

I actually did this before on Kusama: https://kusama.polkassembly.io/motion/394

Namely:

hash(“xcm_exploit_karura_extrinsic_735603-2”) = 0x407d09daacfb6586a4fa1b3083e5c2002275d9ebbd67f2c0a2c6f2701ec43376

Which as a 32-byte AccountId = E2sj6XZ4GxzMon1QNycjrQaQsKRaY3zb2jRKREiPRmX1sfQ

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.