Giter Site home page Giter Site logo

cardano-foundation / cips Goto Github PK

View Code? Open in Web Editor NEW
461.0 70.0 304.0 5.88 MB

Home Page: https://cips.cardano.org/

License: Creative Commons Attribution 4.0 International

JavaScript 38.36% PHP 15.64% Shell 2.25% TypeScript 26.63% Haskell 6.86% HTML 10.28%

cips's Introduction

Cardano Improvement Proposals (CIPs)

A Cardano Improvement Proposal (CIP) is a formalised design document for the Cardano community and the name of the process by which such documents are produced and listed. A CIP provides information or describes a change to the Cardano ecosystem, processes, or environment concisely and in sufficient technical detail. In this CIP, we explain what a CIP is; how the CIP process functions; the role of the CIP Editors; and how users should go about proposing, discussing and structuring a CIP.

The Cardano Foundation intends CIPs to be the primary mechanisms for proposing new features, collecting community input on an issue, and documenting design decisions that have gone into Cardano. Plus, because CIPs are text files in a versioned repository, their revision history is the historical record of significant changes affecting Cardano.

Note For new CIP, a reference template is available in .github/CIP-TEMPLATE.md

Cardano Problem Statements (CPS)

A Cardano Problem Statement (CPS) is a formalised document for the Cardano ecosystem and the name of the process by which such documents are produced and listed. CPSs are meant to complement CIPs and live side-by-side in the CIP repository as first-class citizens.

Note For new CPS, a reference template is available in .github/CPS-TEMPLATE.md

Communication Channels

Extend or discuss ‘ideas’ in the Developer Forums, Cardano’s Official Developer Telegram Group or in #developers in Cardano Ambassadors Slack.

CIP editors will review discussions and progress in bi-weekly meetings held on Discord, then transcribe and summarise them in the BikweeklyMeetings folder.

CIP Editors meetings are public, recorded, and published on Youtube: do join and participate in discussions/PRs of significance to you.

Note To facilitate browsing and information sharing for non-Github users, an auto-generated site is also provided at cips.cardano.org.

Cardano Improvement Proposals (CIP)

# Title Status
0001 CIP process Active
0002 Coin Selection Algorithms for Cardano Active
0003 Wallet key generation Active
0004 Wallet Checksums Proposed
0005 Common Bech32 Prefixes Active
0006 Stake Pool Extended Metadata Draft
0007 Curve Pledge Benefit Proposed
0008 Message Signing Draft
0009 Protocol Parameters (Shelley Era) Active
0010 Transaction Metadata Label Registry Active
0011 Staking key chain for HD wallets Active
0012 On-chain stake pool operator to delegates communication Draft
0013 Cardano URI Scheme Proposed
0014 User-Facing Asset Fingerprint Active
0015 Catalyst Registration Transaction Metadata Format Active
0016 Cryptographic Key Serialisation Formats Active
0017 Cardano Delegation Portfolio Active
0018 Multi-Stake-Keys Wallets Draft
0019 Cardano Addresses Active
0020 Transaction message/comment metadata Active
0021 Transaction requirements for interoperability with hardware wallets Draft
0022 Pool operator verification Active
0023 Fair Min Fees Proposed
0024 Non-Centralizing Rankings Proposed
0025 Media Token Metadata Standard Active
0026 Cardano Off-Chain Metadata Draft
0027 CNFT Community Royalties Standard Draft
0028 Protocol Parameters (Alonzo Era) Active
0029 Phase-1 Monetary Scripts Serialization Formats Active
0030 Cardano dApp-Wallet Web Bridge Active
0031 Reference Inputs Active
0032 Inline Datums Active
0033 Reference Scripts Active
0034 Chain ID Registry Draft
0035 Plutus Core Evolution Active
0036 Catalyst Registration Transaction Metadata Format Proposed
0037 Dynamic Saturation Based on Pledge Proposed
0040 Collateral Output Active
0042 New Plutus Builtin: serialiseBuiltinData Active
0045 Decentralized WebRTC dApp-Wallet Communication Active
0049 ECDSA and Schnorr signatures in Plutus Core Proposed
0050 Pledge Leverage-Based Staking Rewards Proposed
0052 Cardano Audit Best Practice Guidelines Proposed
0054 Cardano Smart NFTs Draft
0055 Protocol Parameters (Babbage Era) Active
0057 Plutus Smart-Contract Blueprint Active
0058 Plutus Bitwise Primitives Proposed
0059 Terminology Surrounding Core Features Active
0060 Music Token Metadata Active
0067 Asset Name Label Registry Proposed
0068 Datum Metadata Standard Proposed
0069 Plutus Script Type Uniformization Proposed
0071 Non-Fungible Token (NFT) Proxy Voting Standard Proposed
0072 DApp Registration Proposed
0074 Set min-pool-cost to 0 Proposed
0075 Fair Stake Pool Rewards Proposed
0080 Transaction Serialization Deprecation Cycle Active
0082 Improved Rewards Scheme Parameters Proposed
0083 Encrypted Transaction message/comment metadata (Addendum to CIP-0020) Active
0084 Cardano Ledger Evolution Active
0085 Sums-of-products in Plutus Core Proposed
0086 NFT Metadata Update Oracles Proposed
0088 Token Policy Registration Proposed
0093 Authenticated Web3 HTTP requests Proposed
0094 SPO On-chain Polls Active
0095 Web-Wallet Bridge - Conway ledger era Active
0099 Proof of Onboarding Active
0100 Governance Metadata Proposed
0101 Integration of keccak256 into Plutus Proposed
0102 Royalty Datum Metadata Proposed
0103 Web-Wallet Bridge - Bulk transaction signing Active
0104 Web-Wallet Bridge - Account public key Proposed
0105 Conway Era Key Chains for HD Wallets Proposed
0108 Governance Metadata - Governance Actions Proposed
0109 Modular Exponentiation Built-in for Plutus Core Proposed
0110 Plutus v1 compatible script references Proposed
0112 Observe script type Proposed
0114 CBOR Tags Registry Proposed
0115 CBOR tag definition - ED25519-BIP32 Keys Proposed
0116 Universal JSON Encoding for Domain Types Proposed
0119 Governance Metadata - DReps Proposed
0381 Plutus Support for Pairings Over BLS12-381 Proposed
1694 A proposal for entering the Voltaire phase Proposed
1852 HD (Hierarchy for Deterministic) Wallets for Cardano Active
1853 HD (Hierarchy for Deterministic) Stake Pool Cold Keys for Cardano Active
1854 Multi-signatures HD Wallets Draft
1855 Forging policy keys for HD Wallets Active
9999 Cardano Problem Statements Active

Last updated on 2024-05-28

💡 For more details about CIP statuses, refer to CIP-0001.

Proposals Under Review (CIP)

Below are listed tentative CIPs still under discussion with the community. They are listed below for easing navigation and tentatively allocating numbers to avoid later clashes.

# Title
0039? Language Annotated Address
0056? Treasury Donation
0073? Oracle Datum Standard
0076? Hash-Checked Data
0077? Verified Stake Pool Identity
0079? Implement Ouroboros Leios to increase Cardano throughput
0087? Maybe Datum
0089? Beacon Tokens & Distributed Dapps
0090? Extendable dApp-Wallet Web Bridge
0091? Don't force Built-In functions
0092? First-class errors in Plutus
0096? On-chain dApp Certification Metadata
0097? Representing the Script Context as a SOP term
0106? Web-Wallet Bridge - Mutlisig wallets
0107? URI Scheme - Block and transaction objects
0111? Web-Wallet Bridge - Wallet Transaction Caching
0113? Programmable token-like assets
0117? Explicit script return values
0118? Validation zones
0120? Constitution specification
0121? Integer-ByteString conversions
0122? Logical operations over BuiltinByteString

Last updated on 2024-05-28

Cardano Problem Statements (CPS)

# Title Status
0005 Plutus Script Usability Open
0007 Voltaire era Governance Open
0009 Coin Selection Including Native Tokens Open
0010 Wallet Connectors Open
0011 Universal JSON Encoding for Domain Types Open
0013 Better builtin data structures in Plutus Open
0014 Register of CBOR Tags Open

Last updated on 2024-05-19

💡 For more details about CPS statuses, refer to CIP-9999.

Proposals Under Review (CPS)

Below are listed tentative CPSs still under discussion with the community. They are listed below for easing navigation and also tentatively allocating numbers to avoid clashes later on.

# Title
0001? Metadata Discoverability and Trust
0004? Spending Script Redundant Execution
0006? Governance Security
0008? Domain Name Resolution
0012? Query Layer Standardization
0015? Intents for Cardano

Last updated on 2024-03-19

Stalled / Waiting For Authors

The following list contains proposals that have been under review and for which actions are now awaiting updates from their original authors. Proposals stalled for several months without any updates from their authors and will eventually be closed. However, authors are invited to re-open pull requests or open new ones should they want to bring the discussion back to life.

Last updated on 2023-06-09

Editors

Matthias Benkort
@KtorZ
Sebastien Guillemot
@SebastienGllmt
Robert Phair
@rphair
Ryan Williams
@Ryun1
Adam Dean
@Crypto2099

cips's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cips's Issues

CIP-0030 Add .getCollateral()

To balance a partial transaction, we need to know which UTXO is the collateral.

nami-wallet has implemented this feature:

> await nami.experimental.getCollateral()
['828258200c153f47be46b76d1df3b46c9d2532c3b0adb8817a…a34c6601ee0b3e5ef71542561443c1a07dc69911a004c4b40']

I suggest that .getCollateral() should be included in CIP-0030, with the interface similar to what nami-wallet has done.

CIP-0030 `getCollateral` could be made more specific

This shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach **AT LEAST** the combined ADA value target specified in `amount` **AND** the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only utxos). If this cannot be attained, an error message with an explanation of the blocking problem shall be returned. **NOTE:** wallets are free to return utxos that add up to a **greater** total ADA value than requested in the `amount` parameter, but wallets must never return any result where utxos would sum up to a smaller total ADA value, instead in a case like that an error message must be returned.

This shall return a list of one or more UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach AT LEAST the combined ADA value target specified in amount AND the best suitable to be used as collateral inputs for transactions with plutus script inputs (pure ADA-only utxos).

The problem with these requirements is that they are too broad: the implementation that simply returns all UTxOs satisfies them.

I'd suggest enforcing the following property:

  • All strict subsets of the set of returned UTxOs MUST NOT satisfy the minimum ADA collateral requirements (no unnecessary UTxOs must be returned)

Notably, one of the wallets (Eternl) breaks this property, so we cannot simply assume that UTxOs returned as collateral must not be spent, because it's possible that no more (or not enough) UTxOs are left (context)

CIP-0030: provide unique wallet identification

When trying to integrate light wallets with the Plutus Application Backend, I came across the issue where I need a wallet id before activating a contract. Currently, the PAB requires a wallet id encoded in blake2b_160, which is what Daedalus (cardano-wallet) uses.

Therefore, does it make sense to enhance the API with a getWalletId function?

Maybe something like:

api.getWalletId(): Promise<WalletId>

type WalletId = Blake2b_160;

@rooooooooob

Proposal for adding an index to improve navigation within this repo

Right now, if you come to this repo looking for information on some topic, but you don't know which CIP covers it, you basically need to check every CIP folder. As the number of submissions increases, this becomes less and less practical.

It'd be nice if we can just have an index in the README, something like:

...perhaps with different sections for each status.

Maybe the idea was to have https://cips.cardano.org for this? If that's the case, that website is not playing that role and is not up-to-date.

CIP-0002 is obsolete since native tokens were launched

The 2018 article is obsolete when UTxOs contain NFTs or fungible tokens. The random selection algorithm simply will pick and cluster all your NFTs together over time resulting in a "change" UTxO that becomes extremely large until simply moving it around breaks the transaction size limit. This will keep happening over and over until your wallet is simply stuck.

I propose the following changes :

  • Pick the UTxO with the native tokens that you NEED in your output, if any, first.
  • Use the current random UTxO selection amongst UTxOs with only Ada and try to meet the output requirements for Ada.
  • If you run out of simple only Ada UTxOs, use Largest first amongst the UTxOs that contain NFTs or fungible tokens to complete the tx.

Also, it is recommended to build output transactions with the two following parameters (user settings in a wallet or algorithm):

  • Token Fragmentation (N) -> Split any transaction output that has more than N NFTs into multiple outputs of at most N NFTs.
  • Make Me Some Change (A) -> Split any transaction output that has more that A Ada into multiple outputs of at most A Ada.

Token Fragmentation allows change transactions or big NFT transfers to land in the destination wallet in a format that is easier to wield and also allows a more natural way of creating independent transactions, which should be a goal in this eUTXO model.

Make Me Some Change is simply a way to allow the creation of concurrent independent transactions by using UTxOs that were not previously used in a transaction.

[New CIP]Multicrypto wallets

Progress in both maths and computational power gradually weakens existing cryptographic signature algorithms.
For this reason, long-term and security conscious users may want to sacrifice transaction size (and price)
in order to use wallets with multiple cryptographic algorithms, and will want to gradually migrate
from older signature algorithms to newer ones over the course of many years.

Safest way to implement it would be to provide multiple cryptographic signature options, and composition signatures.
Composite signatures seem to be already implemented in ledger code as those that require All of multiple signatures.
The only missing piece is to allow use of multiple crypto algorithms for multisig, and to send multiple signatures
from the CIP-0030 wallets.

This would allow for gradual migration between cryptographic signature protocols for the wallets, and would ease user from difficulties of migration when sidechain or main chain would choose to harden its crypto.

CIP-0027 | Smart contract royalty addresses

CIP-27 is the current royalty standard for Cardano NFTs however it isn't mentioned anywhere how a marketplace should deal with a royalty address which is a smart contract address. The problem with this is that if a marketplace sends royalties to a smart contract without a datum then these funds are locked permanently.

I think it should either be put in the standard that royalties should be sent with any basic datum or a tag should be added to the royalty token metadata saying the address is a SC so that marketplaces can add a datum to only those transactions. This would then prevent any funds being locked in a SC.

CIP-0027: Covering existing policy locked assets

For assets which have been minted and their policy locked, this method could be used to set their royalties in a decentralized manner.

Requirements:

  1. New royalty token minted from same policy hash
  2. Plutus script for locking (basic always fails script will work)

Process:

  1. Creator mints a token from their same policy wallet/hash which contains the following metadata:
    • Policy Hash
    • This Tokens Policy Script (for calculating this token policy id)
    • Target Token Policy Script (for validating rightful ownership of hash and resultant policy id)
    • Royalties for Target
  2. Creator locks the royalty token into the "global royalty smartcontract" with Datum == target Policy ID
  3. The token cannot be unlocked from the smartcontract - royalty cannot be changed

Notes:

By permentantly locking the token the royalty is immutable. Secondary markets can easily query this smartcontract address and search for a Datum matching the Policy ID they are looking to enforce (or which misses the proper royalty metadata).

For the plutus script, an alternative might be to code it for not just locking permenantly, but to mint the royalty token and lock it, with validation that the minter is doing so from their policy wallet, and the metadata etc is embedded in a consistent way, ensuring consistency and enforcing standardization.

Any creator, any policy ID, can be then set using this smartcontract. I believe it would be also possible in the plutus script to ensure no duplicates are created for a target policy id. So royalty is set once, whether a new, existing unlocked, or existing locked policy.

Theoretically this could also be a single solution, making it possible/easy for creators to not be required to embed royalties into a preplanned policy, especially if they need to wait for some reason but could go ahead and begin minting.

CIP-0030: API to enumerate avilable wallets

Please provide API to enumerate wallets available for dApp. Right now the only way is to iterate over properties in window.cardano but this lead to duplicated entries if you have Eternl installed as due to avoid breaking changes to existing apps it's exposed twice via: window.cardano.ccvault and window.cardano.eternl

CIP-0006 social contacts

JSON schema 'contact' has all social accounts required. This means you can't set contacts without having every social account listed in schema. This is not sustainable as some platforms will die in the future.

Question: schema in master branch is different from the one in cips.cardano.org. Which one is the most up-to-date?

@papacarp @gufmar

CIP-0030 - Full API and wallet enumeration

I have suggestion regarding CIP-30. Right now it's confusing how to access Full API. It's accessible via window.cardano.{walletName}.getUtxos or window.cardano.getUtxos. If the second option is correct then I suggest to improve API to enumerate wallets becuase then wallet names mixes with API functions.

CIP-36 test vector CBOR incorrect

as per schema.cddl:

delegation = ($voting_pub_key, $weight)

key_registration = {
  1 : [+delegation] / legacy_key_registration,
  2 : $stake_credential,
  3 : $reward_address,
  4 : $nonce,
  ? 5 : $voting_purpose .default 0
}

you can see the non-legacy delegation (key 1) is an array of delegation, a basic group that isn't array-encoded where it's defined.

However the test vector for the non-legacy format is a119ef64a50182825820a6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d16630182582000588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee0302582086870efc99c453a873a16492ce87738ec79a0ebd064379a62e2c9cf4e119219e03581de0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef041904d20500 which decoded (using cbor.me) is:

{
    61284: {
        1: [
              [h'A6A3C0447AEB9CC54CF6422BA32B294E5E1C3EF6D782F2ACFF4A70694C4D1663', 1],
              [h'00588E8E1D18CBA576A4D35758069FE94E53F638B6FAF7C07B8ABD2BC5C5CDEE', 3]
        ],
        2: h'86870EFC99C453A873A16492CE87738EC79A0EBD064379A62E2C9CF4E119219E',
        3: h'E0AE3A0A7AEDA4AEA522E74E4FE36759FCA80789A613A58A4364F6ECEF',
        4: 1234,
        5: 0
    }
}

likewise the final human-readable part of the test vector says (2 element array with 2 element arrays as the elements):

{
  61284: {
    1: [['0xa6a3c0447aeb9cc54cf6422ba32b294e5e1c3ef6d782f2acff4a70694c4d1663', 1], ['0x00588e8e1d18cba576a4d35758069fe94e53f638b6faf7c07b8abd2bc5c5cdee', 3]],
    2: '0x1c5d88aa573da97e5a4667e0f7c4a9c6a3d848934c3b0a5b9296b401540f2aef',
    3: '0xe0ae3a0a7aeda4aea522e74e4fe36759fca80789a613a58a4364f6ecef',
    4: 1234,
    5: 0
  },
  61285: {
    1: '0x3aaa2e6b43c0a96e880a7d70df84dffb2a1a17b19d7a99a6ed27b91d499b32027c43acfbf6dff097af7634b2ee38c8039af259b0b6a64316f02b4ffee28a0608'
  }
}

According to the schema.cddl spec that key should actually be (one 4-element array):

        1: [
              h'A6A3C0447AEB9CC54CF6422BA32B294E5E1C3EF6D782F2ACFF4A70694C4D1663',
              1,
              h'00588E8E1D18CBA576A4D35758069FE94E53F638B6FAF7C07B8ABD2BC5C5CDEE',
              3,
        ],

The test vectors seem to assume that it was instead defined as delegation = [$voting_pub_key, $weight].

CIP-0020 choice of format/structure - suggestion

I have a suggestion for what, in my view, would be an improvement to the current proposed structure of the 674 message.

{ 
  "674":
          { "Invoice-No": "1234567890",
            "Customer-No": "555-1234",
            "Comments": ["P.S.: i will shop again at your store :-)"
                                , "Shopping experience was excellent"]
         }
}

In my opinion, storing key/value pairs inside a string, inside an array, inside a JSON metadata structure is not a smart approach. JSON is already a key value data format. Storing key/value data in this way will introduce the need to have to implement a custom parser, whilst preserving a JSON structure gives easy access to these values directly.

Metadata is expected to be provided as JSON. It is even stored in a column called json in the tx_metadata table in the db-sync database.

Existing tools/wallets already display 721 data in a structured way, by iterating over the key/value pairs,and showing them as labels and values respectively.

The current 674 proposal will introduce the need to handle 674 metadata in a different, inconsistent way.

I also believe that the "msg" key is redundant and offers no extra benefit. The 674 key is already enough to identify the metadata type.

The 674 content structure will be determined by the creator of the transaction/tool and will therefore not follow any particular common standard. Having reserved keys such as "version" etc could be left entirely at the discretion of the transaction creator.

I therefore do not see the added value of having a reserved top-level for keys such as msg, ver, etc...

Post-quantum Signatures

NIST Post Quantum Cryptography work group has selected three digital signature algorithms for standardization:

  • DILITHIUM-CRYSTALS
  • Falcon
  • SPHINX+

Estimates for PQC migration are within next 15 years, so it those smart contracts that want PQC hardness would certainly benefit from option to check PQC signatures.

While PQC algorithms are expected to be more secure than previous generation, the main issue is the signature size (666 bytes for Falcon, 2420 bytes for Dilithium, 8080 bytes for Sphincs+).

For this reason, these signature algorithms may be chosen by long-term security applications.

Proposal would involve:

  • implementing Falcon, Dilithium, and Sphincs+ as Crypto class instance,
  • adding Plutus instructions to call these signature algorithms,
  • providing a test "vesting" contract that releases funds after combination of signatures is given.

When additional PQC algorithms are standardized by NIST and enjoy shorter signature size, we may add these as well. (But we should not hold, since the process may take years, possibly more than estimated for migration.)

Future PQC-hardening of wallets and blockchain should be considered a sequel to this proposal.

Limit voting power of all SPO's to linear function of pledge

    > Applying this lesson to social decentralization and governance it would be wise to limit the voting power of all SPO's to some leverage limit multiple of the SPO's pledge: L. This has a profound effect: there is an added social/governance motivation for pledge. Groups like Binance and Coinbase which do not pledge any ADA would have no voting power.

I think this is a very valid point, thank you @michael-liesenfelt . How do we reconcile this, however, with the fact that SPOs that do not wish for a hard fork can always just not upgrade their software? If they do that, as a collective, then the 'no' vote is basically determined by the longest chain, which ignores pledge.

Originally posted by @JaredCorduan in #380 (comment)

CIP-0033 does not fully utilize eUTxO

The Problem

With the way CIP-33 is currently implemented, and all cardano spending scripts for that matter, the script must be executed for every utxo that comes from the corresponding script address even if validation is based on the entire transaction (as opposed to individual inputs). Here is an example transaction that illustrates this:

cardano-cli transaction build \
  --tx-in c1d01ea50fd233f9fbaef3a295ba607a72c736e58c9c9df588abf4e5009ad4fe#0 \
  --tx-in 622034715b64318e9e2176b7ad9bb22c3432f360293e9258729ce23c1999b9d8#2 \
  --spending-tx-in-reference 622034715b64318e9e2176b7ad9bb22c3432f360293e9258729ce23c1999b9d8#0 \
  --spending-plutus-script-v2 \
  --spending-reference-tx-in-inline-datum-present \
  --spending-reference-tx-in-redeemer-file $swapRedeemerFile \
  --tx-in 766555130db8ff7b50fc548cbff3caa0d0557ce5af804da3b993cd090f1a8c3a#1 \
  --spending-tx-in-reference 622034715b64318e9e2176b7ad9bb22c3432f360293e9258729ce23c1999b9d8#0 \
  --spending-plutus-script-v2 \
  --spending-reference-tx-in-inline-datum-present \
  --spending-reference-tx-in-redeemer-file $swapRedeemerFile \
  --tx-out "$(cat ../assets/wallets/01.addr) 2000000 lovelace + 300 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.54657374546f6b656e0a + 0 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.4f74686572546f6b656e0a" \
  --tx-out "$(cat ${swapScriptAddrFile}) + 4000000 lovelace + 0 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.54657374546f6b656e0a + 250 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.4f74686572546f6b656e0a" \
  --tx-out-inline-datum-file $swapDatumFile \
  --tx-in-collateral bc54229f0755611ba14a2679774a7c7d394b0a476e59c609035e06244e1572bb#0 \
  --change-address $(cat ../assets/wallets/01.addr) \
  --protocol-params-file "${tmpDir}protocol.json" \
  --testnet-magic 1 \
  --out-file "${tmpDir}tx.body"

The second and third utxo inputs are from the same script address. The script I am using above actually passes or fails based on the entire transaction, not a single utxo. This design does not take full advantage of the eUTxO model where a script can see the entire transaction during validation.

The issue with the current implementation is that it is causing redundant computation checks which result in a quadratic scaling of fees. Being that my script checks all the inputs and outputs to the transaction and decides based on that, below is the fee estimation with the current CIP-33 implementation:

tx fee = # ref scripts executed * ( 0.3 ADA + 0.02 ADA * ( # input utxos + # output utxos ) )

The transaction fee increases linearly for every utxo (inputs + outputs) in the transaction, then quadratically if more than one reference script needs to be executed. The reason for this is that the script traverses all the inputs and outputs of the transaction to determine successful validation; the validation is not based on an individual utxo. So since my above transaction is spending two utxos from the script address, the reference script must be executed twice even though the second execution is completely redundant.

The Proposed Change

It would be better in this context if scripts could (but don't have to) work more like public key signatures: only one signature is required no matter how many utxos come from that user. The cardano-node is already capable of detecting if there is a utxo without the necessary accompanying script.

I admit I am ignorant about certain lower-level implementations so all I can do is ask: why can there not be a transaction level script where the datum and redeemer are attached as usual? Here is how I am proposing my above transaction would look instead:

cardano-cli transaction build \
  --tx-in c1d01ea50fd233f9fbaef3a295ba607a72c736e58c9c9df588abf4e5009ad4fe#0 \
  --tx-in 622034715b64318e9e2176b7ad9bb22c3432f360293e9258729ce23c1999b9d8#2 \
  --spending-plutus-script-v2 \
  --spending-reference-tx-in-inline-datum-present \
  --spending-reference-tx-in-redeemer-file $swapRedeemerFile \
  --tx-in 766555130db8ff7b50fc548cbff3caa0d0557ce5af804da3b993cd090f1a8c3a#1 \
  --spending-plutus-script-v2 \
  --spending-reference-tx-in-inline-datum-present \
  --spending-reference-tx-in-redeemer-file $swapRedeemerFile \
  --tx-out "$(cat ../assets/wallets/01.addr) 2000000 lovelace + 300 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.54657374546f6b656e0a + 0 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.4f74686572546f6b656e0a" \
  --tx-out "$(cat ${swapScriptAddrFile}) + 4000000 lovelace + 0 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.54657374546f6b656e0a + 250 c0f8644a01a6bf5db02f4afe30d604975e63dd274f1098a1738e561d.4f74686572546f6b656e0a" \
  --tx-out-inline-datum-file $swapDatumFile \
  --tx-in-collateral bc54229f0755611ba14a2679774a7c7d394b0a476e59c609035e06244e1572bb#0 \
  --change-address $(cat ../assets/wallets/01.addr) \
  --tx-level-spending-tx-in-reference 622034715b64318e9e2176b7ad9bb22c3432f360293e9258729ce23c1999b9d8#0 \
  --protocol-params-file "${tmpDir}protocol.json" \
  --testnet-magic 1 \
  --out-file "${tmpDir}tx.body"

I removed the spending-tx-in-reference lines and added a tx-level-spending-tx-in-reference after change-address. If validation needs to be done on a per utxo basis, the original spending-tx-in-reference lines can still be used.

Minting scripts can already be used in a similar manner:

cardano-cli transaction build \
  --tx-in fadae52f0323d7178c8116aa6adce31aba3ad6c561cbe5b31009251f742aa1bb#1 \
  --tx-out "$(cat ../../assets/wallets/01.addr) 2000000 lovelace + 1000 ${alwaysSucceedSymbol}.${tokenName}" \
  --tx-out "$(cat ../../assets/wallets/02.addr) 2000000 lovelace + 50 ${alwaysSucceedSymbol}.${tokenName}" \
  --mint "1050 ${alwaysSucceedSymbol}.${tokenName}" \
  --mint-script-file alwaysSucceedsMintingPolicy.plutus \
  --mint-redeemer-file unit.json \
  --tx-in-collateral af3b8901a464f53cb69e6e240a506947154b1fedbe89ab7ff9263ed2263f5cf5#0 \
  --change-address $(cat ../../assets/wallets/01.addr) \
  --protocol-params-file "${tmpDir}protocol.json" \
  --testnet-magic 1 \
  --out-file "${tmpDir}tx.body"

Here the minting script is only executed once despite the minting occurring in two different outputs.

How would this work?

Two cases need to be considered:

  1. A transaction level script is used where a utxo level script should be used.
  2. A utxo level script is used where a transaction level script should be used.

The current way a spending script is written (in Haskell) is like this:

-- | validator function before being compiled to plutus
mkValidator :: Datum -> Redeemer -> ScriptContext -> Bool
mkValidator d r ctx = ...

Meanwhile minting scripts are written like this:

-- | minting policy before being compiled to plutus
mkMintPolicy :: Redeemer -> ScriptContext -> Bool
mkMintPolicy r ctx = ...

So taking inspiration from the fact that minting policies don't deal with a datum, I propose the following change to how spending scripts are written:

-- | new validator function before being compiled to plutus
mkValidator :: Maybe Datum -> Redeemer -> ScriptContext -> Bool
mkValidator Nothing r ctx = {- the case where the script can be used at a transaction level -}
mkValidator (Just d) r ctx = {- the case where the script can be used at the utxo level -}

When the script is used with the tx-level-reference-script option, Nothing is passed in for the datum. On the other hand, when spending-tx-in-reference is used like usual, the datum will be parsed and passed with the Just. This way the code explicitly handles both of the above cases.

Using this technique, it would also be theoretically possible to spend a utxo at a script address even if it doesn't have a datum attached. This assumes the proper accompanying logic.

What if a malicious entity forcibly passes in the wrong version of the datum (Nothing when it should be Just d or vice versa)?

The script logic can be written to account for this so I argue it is up to the developer to defend against this kind of attack. A simple error message when the wrong version is used could suffice for most use cases. For my use case, the code would be:

mkValidator :: Maybe Datum -> Redeemer -> ScriptContext -> Bool
mkValidator (Just _) _ _ = traceError "Not meant to be used at the utxo level"  -- ^ I don't want the script used in this case
mkValidator Nothing r ctx = {- do what I want -}

Can multiple transaction level scripts be used in one transaction?

I don't see why not. The node is capable of detecting if all relevant scripts are present in the transaction. The transaction would only be valid if all necessary scripts succeed.

Does this require a hardfork?

I do not know enough to say.

Extra Comment

I wasn't sure if this should be its own CIP or if it was related enough to CIP-33 to be opened as an Issue. Being that it is extending the behavior of CIP-33, I chose the latter.

CIP-0001: support parameter updates and CIP editor changes

As discussed on today's meeting, CIP-0001 no longer fits the community needs; following processes should be added:

  • Parameter update track
  • On-boarding of new CIP editors
  • Off-boarding of existing CIP editors

If you think some other processes should be added, please let me know and I'll add it in the ticket body. Regarding the magnitude of changes, I believe new CIP should be created for these processes, question is should we make a complete replacement, or just create a new CIP and link the extension to the CIP-0001?

CC: @SebastienGllmt, @KtorZ, @crptmppt?

CIP-0030 normalize wallet names

Creating an issue with the intent to create a CIP unless there is some obvious reason not to.

See the image below; the window.cardano[name] and window.cardano.[name].name can differ in case (and perhaps in other ways as well). This makes it unnecessarily hard to dynamically iterate available wallets, with the intent to window.cardano[key].enable() it.

I suggest to normalize the names to always be lowercase, and fully match the key they are registered under. If needed, we could instead add an additional property, key which must match the corresponding key in window.cardano.

The point against this is that this can be derrived by the key itself, but this just adds more complexity where it does not need to be.

CC @alessandrokonrad

image

Update older CIPs for revised CIP-0001

The CIP-0001's rework has been merged. In this rework, we've changed the preamble header structure and renamed some of the sections. Thus, for the sake of consistency, we'll need to update past CIPs to reflect this new structure. This issue is meant to help organizing the work around that. For each CIP, we need to:

  • Convert Authors to an actual bullet-point list (one name per line, starting with -)
  • Remove any field that is no-longer supported (e.g. type)
  • Add a Discussions field with a list (same as authors) of links to past discussions. At the very least, this should contain a link to the original PR (git log comes in handy to figure this out).
  • Add any other new fields specified by CIP-0001 (Category, Implementors...).
  • Some sections have been renamed and need to follow the structure given by the new CIP template. In particular, the path to active needs to divided into two sub-sections. It may very much be the case for older CIPs that the path to active is incomplete; which should be reflected in the new structure (CIPs without implementors or implementation plan shall be explicitly labelled as such).
  • Update the top level README.md if there is a status change for this CIP in the table.

Warning We may introduce categories as we see fit; however, categories that would refer to specific areas of the ecosystem (e.g. Ledger which also applies to RSS proposals) need to be endorsed by the respective teams of maintainers. Until this happens, we should refrain from using these categories and simply use N/A in the meantime.

In terms of process; here below is a list of all (currently) merged CIPs; Each item can be converted into issue and assigned to one person. Thus, if you intend to help, make an issue out of one of the point, assign it to you and make a follow-up PR with the changes. Once all CIPs have been updated, we should be able to repair the website build.

Hi @JaredCorduan et al,

Thank you Oliver.

I have considered asking for funding yet I still would like some sort of official support by the community or IOG. There are many that do not see the point in creating legal framework and I would like to hear from them because I only ever hear from people that agree with me. If everyone agrees a need for law is necessary then I will go ahead with making a full manual for tribunals.

In addition to the need for punitive legal framework in a governance system, someone will also need to make administrative/business law for non-punitive governance actions such as all these nice ideas we love talking about. I am not very good at making legal code around that but a couple of lawyers have reached out to me for that. They just need to have official support from some entity too before writing the code.

If law is not created before the governance proposal is implemented, then there will be many issues in the future or people simply will not use the system, call it broken like what happened with Catalyst, and move on with their lives.

V/r,

Kevin Mohr

CIP-0025: Why is the image tag marked as required?

CIP 25's title is NFT Metadata Standard which implies it's the standard for Non Fungible Tokens on Cardano.

However the image property tag is required in the current specification. Implying all 721 based NFTs require an image.
Is 721 metadatum metadata for all assets or only image focused assets? If so should the title be NFT Image Metadata standard for consistency and to avoid confusion.

This might seem pedantic but it matters when parsing 721 metadata to ensure it applies to the standards proposed in CIP25. The proposal currently implies without an image tag the NFT metadata is invalid.

Perhaps naming the token "777" is confusing?

Perhaps naming the token "777" is confusing? Again, it's an "easily recognizable" indicator as to the purpose of this token being "royalty control" over a target. Also because the implementation is different from the original CIP-0027 it seems like naming it is important rather than no name...and we implement a smartcontract for this since it needs to be "findable" given a token with a different policy ID (but shared policy hash).

Although it may not need a name standard, it could theoretically be called anything since a secondary market searches the smartcontract address for a matching datum and only cares about this token's policy ID when validating ownership and comparing hashes, policy script outcomes, etc.

Originally posted by @ullamonster in #168 (comment)

CIP-0025 needs clarification about asset name encoding

According to the developer's minting-nfts guide the token name is to be encoded hex format.

Moreover, with cardano-node versions >= 1.31.0, this is required.

I would think that CIP-25 needs to be updated. This section (merged in yesterday in #193) in particular:

The asset_name must be UTF-8 encoded for the key in the metadata map and the actual NFT. This is true for version 1.0, future versions will use the hex encoding for asset_name.

I think bumping the CIP-25 version should suffice. Perhaps to 1.1? E.g., the field "version": "1.0" would be "version": "1.1".

CC: @SebastienGllmt, @KtorZ, @crptmppt, @alessandrokonrad @SmaugPool thoughts?

CIP-0025 <asset_name> encoding

It is not clear what encoding should <asset_name> be. I originally assumed it to be hex, but it seems that people are using utf8. It would be great to specify it explicitly in the CIP. @alessandrokonrad

CIP-0030 | Browser Wallet Transaction Balancing

This CIP proposal follows the discussion on the PR #170 . I wanted to get people's opinion on how to structure the draft before submitting it.

The idea of this new CIP proposal is to extend CIP-0030 by requiring browser wallets to expose an additional function: balanceTx. As noted by @KtorZ , transaction balancing is not trivial and raises the bar for browser wallet implementors, so it was suggested to add an extension to CIP-0030 which can be optionally implemented.

Why a balanceTx function? For browser wallets to become usable with the Plutus Application Backend (PAB), they need to be able to balance partial transactions that come from the PAB.

It would make sense for balanceTx to stick to the same communication interface that the PAB uses with cardano-wallet (https://input-output-hk.github.io/cardano-wallet/api/edge/#operation/balanceTransaction).

The actual balancing implementation is an extension to CIP-0002. CIP-0002 describes how to generate a coin selection. The same algorithm should be applied (but also taking into account script inputs and redeemers).

However, CIP-0002 doesn't talk about how to adjust coin selection for network fees. Therefore, it should either be specified in this CIP, or create a new CIP which describes that part. Thoughts?

Any comments? Details you would like to be included?

CIP-0030 Suggestions

Paginate
...
if a wallet is modified between paginated calls that this will change the pagination, e.g. some results skipped or showing up multiple times but otherwise the wallet must respect the pagination order.

To avoid this issue we could change API functions with pagination to return an async iterator instead of Promise.

PaginateError
{maxSize} is the maximum size for pagination and if the dApp tries to request pages outside of this boundary this error is thrown.

Is the dApp supposed to try to call the method with {limit: Number.POSITIVE_INFINITY} to figure out max size? I think it's an odd API and if we keep the concept of pagination there should be a way to get the limit without an error.

type TransactionUnspentOutput = cbor<transaction_unspent_output>
...
api.getUtxos(amount: cbor<value> = undefined, paginate: Paginate = undefined): Promise<TransactionUnspentOutput[] | undefined>

I initially thought that TransactionUnspentOutput wasn't cbor, the definition could use better consistency: I think we should either define all types as cbor<[type]> or list all type definitions under Data Types.

api.getBalance(): Promise<cbor<value>>

Does it include rewards and deposit? Need to make this explicit, as using these funds requires certificates in the transaction.

api.getUsedAddresses(paginate: Paginate = undefined): Promise<cbor<address>[]>
api.getUnusedAddresses(): Promise<cbor<address>[]>

There will be different types of wallets. Some might be single address and not have any unused addresses. Given this API, dApp will probably expect to always get some unused addresses, which might not be the case. The dApp itself can figure out if it was used or not. I suggest to consolidate these to api.getAddresses(paginate: Paginate = undefined): Promise<cbor<address>[]>.

The wallet is free to return thereject with TxSendError

@rooooooooob

Fully homomorphic encryption circuits in Cardano...

It is a great feature for a smart contract to compute without decrypting the inputs and outputs.
This allows verifying private data, and knowledge of these.

For this, we would need to enable running zero knowledge proofs, or FHE circuits in Plutus.

Easiest way to do it would be to import an existing HE circuit library, and provide a reasonable cost estimate.
Please note that FHE/zkSNARKs are relatively expensive to compute so implementing them directly in Plutus may lead to unfeasibly complex transactions.

CIP-0025 inconsistencies

I'm working on implementing CIP-25 in CTL. Here are some problems I encountered:

  • The general structure section contains something that looks like a loosely defined JSON schema, however, it's not clear why do we need to encode long strings as arrays in JSON, where there's no limit for string byte lengths. I think different schemas should be provided for Json and Plutus data (note that CDDL is not a good solution to define plutus data - despite there's little room for arbitrary decisions, it's still underspecified)
  • The version property in V2 defined as optional in the description, but required in CDDL. I think it should be required, because otherwise some metas can be decoded using both V1 and V2 and the contents would be different.
  • Since policy_id is ScriptHash, its length limit should be 28 bytes (not reflected in CDDL)
  • asset_name is TokenName and thus must be 0-32 bytes (not reflected in CDDL)

CIP-0030 add key to WalletApi

It would be useful to be able to see which wallet provider you are connected to when building dApps

cosnt walletApi = await window.cardano[key].enable()
walletApi.key === key

Allow multiple categories?

I'm updating CIP-35 to be more in line with the new CIP-1. I notice that lots of Plutus changes are also Ledger changes, e.g. changes to the ledger-script interface, protocol parameter changes. The obvious thing for me to say is that in these situations a CIP should be in both categories and get reviewed by both sets of reviewers. But right now CIPs can only have one category.

CIP-9 Updatable params require a hard-fork event? Should be soft-fork.

In CIP-9, Updatable Protocol Parameters, it states:

"A change to the major protocol parameter version triggers a "hard fork" event. This will require stake pool operators to upgrade to a new software version that complies with the new chain production protocol as well as being able to verify the construction of the chain."

Upon investigation, a hard-fork is 5 of 7 genesis signing keys, required for major changes like Non-Updatable Parameters.

However, the Updatable Params only require 4 of 7 signing keys, and is a "soft-fork" (backwards compatible with old nodes), and much easier. Requesting permission to make updates to reflect this. This came up in a stake rewards equation minPoolCost discussion.

Ref Duncan Coutts clarification here

CIP-0025: Motivation and Asset Name Encoding

  1. The “Motivation” section is misleading. The quote saying “Since tokens are always created in specific forging operations, we can always trace them back through their transaction graph to their origin.” seems to imply that such a back trace through the history of the specific token will be happening. But the “Update metadata link for a specific token” section makes quite clear that nothing like that is happening and the metadata can also be updated for tokens that have long been minted and sent away. That is also what is implemented right now in wallet apps and NFT websites.

  2. The “Structure” section says: “This is true for version 1.0, future versions will use the hex encoding for asset_name.” Why, though? UTF-8 is already a binary encoding for strings in the Unicode character set. The usage of the hex strings with cardano-cli is a pure implementation detail, because handling of arbitrary UTF-8 strings on the command line makes things more complicated. But when we deal with JSON files (or CBOR metadata generated from them) there is no such problem at all. Switching to a hex representation (of UTF-8 encoded (sic!) Unicode strings) would unnecessarily blow up the size of the metadata, be harder to read for humans, and introduce new ambiguities (hexadecimal characters in lower or upper case, a–f vs. A-F).

CIP-35 and the Draft status

The Draft status of CIPs has been removed. The Plutus category of CIPs, however, still makes use of the distinction between Draft and Proposed (see CIP-35).

A public collateral and tx broadcast service

Context

To spend plutus script output, we need to provide collateral, which is burned if script execution failed.
This have several implications:

  • Wallet need to reserve a UTxO to use as collateral, usually several ADAs, not much, but still something, and maybe confusing to user.
  • If wallet didn't do full validation on tx, there's risk that one might lose the collateral.

Solution

It seems to me that we can have some public services to provide the collateral:

  • Wallet query collateral UTxO from the service /get_collateral
  • Wallet use them to build and witnesses the tx.
  • Wallet send the tx to the service /broadcast_tx
    • The service will validate the tx.
    • Witness the collateral.
    • Broadcast.

Security

  • User don't need to trust the service provider, since the tx is not malleable.
  • The collateral is not at risk of burn, since service provider will validate the tx themselves.

CIP-0030 GetBalance and Account/Network change

Hello,

After integrating ccvault wallet (making use of CIP-0030), I have two suggestions.

  1. getBalance(). It returns now the full balance of the account. Could it be possible to add another endpoint that returns the actual available balance? (total balance - ada attached to tokens). I am having the issue where I retrieve the balance to see if a user can pay for a CNFT, and total balance is higher than CNFT price, but their actual available balance is not. So when submitting the tx, it fails and user dont know why (when it is only that they dont have enough 'free' balance). It will always happen this. And problem will be bigger the more assets an account has.

  2. Account/Network change: Is it possible to have events when account/network is changed? Just like Nami wallet has now. That way is easier to subscribe to this event, and act accordingly (calling .enable() again to resfresh the API for example). Without this events it is more difficult to manage when user changes to testnet, or changes account, having the website with dApp connector 'opened' and not knowing this changes took place.

Thanks

CIP-0006 schema is not strictly compliant

Using ajv to validate MetadataExtended.json throws following warnings suggesting the schema is not strictly compliant:

strict mode: missing type "string" for keyword "maxLength" at "https://raw.githubusercontent.com/cardano-foundation/CIPs/master/CIP-0006/schema.json#" (strictTypes)
strict mode: missing type "string" for keyword "maxLength" at "https://raw.githubusercontent.com/cardano-foundation/CIPs/master/CIP-0006/schema.json#/properties/serial" (strictTypes)
strict mode: missing type "string" for keyword "minLength" at "https://raw.githubusercontent.com/cardano-foundation/CIPs/master/CIP-0006/schema.json#/properties/serial" (strictTypes)
strict mode: missing type "object" for keyword "required" at "https://raw.githubusercontent.com/cardano-foundation/CIPs/master/CIP-0006/schema.json#/properties/serial" (strictTypes)

CIP25 V2 - why is policy and token name not hex encoded bytes, rather than raw bytes?

It seems odd to me that in the proposed v2 metadata, the policy id and token name should be in raw bytes, not a hex encode bytestring seeing as this is what is ultimately stored on the blockchain. Could the reasoning behind this be explained to help me understand why? plus it would be helpful if an example of each of the v1 and v2 metadata was shown in the CIP with real world data, not just "" and "".

Thanks in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.