• Stars
    star
    176
  • Rank 216,987 (Top 5 %)
  • Language
    JavaScript
  • License
    GNU General Publi...
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An IDE to develop CKB scripts for Nervos blockchain

CKB-Studio

CKB Studio is an IDE to develop CKB scripts on the Nervos blockchain. It includes

If you want to learn more about how to use CKB Studio, please go to the Tutorials section.

Installation

Download

Installation packages are provided in releases. Please select the appropriate format according to your operating system (.dmg or .zip for Mac OS, .exe for Windows, or .AppImage for Linux).

Install

  • MacOS: Double-click to open CKBStudio-x.x.x.dmg and drag CKB Studio into the Applications folder.
  • Windows: Double-click CKBStudio-x.x.x.exe to install CKB Studio. If you see a warning window for unrecognized app, click more info and then click the Run anyway button to start the installation.
  • Linux: Right-click CKBStudio-x.x.x.AppImage, select Properties => Permissions => Execute, and check the option Allow executing file as progrom. Close the property window and double-click the application to open it (different Linux systems may have slightly different installation procedures).

Feature Walkthrough

Install Dependencies for CKB Development

When CKB Studio is started for the first time, it will display a welcome page to help you install the dependencies for CKB development - Docker, CKB Node and CKB Compiler.

  • CKB Studio uses Docker to run CKB node and the compiler. If you don't have Docker installed before, click the Install Docker button to open the Docker official website and follow the instructions to download and install.
  • CKB Node (nervos/ckb) contains all the necessary softwares and dependencies to start a CKB node.
  • CKB Indexer (nervos/ckb-indexer) is an application that keeps track of live cells and transactions for specified address (lock script).
  • Capsule (obsidians/capsule) is development framework for creating CKB smart contract scripts in Rust language.
  • CKB Compiler (nervos/ckb-riscv-gnu-toolchain) contains all the necessary softwares and dependencies to compile CKB scripts in C.

For each of the required libraries, you can select from different versions to install in the dropdown menu. The latest version is always recommended.

CKB Script Editor

Project List

The main interface will show a list of CKB projects. If you open CKB Studio for the first time, this list will be empty. You can click the New button to create a new CKB project. CKB Studio has provided a list of templates to help you get started:

  • [Rust] CKB project in Rust
  • [JavaScript] moleculec-es
  • [JavaScript] molecule-javascript
  • [JavaScript] minimal
  • [JavaScript] HTLC
  • [C] carrot
  • [C] Simple UDT
  • Duktape

After a project is created, CKB Studio will automatically navigate to the project editor.

Compiler

Click the Build button (with the hammer icon) in the project toolbar (above the file tree) to compile the current CKB project. CKB Studio will choose the right compiler to use depending on the project language (JavaScript or C).

There is an extra step before building a JavaScript project. You will need to type the command npm install or yarn manually in the terminal to install the project dependecies.

The compiled files will be at different locations based on the project language:

  • build/* for JavaScript project
  • {script_name}.o for C project

Debugger

CKB Studio has integrated the CKB debugger. Click the Debug button (with the bug icon) in the project toolbar to debug the current CKB project.

The debugger will run the mocked transaction defined in mock/tx.json (or the file defined in the project settings). It will help you run the CKB script and check the execution result very easily.

CKB Keypair Manager

Click the green button (with the key icon) in the bottom left corner to open the keypair manager. In the keypair manager, you can create, import, and manage CKB keys. Make sure you created some keypairs before creating a CKB node. To initialize a CKB node, you will need a miner address to receive the mining rewards.

Please note that all keys in the keypair manager are for development purpose only. The private keys are saved unencrypted so DO NOT use them on the mainnet.

CKB Node Manager

Create a Node Instance

Click the Network tab in the header to open the CKB network manager, where you can manage instances for CKB nodes and start running a CKB network. If you open CKB Studio for the first time, the instance list will be empty.

To create a new CKB node instance, click the New Instance button. You need to select a block assembler as the miner so make sure you have created keypairs in the Keypair Manager.

Start a CKB Node

Click the Start button to start a CKB node. Once the node is started, you can see the node log, indexer log, and miner log in the terminals below.

Switch Networks

In the Network dropdown menu you can switch to other networks such as the Aggron testnet or the CKB mainnet. Switching the network will stop your curretnly running instance.

CKB Explorer

In the Explorer tab, you can look at basic account information and transaction history.

CKB Transaction Constructor

CKB has a special cell-based structure for its transactions. The TX Constructor is a dedicated client to facilitate the construction of CKB transactions.

Cell Explorer

Cells are the fundamental elements to form CKB transactions. The bottom half of the interface is a cell explorer where you can look through available cells (live cells) for each address. To learn more about CKB cells, please refer to the cell model.

In the cell explorer, you can

  • Check the total number and total capacity of live cells
  • Double-click a cell to look at its detailed information
  • Use the show empty cells toggler to show/hide empty cells (cells that do not have data & type script)
  • Drag cells to Inputs or Deps to construct transactions
  • Generate CKB transactions for specific types (see below)

Assemble General Transactions Manually

If you want to make a general transaction, you need to assemble the input, output, and dep cells manually using the transaction constructor. You probably need to use some empty cells, so remember to turn on the show empty cells toggler to display them in the cell explorer. Drag the cells you need to Inputs and Depts, and click the new button next to Outputs to create output cells.

Once the inputs, deps and outputs are set properly, click the Push Transaction button where you can see the raw transaction object. Select keys you want to use to sign the transaction and click the Sign Transaction button. CKB Studio will load required private keys to finish the signing, and update the transaction object with witnesses data. Then you can click the Push Transaction button to submit the transaction, and wait until it is confirmed by the CKB network.

Generate Transactions of Specific Types

For some specific types of transactions, CKB Studio can help you determine which cells to use and combine them into a transaction. The following types of transactions are supported now

For example, click the Transfer button next to search bar to open the Transfer window. You can type in the amount and the recipient address, and CKB Studio will look through all available empty cells and generate a transaction that satisfies your entered values. You can also use the same button to transfer a UDT token. Next, following the same procedures as described above to sign the transaction and push it to the running CKB network.

Tutorials

Tutorials by Jonathan Caras

Video Tutorials by Phil (in Chinese)

More Repositories

1

Black-IDE

Black IDE is a cross-platform graphic IDE for smart contract development on Ethereum and EVM-compatible blockchains.
JavaScript
267
star
2

ConfluxStudio

An IDE to develop smart contracts on the Conflux blockchain
JavaScript
197
star
3

BNB-Studio

JavaScript
191
star
4

AlgorandStudio

An IDE to develop Algorand Smart Contracts (ASC1) for the Algorand blockchain
JavaScript
147
star
5

bsc-dapp-tutorial

Dapp Development Tutorial on BSC Binance Smart Chain
73
star
6

bsc-dapp-example

JavaScript
52
star
7

SubstrateIDE

Graphic IDE for Substrate development
JavaScript
42
star
8

conflux-dapp-tutorial

使用 Conflux Studio 在 Tethys 网络下开发一个简单的代币应用
27
star
9

vscode-algorand

Algorand VS Code Extension
TypeScript
12
star
10

bsc-components

Solidity
9
star
11

conflux-frontend-react

JavaScript
9
star
12

XuperIDE

JavaScript
9
star
13

algorand-tutorial

8
star
14

PlatON-Studio

JavaScript
8
star
15

electron-components

JavaScript
7
star
16

eosio-contracts-build-tools

Dockerfile
6
star
17

HecoStudio

JavaScript
6
star
18

EOS-Studio-Releases

5
star
19

eos-studio-docs

EOS Studio Documentations
Python
3
star
20

eosstudio-helloworld

JavaScript
3
star
21

eth-components

JavaScript
2
star
22

CKB-Studio-Releases

2
star
23

conflux-components

JavaScript
2
star
24

ckb-components

JavaScript
2
star
25

matchflow

JavaScript SDK for Conflux DEX MatchFlow
JavaScript
2
star
26

BIF-Core-Studio

JavaScript
1
star
27

electron-demo

JavaScript
1
star
28

ckb-templates

C
1
star
29

eth-studio-docs

Python
1
star
30

eosblog

Vue
1
star
31

studio-build-action

Github action for studio
JavaScript
1
star
32

substrate-components

JavaScript
1
star
33

hub.ide.black

TypeScript
1
star
34

eosblog-contract

C++
1
star
35

algorand-components

JavaScript
1
star
36

EOS-Studio-Desktop

1
star
37

SixDegreesEOS

Code for the winning project in #EOSHACKATHON
JavaScript
1
star
38

ChainMaker-IDE

Chain Maker IDE
JavaScript
1
star
39

secrypto-txs

Blockchain transaction synchronizer
JavaScript
1
star