Skip to content
New issue

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

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

Already on GitHub? # to your account

Add mint transaction type. #406

Merged
merged 2 commits into from
Sep 23, 2022
Merged

Add mint transaction type. #406

merged 2 commits into from
Sep 23, 2022

Conversation

adlerjohn
Copy link
Contributor

@adlerjohn adlerjohn commented Sep 15, 2022

Partially addresses #286.

Add a new transaction type, Mint, that only contains outputs. In the general case, no validation of this transaction is necessary beyond checking for well-formedness. Note that this PR doesn't actually allow mint transactions anywhere, it only defines a new transaction type.

Two applications exist:

  1. A coinbase tx, i.e. Coinbase #286. This will require a block validation rule to check that the first tx is a mint tx and that the values are constrained.
  2. Block-level flash loans. https://twitter.com/aeyakovenko/status/1568429252332384257 A mint tx must be paired with an equivalent burn (e.g. a tx with only inputs and no outputs). Credits to @pluriholonomic for discussion on this.

@adlerjohn adlerjohn self-assigned this Sep 15, 2022
@adlerjohn adlerjohn marked this pull request as ready for review September 15, 2022 00:23
@pixelcircuits
Copy link
Contributor

I'm not sure I get how this could be used for flash loans. Are you thinking coins get added to free balance and have to end still in free balance?

Also, I think you could probably go ahead and add the restriction that the OutputCoins have to be for the base asset. Having the ability to flash loan any coin (especially if the coin explicitly would not like that ability) opens up potential security concerns for DAOs and on-chain voting

@adlerjohn
Copy link
Contributor Author

I'm not sure I get how this could be used for flash loans.

See the tweet linked in the OP: https://twitter.com/aeyakovenko/status/1568429252332384257. It could be implemented as the second tx in the block can be a mint tx (the first being the coinbase), for literally any amount of any asset. Then the last tx in the block must burn (i.e. have only inputs and no outputs) the same amount that was minted.

I think you could probably go ahead and add the restriction that the OutputCoins have to be for the base asset.

Restricting this at the tx format level instead of the validation rules level means it can't be used for the above flash loans.

Having the ability to flash loan any coin (especially if the coin explicitly would not like that ability) opens up potential security concerns for DAOs and on-chain voting

Good. On-chain voting should always hold assets for at least one block anyways, since flash loans are a thing. This feature also prevents people from abusing single-unit fungible assets to represent non-fungible assets, which would be very wasteful and inefficient.

Note that flash loans aren't the subject of this PR; this PR is only for a general tx format that has several applications.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants