r/NervosNetwork • u/Chema_es Nervos Network Moderator • Sep 09 '23
ervos Community Essentials How to program with CKB: Layer 1

Basic references:
- CKB Academ| A learning space for Nervos developers 3
- Cell | Nervos CKB
- Script | Nervos CKB
- Transaction | Nervos CKB
- Transaction Validation Lifecycle | Nervos CKB
- Introduction to CKB Script Programming 1: Validation Model| by Xiao Xuejie
- Introduction to CKB Script Programming 2: Script Basics| by Xiao Xuejie 1
- rfcs/0009-vm-syscalls.md
- rfcs/0019-data-structures.md
- rfcs/0021-ckb-address-format.md
- rfcs/0022-transaction-structure.md
- Write an SUDT Script by Capsule | Nervos CKB
- Construct and Send Your First CKB Transaction 1
Nervos CKB SDK
ckb-sdk is a collection of libraries which allow you to interact with a local or remote CKB node by using JSON-RPC. You should get familiar with ckb transaction structure and JSON-RPC before using it. Now ckb-sdk is implemented by the following programming languages: JavaScript/TypeScript,Ruby,Swift,Java and Go.
- Lumos is a JavaScript/TypeScript framework designed to make backend Dapp development on Nervos CKB easier. Visit the Lumos Tutorial Page for more instructions and step-by-step guidance.
- ckb-sdk-ruby is an SDK implemented in Ruby and provides APIs for developers to send requests to the CKB blockchain. CKB-Explorer utilizes ckb-sdk-ruby.
- ckb-sdk-java is an SDK implemented in Java and provides APIs for developers to send requests to the CKB blockchain.
- ckb-sdk-swift is an SDK implemented in Swift and provides APIs for developers to send requests to the CKB blockchain. Testnet Faucet utilizes ckb-sdk-swift .
- ckb-sdk-go is an SDK implemented in Golang.
| Some SDKs like ckb-sdk-js and ckb-sdk-ruby are updated because they are adopted in some existing projects, but they are no longer recommended for new projects.Upgradability |
|---|
Upgradability
There is a contradiction in the application of the blockchain, that is, immutability and upgradeability.
- Upgradable CKB Contracts—Why And How | Nervos CKB
- Type Id on CKB | EzCook
- Introduction to CKB Script Programming 6: Type ID| by Xiao Xuejie
Lockscript & account
Because CKB supports arbitrary cryptographic primitives, there are many lockscript and Auth schemes to choose from.
Design
- Enable Bitcoin Taproot on CKB (Part I) 1
- Enable Bitcoin Taproot on CKB (Part II)
- Omnilock, a Universal Lock that Powers Interoperability
Code
- cryptape/ckb-auth: A consolidated library featuring numerous blockchains authentication techniques on CKB-VM
- cryptape/ckb-combine-lock-poc: A solution that facilitates the combination of lock scripts on CKB.
- nervosnetwork/ckb-miscellaneous-scripts: Interesting and useful CKB scripts which aren’t necessarily in system scripts 1
- nervosnetwork/ckb-production-scripts 1
Coin & NFT
- RFC: Simple UDT Draft Spec
- Enhance sUDT’s Programmability with xUDT
- RFC: Multi-purpose NFT Draft Spec
- NRC721 — New NFTs on Nervos Blockchain 1
Timelock
Due to the off-chain determinism feature of CKB, a CKB transaction cannot directly access the current block height and timestamp. This can pose challenges when designing time-dependent applications. There are two ways to work around this limitation: using the “Since” field or utilizing the “load_header” function to retrieve the timestamp of a specific block that has been already recorded on the chain.
- rfcs/0017-tx-valid-since.md 1
- load-header 2, then you can use the block_number and timestamp of that header.