Skip to content

cryptape/ckb-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Time to Hello World on CKB

The target of this tutorial is very simple: use CKB SDKs in various languages to write "Hello Common Knowledge Base!" into a cell on CKB testnet and check it on CKB explorer.

Sample Code

Here's an example of how to write an on-chain message:

ckb-tutorial/js/index.ts

Lines 125 to 136 in 42bf1b5

// Step 1: this is the message that will be written on chain
const onChainMemo: string = "Hello Common Knowledge Base!";
// Step 2: construct the transaction
let txSkeleton = await constructHelloWorldTx(onChainMemo);
// Step 3: sign and send the transaction
const txHash = await signAndSendTx(txSkeleton, testPrivKey);
console.log(`Transaction ${txHash} sent.\n`);
// Done, let's see the transaction in CKB Testnet Explorer
console.log(`See ${CKB_TESTNET_EXPLORER}/transaction/${txHash}`);

Tutorials in different languages