Git Product home page Git Product logo

ckb-studio's Introduction

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)

ckb-studio's People

Contributors

actions-user avatar leonlianght avatar qftgtr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ckb-studio's Issues

Problem indexing Cells

The new version of indexer don't show me any new cell generated. This problem happened sometimes with the previous version, but now nothing can make the cells appear in the Live Cells screen in TX Constructor.

Application menu is non-standard for Windows users

The layout and naming of the "Application" menu doesn't follow commonly expected patterns.

I would recommend the following:

  • The "About" item should be moved the Help menu.
  • The "Quit" item should be renamed to "Exit" and moved to the File menu.
  • Optionally, the "Clear All App Data" could be moved to the File menu. (The Application menu should be removed if empty.)
  • The Help menu should be in the rightmost position. (File, Edit, View, Application, Help.)

20201105203506

starred功能没有起作用 [translation: starred feature is not working]

Translation:
The starred feature in Explorer and TX transaction is not working in v0.5.0 macOS version. The starred account is missing in dropdown menu even if I use star feature. Rebooting is not working as well.


使用的最新的0.5 mac版本ckb studio,但是使用过程中发现explorer和TX transaction部分的starred功能不起作用,即使相应的tab进行了star选择,依然不会显示在下拉菜单里面,重新启动也没有用

image

image

ckb docker v0.40 cannot run; (v0.39.2)Balance in Explorer tab is n/a

CKB Studio: v0.9.1
OS: Windows 10

1. ckb docker v0.40 cannot run in v0.9.1, ckb v0.39.2 is ok

docker exec -it ckb-default-v0400-v0.40.0 ckb miner
Error: No such container: ckb-default-v0400-v0.40.0

docker-0400-not-running
v0400-failed

v0.39.2 works well.
docker-0392-ok
v0392-ok


2. Balance in Explorer tab is n/a, ckb v0.39.2

The Refresh button cannot update the balance.
image

Testnet "TransactionPoolFull"

When I use CKB Studio met an error that notes "TransactionPoolFull", how to solve this?

  1. RPC clear_tx_pool maybe useful? If so, should I use that command in docker?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.