Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lowering Deposit Requirements on Polkadot and Kusama Asset Hub #45

Merged

Conversation

poppyseedDev
Copy link
Contributor

RFC-00xx-assethub, proposes lowering deposit requirements for NFT collection creation on Polkadot and Kusama Asset Hub to make it more accessible for artists. It draws upon the discussion in the Polkadot Forum. While there are concerns about state bloat, the RFC also considers future governance models to dynamically adjust deposit requirements.

## Unresolved Questions
- Determining the optimal new deposit amount that reduces the barrier to entry while preventing state bloat remains a subject for debate. What is the balance that allows for inclusivity without compromising the network's efficiency and security?

## Future Directions and Related Material
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a good future direction would be to establish some kind of process on how to agree on these values.
Otherwise we will have the same discussion every 3-6 months i guess.

Copy link
Contributor Author

@poppyseedDev poppyseedDev Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed prices have been adjusted so that they are not too low, but still have a reasonable maximum at a historical maximum of prices of DOT and KSM.

This of course maybe be an oversimplification and needs to reach an consensus from the community.

| collectionDeposit | 10 DOT | 50 $ | 500 $ | 0.1 DOT | 0.5 $ | 5$ |
| itemDeposit | 0.01 DOT | 0.05 $ | 0.5 $ | 0.001 DOT | 0.005 $ | 0.05$ |
| metadataDepositBase | 0.20129 DOT | 1.00645 $ | 10.0645 $ | 0.0020129 DOT | 0.0100645 $ | 0.100645$ |
| attributeDepositBase | 0.2 DOT | 1 $ | 10 $ | 0.002 DOT | 0.01 $ | 0.1$ |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to see these values in relation to what is actually being stored on-chain.
Then we can compare these values to proven spam-resistant storage prices (like in the preimage pallet).
It should be possible to calculate the DOT/Byte to make it comparable.

Otherwise they are just as random as at genesis, now just 1/10 😉


- **Artists**: Primary beneficiaries of the proposed change, particularly those who found the current deposit requirements prohibitive.
- **KodaDot**: As the facilitator of artists' relations, KodaDot has a vested interest in making the platform more accessible.
- **Polkadot Community**: Stands to benefit from an influx of artists, creators and diverse NFT collections, enhancing the overall ecosystem.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the community is also interested in the security of the network.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, since this is talking more about the benefits for Stakeholders, would it be okay if I better highlight this point in the drawbacks?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the Polkadot Community also benefits from a secure network. Otherwise if the state gets bloated like on Moonbeam then it is not good.

text/000x-assethub.md Outdated Show resolved Hide resolved
text/000x-assethub.md Outdated Show resolved Hide resolved
text/000x-assethub.md Outdated Show resolved Hide resolved
poppyseedDev and others added 2 commits November 7, 2023 16:10
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@burdges
Copy link

burdges commented Nov 7, 2023

In theory, all prices should adjust downwards somewhat as more cores become available, due to ongoing optimizations. We'll need Kusama to waste have it's core on gluttons of course. We'll spend some cores on system parachain on Polkadot. Other factors like async backing change the price structure the opposite direction. etc. All this has some floor defined by the number & specs of collator, which again depends upon how system parachains wind up being structured. And elastic scaling releaves that slightly. And all values increase like log statesize too.

All this says: It's tricky to automate this too much, but it's still nice not to have the conversation too often.

It'd also be nice if there was a for-profit parachain which did specific things like NFTs cheaper than AssetHub.

cc @jonasW3F

@vikiival
Copy link
Contributor

vikiival commented Nov 8, 2023

Hello @ggwpez,
as I/we minted a majority of NFTs on AssetHub I can provide some statistic

  1. Amount of collections created
select count(metadata) from collection_entity;
-- 40
  1. Amount of nfts created
select count(metadata) from nft_entity;
-- 2313
  1. Average and max length of metadata bytes stored on chain
select avg(length(metadata)), max(length(metadata)) from nft_entity where metadata is not null;
-- 54.2
  1. median of metadata bytes stored on chain
SELECT PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY length(metadata)) FROM nft_entity;
-- 46
  1. Distribution of metadata lengths
select length(metadata), count(*) from nft_entity where metadata is not null group by length(metadata) order by length(metadata) desc;
-- 74,1
-- 73,3
-- 71,651
-- 66,86
-- 59,33
-- 58,1
-- 53,66
-- 46,1472

Regarding attributes on-chain the current utilisation is 0.

It would be nice to see these values in relation to what is actually being stored on-chain.
Then we can compare these values to proven spam-resistant storage prices

Let's do checkup on utilization:

  1. What is the median of NFTs minted in one collection?
SELECT PERCENTILE_DISC(0.5) WITHIN GROUP(ORDER BY supply)FROM collection_entity where supply > 0 and metadata is not null;`
-- 4
  1. What is the average and max of NFTs minted in collection?
select avg(supply), max(supply) from collection_entity where metadata is not null;
-- 58.65, 1468

⚠️ Note that all number include both uniques and nfts pallet.

What we can do to prevent spam on the AssetHub?

There are few ways to make offer better utilization for the assethub NFTs.
First we can migrate, deprecate and remove uniques pallet from the AssetHub chain. This will dramatically decrease the potential use of space on chain.

Second most important is to decrease effective amount of items from u32 to u16.

Because u32 is mapped as assert_eq!(u32::MAX, 4_294_967_295); in Rust. It is highly impossible to one will mint 4 billion NFTs per one collection.

Third point collection could be potentially forceDestroyed (not-implemented) by the Open-Gov.

TL;DR: There are at least 3 effective ways to prevent 'waste-of-storage', prevent spam, and do effective utilization of the NFTs on AssetHub.

@ggwpez
Copy link
Member

ggwpez commented Nov 11, 2023

Thanks for the data @vikiival, i normally have no introspection into how it is used. This was very helpful!

I checked how many bytes it can take at most to create a collection, and it comes in at around 130 byte. So the 10 DOT seems definitely excessive. When i plug in the 130 byte into the deposit formula then it comes out around 0.2-0.4 DOT. For the ItemDeposit it seems to just be a constant as well, without justification.
Maybe it would be possible to reduce some of these constants to lower the normal storage requirement.

The other constants like itemDeposit etc are already calculated with the 1/100 storage price of Polkadot...

What do you think about the values @joepetrowski, @jsidorenko and @rphmeier?

First we can migrate, deprecate and remove uniques pallet from the AssetHub chain

Yea we should do this. @jsidorenko do you have this planned?

@jsidorenko
Copy link

Re migration, I'm waiting on the new runtime release to stabilise and then will release the web NFTs migratory.

As for the deposits, those enormous deposits don't make any sense and prevent us from having users.
Last year we had the same issue on Kusama and I decreased the NFTs related deposits 10 times. As a result, we have now 200+ collections created over just 6 months after the release.

Copy link
Contributor

@joepetrowski joepetrowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The good: I find the updated deposit suggestions quite reasonable and would accept a change toward those.

The bad: This RFC doesn't really provide structured discussion or generalize the issue. It seems like a dump of a bunch of quotes from the forum thread with a very specific goal of making KodaDot's life easier. While that is a nice goal, the RFC should be more general and discuss the economic, technical, and application tradeoffs of storage deposits.

text/000x-assethub.md Outdated Show resolved Hide resolved
text/000x-assethub.md Outdated Show resolved Hide resolved
Comment on lines 25 to 28
## Explanation
This RFC suggests modifying the smart contract governing collection creation on the Polkadot Asset Hub to require a lower deposit. The exact amount of the reduced deposit is yet to be determined and should be discussed and agreed upon by the stakeholders. The implementation of this change requires careful consideration of the network's integrity and the prevention of spam, possibly through alternative means such as rate limiting or account verification.

**Prices and Proposed Prices on Polkadot Asset Hub:**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explanation lacks discussion that I was hoping for about the tradeoffs and how you arrived at these suggested deposits.

Comment on lines 72 to 79
Additionally, a supplementary proposal aims to augment the network's adaptability:

> Just from a technical perspective; I think the best we can do is to use a weak governance origin that is controlled by some consortium (ie. System Collective).
> This origin could then update the NFT deposits any time the market conditions warrant it - obviously while honoring the storage deposit requirements.
> To implement this, we need RFC#12 and the Parameters pallet from @xlc.
> -> OliverTY

This dynamic governance approach would facilitate a responsive and agile economic model for deposit management, ensuring that the network remains both accessible and robust in the face of market volatility.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really agree with this approach for a few reasons. One, in attempting to provide stability it actually removes it because the DOT-based deposit can change so often that NFT issuers don't even know how much DOT they should acquire in order to plan a few weeks in advance.

Two, it does not scale. There are deposits all over the system. This group could then find themselves perpetually changing tons of deposits.

I don't see any need to update deposits more than every six months, which is well within the realm of runtime upgrades. If deposits should be tied to some fiat value, then on Asset Hub they should just directly declare the deposit in a chosen stablecoin. If the deposits are in DOT, and users want to hold stablecoins, then wallets can easily batch an Asset Conversion swap in front of a creation call.

@joepetrowski
Copy link
Contributor

Second most important is to decrease effective amount of items from u32 to u16.

This seems like an arbitrary imposition. The economics should provide reasonable bounds on usage, not data overflows.

I checked how many bytes it can take at most to create a collection, and it comes in at around 130 byte. So the 10 DOT seems definitely excessive. When i plug in the 130 byte into the deposit formula then it comes out around 0.2-0.4 DOT. For the ItemDeposit it seems to just be a constant as well, without justification. Maybe it would be possible to reduce some of these constants to lower the normal storage requirement.

The other constants like itemDeposit etc are already calculated with the 1/100 storage price of Polkadot...

It looks like those values are just manually set. I'm in favor of generally using the deposit() function and calculating the storage footprint of items. This then treats pallets "equally". Maybe there are cases where you want to increase or decrease that, to increase or decrease the barrier to using some component, but those should be the exception. This function already accounts for its being in a parachain with a deposit lower by a factor of 100.

poppyseedDev and others added 2 commits November 16, 2023 11:44
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
@vikiival
Copy link
Contributor

@joepetrowski as per commit 3ad68dd

can we keep the deposit as 0.01 DOT per item deposit?

@joepetrowski
Copy link
Contributor

can we keep the deposit as 0.01 DOT per item deposit?

It was 0.005 before, you want it back to 0.01?

@vikiival
Copy link
Contributor

It was 0.005 before, you want it back to 0.01?

Ah, I must have misread the git diff

@poppyseedDev
Copy link
Contributor Author

poppyseedDev commented Jan 31, 2024

Thank you so much @joepetrowski for your changes!

What are the next steps for this RFC?

text/0045-nft-deposits-asset-hub.md Outdated Show resolved Hide resolved
text/0045-nft-deposits-asset-hub.md Show resolved Hide resolved
Based on the storage footprint of these items, this RFC proposes changing them to:

```rust
pub const NftsCollectionDeposit: Balance = system_para_deposit(1, 130);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is more than one storage item, so to be really precise it should be something in the form of system_para_deposit(1, x) + system_para_deposit(1, y) (Collection and CollectionRoleOf) but i dont want to block this RFC much longer.
Guess this approximates it well enough for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are two items then we should probably be consistent. It should still be a large reduction (from 10 to 0.4 instead of 0.2).

Broadly speaking though, and w/r/t the idea of finding an "optimal" deposit, it can never be perfect. As long as you can't start adding more storage items for free (i.e. deposit is directly proportional to storage items added) then it's well-designed. Factors of 2x are just not significant (and it's a bit arrogant to think we can get it so precise). I think probably 10x is the best we can hope for with these parameters.

text/0045-nft-deposits-asset-hub.md Outdated Show resolved Hide resolved
### Performance

The primary performance consideration stems from the potential for state bloat due to increased
activity from lower deposit requirements. It's vital to monitor and manage this to avoid any
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have monitoring in place?

Copy link
Contributor

@joepetrowski joepetrowski Feb 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @KarimJedda or someone from KodaDot is tracking NFT activity?

Copy link
Contributor Author

@poppyseedDev poppyseedDev Feb 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @vikiival is in a good position to answer this question, since he created indexer for AssetHub.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Someone from KodaDot is tracking NFT activity?

-- current nfts 9792
select count(*) from nft_entity where burned = false;

-- current collection 98
select count(*) from collection_entity where burned = false;

-- all nfts 9883 (~ 100 burned)
select count(*) from nft_entity;

-- all collections 138 (40 destroyed)
select count(*) from collection_entity;

-- all interactions that is not mint (list, buy, burn) 16_019
select count(*) from event where interaction <> 'MINT';

Top 3 creators on AHP

  [{
    "count": 41,
    "issuer": "15CoYMEnJhhWHvdEPXDuTBnZKXwrJzMQdcMwcHGsVx5kXYvW"
  },
  {
    "count": 24,
    "issuer": "1ULZhwpUPLLg5VRYiq6rBHY8XaShAmBW7kqGBfvHBqrgBcN"
  },
  {
    "count": 6,
    "issuer": "1nYXo6fd1fjVm1ixUwycELfjTyaxxzVHAVgZ8S8H6cZMfY7"
  }]

Data are public via our @subsquid indexer or Typescript API (kodadot/uniquery)

text/0045-nft-deposits-asset-hub.md Outdated Show resolved Hide resolved
text/0045-nft-deposits-asset-hub.md Outdated Show resolved Hide resolved
pallet, the system could take the lower value required. A sigmoid curve would make sense for this
application to avoid sudden rate changes, as in:

$$ \frac{\mathrm{min(DOT deposit, stable deposit)} }{\mathrm{1 + e^{a - b * x}} }$$
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$$ \frac{\mathrm{min(DOT deposit, stable deposit)} }{\mathrm{1 + e^{a - b * x}} }$$
$$ startdeposit + \frac{\mathrm{min(DOTdeposit, stabledeposit) - startdeposit} }{\mathrm{1 + e^{b * a - b * x}} }$$

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what you are doing. But you don't need b * a because its evaluation is implicit in the value of a.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay but then the code implementor has to know that a = x0 * b, where x0 is the threshold level of collections or items.

text/0045-nft-deposits-asset-hub.md Outdated Show resolved Hide resolved
joepetrowski and others added 2 commits February 12, 2024 19:08
Co-authored-by: Aurora Poppyseed <30662672+poppyseedDev@users.noreply.github.com>
@vikiival
Copy link
Contributor

Proposal looks amazing 🚀 big kudos to @joepetrowski, @poppyseedDev and others ❤️ ^-^

Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
@poppyseedDev
Copy link
Contributor Author

poppyseedDev commented Feb 19, 2024

Hey @ggwpez could you tell us what are the next steps with this PR?

@ggwpez
Copy link
Member

ggwpez commented Feb 20, 2024

Hey ggwpez could you tell us what are the next steps with this PR?

We will soon propose this for on-chain voting 🙏

@joepetrowski
Copy link
Contributor

/rfc propose

@paritytech-rfc-bot
Copy link
Contributor

Hey @joepetrowski, here is a link you can use to create the referendum aiming to approve this RFC number 0045.

Instructions
  1. Open the link.

  2. Switch to the Submission tab.

  1. Adjust the transaction if needed (for example, the proposal Origin).

  2. Submit the Transaction


It is based on commit hash c7edfc33ccb57e881557a5cbbeed478e0d4efc1a.

The proposed remark text is: RFC_APPROVE(0045,1b6fe68824d19e032958ca3423446ed58fa9200605c560942420400ee408b5a4).

Copy link

github-actions bot commented Mar 8, 2024

Voting for this referenda is ongoing.

Vote for it here

@joepetrowski
Copy link
Contributor

/rfc process

@paritytech-rfc-bot
Copy link
Contributor

Please provider a block hash where the referendum confirmation event is to be found.
For example:

/rfc process 0x39fbc57d047c71f553aa42824599a7686aea5c9aab4111f6b836d35d3d058162
Instructions to find the block hashHere is one way to find the corresponding block hash.
  1. Open the referendum on Subsquare.

  2. Switch to the Timeline tab.


  1. Go to the details of the Confirmed event.

  1. Go to the details of the block containing that event.

  1. Here you can find the block hash.

@joepetrowski
Copy link
Contributor

/rfc process 0x3ac549f24ecf451eb4d45f16f4fff694b0a103f8006ff9ab7f16c484bcfb535c

@paritytech-rfc-bot paritytech-rfc-bot bot merged commit e9bf213 into polkadot-fellows:main Mar 14, 2024
@paritytech-rfc-bot
Copy link
Contributor

The on-chain referendum has approved the RFC.

@joepetrowski joepetrowski deleted the polkadot-asset-hub branch March 14, 2024 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants