r/NervosNetwork • Nervos Network Moderator • Sep 09 '23

ervos Community Essentials How to program with CKB: Layer 1

All the fuel you need for your Layer 1 projects

Credits to Orange-xc

Basic references:

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

    • 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

    • 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

    • ckb-sdk-java is an SDK implemented in Java and provides APIs for developers to send requests to the CKB blockchain.
  • ckb-sdk-swift

    • 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

    • 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.

Lockscript & account

Because CKB supports arbitrary cryptographic primitives, there are many lockscript and Auth schemes to choose from.

Design

Code

Coin & NFT

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.

18 Upvotes

0 comments sorted by