Skip to content
/ ccf Public

Cadence Compact Format (CCF) is a binary data format and alternative to JSON-CDC

License

Notifications You must be signed in to change notification settings

onflow/ccf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Cadence Compact Format (CCF)

CCF is defined in ccf_specs.md.

Status

CCF 1.0.0-RC3 is partially supported by the CCF codec deployed in June 2023 spork.

The CCF codec in Cadence is currently used for encoding events in CCF. Some CCF options (partially self-describing mode) are not yet implemented by the codec.

New Cadence types added to Cadence after August 4, 2023 are not yet added to CCF specs.

Introduction

CCF is a data format that allows compact, efficient, and deterministic encoding of Cadence external values.

Cadence external values (e.g. events, transaction arguments, etc.) have been encoded using JSON-CDC, which is inefficient, verbose, and doesn't define deterministic encoding.

The same FeesDeducted event on the Flow blockchain can encode to:

  • 298 bytes in JSON-CDC (minified).
  • 118 bytes in CCF (fully self-describing mode).
  •  20 bytes in CCF (partially self-describing mode).

CCF defines all requirements for deterministic encoding (sort orders, smallest encoded forms, and Cadence-specific requirements) to allow CCF codecs implemented in different programming languages to produce the same deterministic encodings.

Some requirements (such as "Deterministic CCF Encoding Requirements") are defined as optional. Each CCF-based format or protocol can have its specification state how CCF options are used. This allows each protocol to balance trade-offs such as compatibility, determinism, speed, encoded data size, etc.

CCF uses CBOR and is designed to allow efficient detection and rejection of malformed messages without creating Cadence objects. This allows more costly checks for validity, etc. to be performed only on well-formed messages.

CBOR is an Internet Standard defined by IETF STD 94. CBOR is designed to be relevant for decades and is used by data formats and protocols such as W3C WebAuthn, C-DNS (IETF RFC 8618), COSE (IETF STD 96), CWT (IETF RFC 8392), etc.

History

Commit history of ccf_specs.md file prior to Nov 29, 2022 are associated with README.md file.

Old branches can be found at https://github.com/fxamacker/ccf_draft.

License

CCF is licensed under the terms of the Apache License, Version 2.0. See LICENSE for more information.

About

Cadence Compact Format (CCF) is a binary data format and alternative to JSON-CDC

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published