Kadena Developer Documentation
website·Indexed 35 days ago
https://docs.kadena.io/quickstartDocumentation for the Kadena ecosystem, featuring the Pact smart contract language, the @kadena/client TypeScript library, and the kadena CLI. Includes guides on smart contract development, Chainweb node interaction, Pact REPL functions, and EVM integration via foundry-chainweb.
What's inside Kadena
- The Marmalade guard policy contract ensures that token-related actions—including minting, burning, transferring, buying, and selling—are restricted to authorized parties. When applying this policy during token creation, developers can specify the authorization requirements for each type of token activity.
Overview of the Kadena RWA Token Standard
The Kadena RWA token standard provides a set of open-source smart contracts written in Pact for issuing, managing, and transferring permissioned tokens on the Kadena blockchain. It is designed to be similar to the Ethereum ERC-3643 standard, enabling the tokenization of physical assets (e.g., real estate, art) and financial instruments (e.g., stocks, bonds) with built-in regulatory compliance and permissioned tracking.Overview of Marmalade Token Standard Architecture
Marmalade defines a poly-fungible token standard and token policy management system for the Kadena blockchain using Pact smart contracts. The architecture is multi-layered to separate concerns between core ledger operations, policy enforcement, and sales mechanics, ensuring transactions occur in the correct order and comply with predefined rules.Overview of the mvp-token RWA contract
Themvp-tokencontract is a sample real-world asset (RWA) token implementation on Kadena. It extends thefungible-v2interface to provide customizedmint,burn,transfer, andforced-transferoperations. It includes built-in functionality for pausing the entire contract or freezing specific investor accounts, and utilizes an identity registry to manage investor information. The contract is designed to be compatible with custom compliance rules via thecompliance-compatible-v1interface.Overview of Pact Guards
Guards in Pact are predicate functions used to enforce authorization rules that grant or restrict access to accounts, privileged operations, or information. A guard returns true (pass) or false (fail) when evaluated using the
enforce-guardfunction. Guards can be stored in the Pact database using theguardtype.Supported guard types include:
- Keyset guard
- KeysetRef guard
- User guard
- Capability guard
Note: Module guards and Pact guards are DEPRECATED and considered unsafe.
Overview of Pact database operations
Pact smart contracts use a key-row data model where rows are accessed via a single primary key. This model does not support traditional SQL-style joins, though relational logic can be implemented by performing sequential lookups across tables.
Key constraints include:
- No NULL values: To ensure transaction totality and safety, NULLs are not allowed. Reading a missing column value via
with-readwill result in an error. - No Delete operation: Pact does not provide a native delete function. To remove data, developers typically implement an
activecolumn to mark rows as active or inactive. - Versioned History: Every change to a column value is versioned by a transaction identifier, allowing for historical data retrieval of specific changes per transaction.
- No NULL values: To ensure transaction totality and safety, NULLs are not allowed. Reading a missing column value via
Overview of the Marmalade Royalty Policy
The royalty policy extends the basekip.token-policy-v2interface to implement specific rules for token actions and royalty payouts during the sale of non-fungible tokens (NFTs). It ensures that creators receive agreed-upon royalties when a token is sold.Overview of @kadena/client
The@kadena/clientis a Node.js package that provides an API for JavaScript and TypeScript applications to interact with the Kadena blockchain. It abstracts the logic required to perform common blockchain tasks such as checking account balances, creating accounts, transferring assets, executing smart contract functions, and signing transactions.Overview of the foundry-chainweb package
TheChainweb.solcontract in thefoundry-chainwebpackage provides core features for testing and deploying Solidity projects on the Kadena Chainweb EVM multi-chain network. It manages chain identifier mapping, switching between chains, fork creation, and multi-fork testing environments through four base contracts:Chainweb,ChainwebConfigReader,ChainwebTest, andChainwebScript.Overview of Chainweaver for Pact Development
Chainweaver is an integrated development environment (IDE) for the Pact programming language on the Kadena blockchain. It combines wallet and account management with tools for writing, testing, and deploying smart contracts. Key capabilities include:
- A built-in read-eval-print-loop (REPL) for interactive code execution.
- Smart contract module and function exploration.
- Management of authorization rules via keysets.
- Deployment and updating of contracts on local development, test, and main networks.
- Formal verification to mathematically prove code correctness and security.
Overview of Kadena Smart Contract Development Documentation
The Kadena developer documentation is structured into three main areas to support the development of smart contracts using the Pact programming language:
- Smart Contracts: Focuses on learning the Pact language, understanding blockchain-specific concepts, and implementing common programming patterns for secure applications.
- Reference: Provides a comprehensive technical directory of Pact syntax, keywords, built-in functions, and CLI tools for interacting with the Kadena blockchain across development, test, and production environments.
- Coding Projects: Offers hands-on coding challenges and sample projects (located in the
pact-coding-projectsrepository) to apply theoretical knowledge to real-world use cases.
Overview of Pact time management functions
Pact provides a set of built-in functions to manipulate, calculate, and format time-based information. These functions allow for adding/subtracting time intervals, calculating differences between timestamps, and converting between UTC values and formatted strings.Function Description add-timeAdd a specified number of seconds to a time. daysSpecify a number of days to add or subtract from a given time. diff-timeCompute the difference in seconds between two specified times. format-timeFormat a time value using a specified format. hoursAdd a specific number of hours to a given time. minutesAdd a specific number of minutes to a given time. parse-timeConstruct time from a UTC value using a specified format. timeConstruct a time object from a UTC value using the %Y-%m-%dT%H:%M:%SZformat.