Pular para o conteúdo principal

ChequableToken, An Extension of CBC20 Token Standard Enabling Cheque-Based Transactions

CIP-106Category: CBCTag: DRAFTLeitura de 3 minutos

ChequableToken, CBC20 Token Extension

Abstract

This CIP proposes the "ChequableToken" contract, an innovative extension of the BaseToken contract that introduces a cheque system. This system allows token holders to issue cheques, authorizing third-party spenders to withdraw a specified amount of tokens within a certain deadline, enhancing flexibility and control in token management.

Motivation

The primary motivation behind the ChequableToken contract is to provide a more flexible and secure way of authorizing token transactions. In some scenarios, traditional token allowances in CBC20 tokens can be too rigid and insecure. The cheque system in ChequableToken addresses this by allowing token holders to issue time-bound, nonce-tracked cheques to specific spenders, thus offering a more controlled and secure method for token allowances.

Specification

The ChequableToken Contract

Key Features:

  • Cheque Struct: A data structure for cheques, including the owner, spender, amount, nonce, deadline, and signature.
  • Cheque Issuance and Cashing: Functionality for issuing and cashing cheques, with nonce tracking, to prevent double-spending.
  • Nonce Management: A system for managing nonces to ensure each cheque is unique and used only once.
  • Signature Verification: A mechanism to verify that the token holder authorizes the cheque.

Technical Details

  • Blockchain Compatibility: Core Blockchain (Ylem Version >0.8.0)
  • Core Functions:
    • cashCheque(Cheque calldata cheque): A spender can cash a cheque, transferring the specified token amount.
    • _useNonce(address account, uint256 nonce): Private function to mark a nonce as used.
    • _computeChequeHash(...): Computes the hash of a cheque for signature verification.
  • Events:
    • ChequeCash(...): Emitted when a cheque is successfully cashed.

Rationale

Introducing a cheque system in the ChequableToken contract provides a more secure and controlled token transaction solution. It allows token holders to issue limited, time-bound authorizations, particularly useful in scenarios requiring conditional or deferred token transfers.

Backward Compatibility

ChequableToken maintains compatibility with the CBC20 standard, ensuring it can seamlessly integrate into the existing Core Blockchain ecosystem.

Security Considerations

Security is a significant concern, especially regarding handling signatures and nonce management. The contract should undergo thorough security audits to ensure its robustness and to mitigate potential vulnerabilities, particularly in replay attacks and signature forgery.

Conclusion

The ChequableToken contract extends the standard CBC20 functionality by introducing a secure and flexible cheque system for token allowances. This innovation could significantly enhance the utility and security of token transactions in various Core Blockchain-based applications.

Copyright and related rights waived via CC0.