Brian, an important Rust developer, has a first experience of building and running CKB

Brian, an important Rust developer, has a first experience of building and running CKB

In this article, he recorded the detailed operation process and mental journey of creating and running CKB's testnet and dev chain, and of course also included a lot of practical suggestions (tu). At the same time, this article is also a great experience report for developers who are new to CKB, recording whether the usage paths of CKB documents, testnet, ckb-cli, etc. are friendly, what designs are worth improving, how to make more developers join the CKB ecosystem more "painlessly", etc.

In the original text, we can find that words such as confuse and stuck often appear in front of us, and we can feel Brian's seriousness and thoughtfulness. At the end of the article, we have also sorted out some of the pitfalls or suggestions he encountered, welcome to refer to. If you are a friend who has never been exposed to CKB before and want to develop and play on Nervos CKB, then you are very welcome to watch Brian's practical ideas. In this article, you can see the pitfalls he has encountered, maybe this can help you save some time.

Original link:

https://talk.nervos.org/t/experience-report-first-time-building-and-running-ckb/4518

Translation & Proofreading: Brother Mus & Sister Kelly

Hi, I recently spent some time learning how to build and run CKB. In the process of creating this project, I built ckb and ckb-cli and a devnet that can mine, connected it to the testnet, used ckb-cli to create an account and transfer money on the testnet.

I find that when I start a new project, this method of documenting everything I see helps me understand it better, and there are almost always simple issues that pop up during the process that, if fixed, will improve the experience for others.

I hope documenting these experiences will help the development team understand what can be improved and help others get started developing on CKB. Thanks to Aimee for helping with resources and testing.

Written between March 12 and April 5, 2020

Try running CKB for the first time

I want to write a software that can run on CKB, but first I have to learn how to build, run CKB and use its tools. Although I don’t have any experience in blockchain development, I still have some understanding of CKB based on my past studies. I have also created a project on CKB VM:

http://www.ferrisfencing.org/

I started by downloading the main repositories on Nervos’ GitHub, which led me to the Nervos website. I needed to find the documentation for building and running a private testnet on CKB, because once I run a test node, I will need documentation on how to write, deploy, and test scripts.

Building CKB

I clicked into the Nervos development documentation (https://docs.nervos.org/introduction/welcome.html) and was surprised to find that there was nothing about building CKB. I think this may be because the document is aimed at developers building on CKB and assumes that they don’t need to build CKB themselves. But personally, I want to build and understand my entire development stack, especially for a platform like CKB that is still in the development stage.

I looked through the README on GitHub and didn't see any documentation on how to build CKB.

Although there are two links called "Get CKB" and "Quick Start", the "Get CKB" document also contains a "Build from source" section, which says to use make prod to build CKB. But since CKB is a Rust project, I didn't want to do that, and instead wanted to try using cargo build, so I did that, and it worked.

I'm always curious what other items are added to their Makefiles to enhance cargo, in this case it just adds --cfg disable_faketime. I have no idea what this is, but I guess faketime is a field that can be used during development. I note that this is a "negative" cargo feature and is generally discouraged.

Explore the developer documentation

I seemed to be quickly drifting off my “happy path” of exploring the documentation, as I had neglected the docs website and dug into the markdown of the GitHub repo, so I backtracked and started over to the docs website.

To make sure I wasn’t missing something I was looking for in the main documentation, I opened the Getting Started/Introduction page. This is about running a node, using a wallet, and transacting, not developer documentation.

I swear I got here by clicking on the “Developer Documentation” link. I double-checked—I clicked “Developer” → “Documentation” on nervos.org, which landed me at docs.nervos.org, which describes itself as:

This is the documentation site for Nervos CKB. Here you can learn about the design of Nervos CKB, as well as how to run a node and mine CKByte tokens.

I'm confused as to who the intended audience for this document would be.

There is another document on this site called “Developer Guide”, which also does not give any hints on how to build CKB. I also noticed that it emphasizes using a testnet called “Aggron”, which makes me feel that the method of running your own testnet may not be popular.

Read the testnet documentation

Based on the documentation, my new plan is to learn using the testnet. Although I plan to use my own CKB creation regardless of whether the documentation requires me to download a version.

The first paragraph of the Testnet Aggron page really confused me:

We are about to deploy a POA algorithm to generate blocks in the testnet. However, this will take some time to develop. Before that, we will routinely reset the testnet every hour without a block. The on-chain specifications for starting Aggron have been published here, please refer to the Aggron chain file information.

I think the "we" here should refer to the Nervos project, not the "royal we" often used in tutorial documents to refer to "you". And this seems to have been written a long time ago, when the testnet was just deployed. (Translator's note: This page was written on December 9, 2019).

This page asked us to download a new version of CKB. Then I checked the CKB release page and found that the latest version was v0.29.0.

I checked the v0.29.0 tag and rebuilt CKB in debug mode.

At this point I discovered that ckb-cli was not part of the ckb repo. I was able to find the ckb-cli repo easily, but encountered a stumbling block.

Create ckb-cli

There is no v0.29.0 tag in ckb-cli. I don't know which version of ckb-cli matches ckb. This discrepancy makes me doubt whether the tarballs released from the ckb repo include ckb-cli.

I downloaded the 0.29 tarball and found that it did contain ckb-cli . I wanted to confirm which version of ckb-cli it was, and it seemed that I had no choice but to run the latest version. So I did that, and saw the response:

  • ckb-cli 0.27.1 (9d0bf90 2020-01-31)

So ckb 0.29.0 is adapted from ckb-cli 0.27.1, and I guess these two versions are loosely coupled and I should always use the latest version of one of them.

I checked the latest version of ckb-cli and started building. This seemed to involve building another copy of ckb. A bit annoying, but that's it.

In a new window, I set up PATH to give me access to ckb and ckb-cli.

  • ~/ckb-testing$ export PATH="$PATH:$HOME/ckb/target/debug/:$HOME/ckb-cli/target/debug"~/ckb-testing$ ckb --versionckb 0.29.0 (a6733e6 2020-02-26)~/ckb-testing$ ckb-cli --versionckb-cli 0.27.1 (9d0bf90 2020-01-31)

I noticed on the testnet page that the example versions of ckb and ckb-cli are from November 2019 and have the same version number:

  • ckb 0.25.2 (dda4ed9 2019-11-17)ckb-cli 0.25.2 (6ca7bbb 2019-11-17)

Using the Testnet

Now I want to connect to the testnet and verify that I have the tools working.

Here are the original instructions:

  • Create aggron.toml in the directory containing the CKB binary

  • Initialize the CKB node with the command ckb init --import-spec ./aggron.toml --chain testnet .

The link to aggron.toml points to a gist from December of last year. I hope it's still valid.

I created a new directory ckb-testing to hold our testnet data and included the aggron.toml example in it.

Run ckb init:

 ~/ckb-testing$ ckb init --import-spec ./aggron.tml --chain testnet

The output is:

  • testing$ ckb init --import-spec ./aggron.toml --chain testnetWARN: mining feature is disabled because of lacking the block assembler config optionsInitialized CKB directory in /home/brian/ckb-testing/devnetcp ./aggron.toml specs/testnet.tomlcreate ckb.tomlcreate ckb-miner.toml

This looked like it was successful, copying aggron.toml into specs/testnet.toml and creating ckb.toml and ckb-miner.toml . I fiddled around with the two new toml files.

ckb.toml contains the following lines:


 [chain]# Choose the kind of chains to run, possible values:# - { file = "specs/dev.toml" }# - { bundled = "specs/testnet.toml" }# - { bundled = "specs/mainnet.toml" }spec = { file = "specs/testnet.toml" }

It shows that there is a built-in testnet definition, which makes me wonder if it is consistent with our own testnet definition. Let's see if we can find the built-in definition.

I searched for the configuration in the ckb repo using fd:


 ~/ckb$ fd "testnet.toml"resource/specs/testnet.toml

It’s true!

Is this built-in definition the same as the aggron.toml recommended by the developer documentation?

 ~/ckb$ diff ../ckb-testing/aggron.toml resource/specs/testnet.toml10c10< # run `cargo run cli hashes -b` to get the genesis hash---> # run `cargo run list-hashes -b` to get the genesis hash

Yes, except for one outdated comment.

Keep following the testnet documentation guys...

There is another description in the gist containing aggron.toml:

Please confirm that the genesis hash in the log output is 0x184ac4658ed0c04a126551257990db132366cac22ab6270bbbc1f8c3220f302d

But it doesn’t say how to verify it. The genesis hash is not output by ckb init . The next step in the testnet documentation is ckb run , which I executed. Windows Firewall asked for my permission, which I agreed to (I was running on WSL at the moment). I saw a lot of log output, and ckb had started running:

 2020-03-20 15:10:22.445 -06:00 main INFO sentry **Notice**: The ckb process will send stack trace to sentry on Rust panics. This is enabled by default before mainnet, which can be opted out by setting the option `dsn` to empty in the config file. The DSN is now https://[email protected]/14227952020-03-20 15:10:23.354 -06:00 main INFO main Miner is disabled, edit ckb.toml to enable it2020-03-20 15:10:23.374 -06:00 main INFO ckb-db Initialize a new database2020-03-20 15:10:23.624 -06:00 main INFO ckb-db Init database version 201911271355212020-03-20 15:10:23.636 -06:00 main INFO ckb-chain Start: loading live cells ...2020-03-20 15:10:23.636 -06:00 main INFO ckb-chain Done: total 2 transactions.2020-03-20 15:10:23.653 -06:00 main INFO main ckb version: 0.29.0 (a6733e6 2020-02-26)2020-03-20 15:10:23.654 -06:00 main INFO main chain genesis hash: 0x184ac4658ed0c04a126551257990db132366cac22ab6270bbbc1f8c3220f302d2020-03-20 15:10:23.654 -06:00 main INFO ckb-network Generate random key2020-03-20 15:10:23.655 -06:00 main INFO ckb-network write random secret key to "/home/brian/ckb-testing/data/network/secret_key"2020-03-20 15:10:23.668 -06:00 main INFO ckb-network Listen on address: /ip4/0.0.0.0/tcp/8115/p2p/Qme9oaLbtaqF6JyZnZhrNPoW3dSPkzJSW1PGag3fKdEuaj2020-03-20 15:10:23.718 -06:00 NetworkRuntime-1 INFO ckb-network p2p service event: ListenStarted { address: "/ip4/0.0.0.0/tcp/8115" }2020-03-20 15:10:24.415 -06:00 NetworkRuntime-1 INFO ckb-relay RelayProtocol(1).connected peer=SessionId(1)2020-03-20 15:10:24.415 -06:00 NetworkRuntime-0 INFO ckb-sync  SyncProtocol.connected peer=SessionId(1)2020-03-20 15:10:24.474 -06:00 NetworkRuntime-2 INFO ckb-sync Ignoring getheaders from peer=SessionId(1) because node is in initial block download2020-03-20 15:10:25.319 -06:00 NetworkRuntime-5 INFO ckb-relay RelayProtocol(1).connected peer=SessionId(2)2020-03-20 15:10:25.433 -06:00 NetworkRuntime-4 INFO ckb-relay RelayProtocol(1).connected peer=SessionId(3)2020-03-20 15:10:25.712 -06:00 NetworkRuntime-3 INFO ckb-relay RelayProtocol(1).connected peer=SessionId(4)2020-03-20 15:10:26.346 -06:00 NetworkRuntime-1 INFO ckb-sync SyncProtocol.connected peer=SessionId(2)2020-03-20 15:10:26.346 -06:00 NetworkRuntime-1 INFO ckb-sync Ignoring getheaders from peer=SessionId(2) because node is in initial block download2020-03-20 15:10:26.347 -06:00 NetworkRuntime-1 INFO ckb-sync SyncProtocol.connected peer=SessionId(3)2020-03-20 15:10:26.347 -06:00 NetworkRuntime-1 INFO ckb-sync Ignoring getheaders from peer=SessionId(3) because node is in initial block download2020-03-20 15:10:26.347 -06:00 NetworkRuntime-1 INFO ckb-sync SyncProtocol.connected peer=SessionId(4)2020-03-20 15:10:26.348 -06:00 NetworkRuntime-1 INFO ckb-sync Ignoring getheaders from peer=SessionId(4) because node is in initial block download2020-03-20 15:10:28.039 -06:00 ChainService INFO ckb-chain block: 1, hash: 0xcfbc1525e97bdb6e3202ff19270bddc1fcd6d8f1aee14c719064a8b989909f5d, epoch: 0(1/1000), total_diff: 0x1800060, txs: 1

This log indicates that the testnet has the correct genesis hash and we are syncing blocks.

I am currently at block 2704. I would like to know how many blocks there are on the testnet so I know how long I have to wait.

Is this a testnet-only block explorer? I googled “nervos block explorer” and found this:

https://explorer.nervos.org/

There is also a test network browser:

https://explorer.nervos.org/aggron/

There are 567493 blocks on the testnet, but I'm not particularly excited to wait for it to download.

My data directory is about 7MB in size, so I estimate that I will need (600_000/3000 * 7) = ~1.4GB of space for testnet development, which is still ok. But I really don’t want to wait for sync, so let’s move on to the next part.

The next document is the "Dev Chain", which hopefully will tell us how to use our own chain.

Setting up the dev chain

I temporarily stopped ckb which was syncing the testnet, moved all its data to ckb-testing/testnet , and then continued running ckb to sync the testnet.

Then I created ckb-testing/devnet. According to the dev chain documentation, I executed:


 ckb init --chain dev

It outputs:


 ~/ckb-testing/devnet$ ckb init --chain devWARN: mining feature is disabled because of lacking the block assembler config optionsInitialized CKB directory in /home/brian/ckb-testing/devnetcreate specs/dev.tomlcreate ckb.tomlcreate ckb-miner.toml

The dev chain documentation wants me to customize specs/dev.toml and set genesis_epoch_length to 1000. I looked at my dev.toml and genesis_epoch_length was already 1000.

It wants me to customize ckb-miner.toml to set the idle time interval (often referred to as value ) to 500. I glanced at ckb-miner.toml and value was already set to 500. This document seems to be out of date.

Translator's note: The document shows that the setting value is 5000 (the screenshot is from 2020/03/10)

Mining on the dev chain

As mentioned in ckb init, an initialized chain is not yet configured for mining. Step 4 of the dev chain document is titled "Configure block-assembler for mining in ckb.toml" and it says:

We use ckb-cli to generate lock_arg. lock_arg is needed to configure mining function, so please back it up.

I really wish it explained what lock_arg is, or linked to more information.

Then I ran ckb-cli account new.

It asked me to set a password, I set it to "foo", but the CLI didn't give me any response for a long time. I really wondered if it was broken.

Aimee wonders why we need an account. I guess it is connected to the public key of our miner, and the account will provide permission for the miner to store the mined CKB.

This part of the documentation is flawed.

Finally, the account creation command is completed and outputs:

 ~/ckb-testing/devnet$ time ckb-cli account newYour new account is locked with a password. Please give a password. Do not forget this password.Password: Repeat password: address: mainnet: ckb1qyq9u782efpvk8m3q88gplxlzadpct5d7ypqythss9 testnet: ckt1qyq9u782efpvk8m3q88gplxlzadpct5d7ypqewf0uelock_arg: 0x5e78eaca42cb1f7101ce80fcdf175a1c2e8df102lock_hash: 0xe68befeae28e69dc658565be71bc7146fd33a9a4bea3f7edba8de8c8c46865ff


Uh, looking at the output, it still needs some work. You can only see the labels (address, mainnet are also dark blue which is not visible in my terminal).

It took me 168 seconds to run the debug binary and sync the testnet in the background.

For the experiment, I stopped syncing to the testnet, ran ckb-cli account new again in the debug version; then rebuilt ckb and ckb-cli in release mode.

  • debug: 99 seconds
  • release: 15 seconds

So the debug build is 6.6 times slower. I continue to sync the testnet with the release build.
I'd like to know what lock_arg and lock_hash are. I searched online and couldn't find anything useful except "need to configure your mining software and export your private key".
I'll continue later.

Testnet reset!

I took a few days off while the testnet reset.
I discovered this because my ckb testnet started looking like this:

 2020-03-24 21:50:22.644 -06:00 NetworkRuntime-3 INFO ckb-network Ban peer PeerId(QmT6DFfm18wtbJz3y4aPNn3ac86N4d4p4xtfQRRPf73frC) for 300 seconds, reason: The nodes are not on the same network
Simply deleting the testnet data, reinitializing, and resyncing does not help. I see that the gist containing the Aggron testnet information now shows that the testnet already has a different genesis block.
I assumed I needed a new testnet configuration, and assumed Nervos had released a new version with updated testnet definitions. I fetched ckb and ckb-cli and saw that the latest tags were v0.30.1 and v0.30.0 respectively. I checked and built them in release mode.

Continue with dev chain setup

The next instruction in the Dev Chain document is:
Open ckb.toml and configure the [block_assembler] section.

  • lock_arg must be prefixed with 0x and followed by the text in args.
  • Fill in 0x in message

It’s pretty mysterious. ckb.toml has a bunch of details attached to the [block_assembler] comment section:
 # Set the lock script to protect mined CKB.## CKB uses CS architecture for miner. Miner process (ckb miner) gets block# template from the Node process (ckb run) via RPC. Thus the lock script is# configured in ckb.toml instead of ckb-miner.toml, and the config takes effect# after restarting Node process.## The `code_hash` identifies different cryptography algorithm. Read the manual# of the lock script provider about how to generate this config.## CKB provides an secp256k1 implementation, it requires a hash on the# compressed public key. The hash algorithm is blake2b, with personal# "ckb-default-hash". The first 160 bits (20 bytes) are used as the only arg.## You can use any tool you trust to generate a Bitcoin private key and public# key pair, which can be used in CKB as well. CKB CLI provides the function for# you to convert the public key into block assembler configuration parameters.## Here is an example using ckb-cli to generate an account, this command will# print the block assembler args(lock_arg) to screen:## ckb-cli account new## If you already have a raw secp256k1 private key, you can get the lock_arg by:## ckb-cli util key-info --privkey-path## The command `ckb init` also accepts options to generate the block assembler# directly. See `ckb init --help` for details.## ckb init## secp256k1_blake160_sighash_all example:# [block_assembler]# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8"# args = "ckb cli blake160"# hash_type = "type"# message = "A 0x-prefixed hex string"

Well, there are still a lot of things that are not explained clearly here:

  • What is the "CS architecture of miners"? I don't understand.
  • "Please refer to the lock script provider's manual." I don't know what a lock script provider is, nor do I know where the manual is.
  • "The hashing algorithm is blake2b with a personal "ckb-default-hash"" What is a personal "ckb-default-hash"?

I got to the last part:
 # [block_assembler]# code_hash = "0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8" # args = "ckb cli blake160" # hash_type = "type" # message = "A 0x-prefixed hex string"


There is no explanation here either.
After I expanded the documentation example output of ckb-cli account new and its example [block_assembler] , I finally understood what I needed to do, and I made some deductions.
The examples in the documentation are collapsed by default and may be difficult to understand. I ignored them without thinking, but I need them here.
What I think I should do is:

  • Forget code_hash
  • Replace all args with the value of lock_arg
  • Don't touch hash_type again
  • Set message to "0x"

I noticed that the documentation indicated that I needed to prefix lock_arg with "0x", but ckb-cli added a lock_arg with a "0x" prefix in its own output.
I don’t know what “massage” is, but apparently adding “0x” in front of it can appease ckb.
(Translator's note: The example that Brian did not expand is shown below)

Missing

That's basically the end of the documentation, it shows that we can use ckb-cli to get some work done, and there are also some SDKs that can automatically communicate with the ckb backend (there is no Rust SDK yet).
What I would like to do most is to write a contract that can run on CKB, but I am not sure whether it needs to go through the SDK.
I'm a bit stuck, but I made myself a plan:

  • Explore the capabilities of ckb-cli;
  • Try to use ckb-cli to make a transaction on devnet.

Send CKB on the testnet

(Many days later)
Today Aimee and I tried to send CKB transactions on the testnet. We synced the testnet and ran ckb run at the same time.
First, we used the testnet faucet to get some CKB, which requires a wallet address, so we first need a wallet. The document mentioned Neuron Wallet. But as a developer, I prefer to use command line tools and understand the underlying tool set. So I went to study ckb-cli in depth.
ckb-cli has a wallet subcommand. There is a wiki page describing the ckb-cli command, but it is enough to convince me that ckb-cli can provide more output.
I'm not aware of any other missing documentation at this point, so I guess we'll have to go through the CLI, plus intuition and trial and error.
When Aimee tried to run ckb-cli on her Mac, some system-level protection prevented her from running non-App Store applications.
Running ckb-cli with no arguments produces an interactive environment where the commands seem to correspond directly to the command line subcommands. I wonder if this is done automatically by their command line parser.
I needed an account to use this wallet, I researched the account subcommand, I had created a devnet account before, but no testnet account yet.
When I ran account list I got four accounts. When Aimee did it she got two.
I typed in accunt new and used "foo" as my password and Aimee used "hotsauce" as her password.

 CKB> account newYour new account is locked with a password. Please give a password. Do not forget this password.Password: Repeat password: address: mainnet: ckb1qyq2p6jgd8pnqlngy4cf4h7c76p383rug9sqw9e2hp testnet: ckt1qyq2p6jgd8pnqlngy4cf4h7c76p383rug9sqnq84malock_arg: 0xa0ea4869c3307e6825709adfd8f68313c47c4160lock_hash: 0xb686ca47423942cd64f4d091829450ad3b968b485d922b773a4672616a084c0c
Running account list , account #4 is my new account. I also see the devnet account I created earlier in this list. I guess the wallet account is a global resource. I noticed there is a ~/.ckb-cli directory.
According to the wallet documentation, we can use lock script hash, address, lock arg or pubkey to authorize access to our account. From the output of the account new command, I currently have all the pubkeys.
But I still don't know where to find the pubkey. I used lock arg to get the capacity in my wallet:

 CKB> wallet get-capacity --lock-arg 0xa0ea4869c3307e6825709adfd8f68313c47c4160total: 0.0 (CKB)
My capacity is 0 CKB.
Does this capacity represent the total amount of wallet in my account? I think it should be talking about this, because I don’t have any CKB, and I don’t have any storage capacity on the blockchain. My CKB balance is 0.
Aimee and I asked for some CKB from the faucet at the same time. About a minute later, we both got 5000 CKB.
I wanted to know what the block that gave me CKB looked like, so I ran:

 CKB> wallet get-live-cells --address=ckt1qyq2p6jgd8pnqlngy4cf4h7c76p383rug9sqnq84macurrent_capacity: 5000.0 (CKB)current_count: 1live_cells: - capacity: 5000.0 (CKB) data_bytes: 0 index: output_index: 0 tx_index: 1 lock_hash: 0xb686ca47423942cd64f4d091829450ad3b968b485d922b773a4672616a084c0c mature: true number: 55611 tx_hash: 0x1a8a1650dcf8bc21a210a970073b6d1a47eff13afdd649e5cb3ecc3d56c06083 tx_index: 0 type_hashes: ~total_capacity: 5000.0 (CKB)total_count: 1


I opened the transaction page on the testnet browser, and Aimee tried to send some CKB:
 CKB> wallet transfer --capacity 1000 --from-account 0x2af2ea2efbffce44f51cd4d7731507fdbbd63629 --to-address ckt1qyq2p6jgd8pnqlngy4cf4h7c76p383rug9sqnq84ma --tx-fee 1PassworD:0xc0a6973ac921cea95d27fa9e8a30ae6fca18de2404f768e3a077dd1e5f345ec0
What are those numbers in the output? This is the transaction hash, and 30 seconds later the transaction appears in the browser. I check my account:
 CKB> wallet get-capacity --address=ckt1qyq2p6jgd8pnqlngy4cf4h7c76p383rug9sqnq84matotal: 6000.0 (CKB)CKB> wallet get-live-cells --address=ckt1qyq2p6jgd8pnqlngy4cf4h7c76p383rug9sqnq84macurrent_capacity: 6000.0 (CKB)current_count: 2live_cells: - capacity: 5000.0 (CKB) data_bytes: 0 index: output_index: 0 tx_index: 1 lock_hash: 0xb686ca47423942cd64f4d091829450ad3b968b485d922b773a4672616a084c0c mature: true number: 55611 tx_hash: 0x1a8a1650dcf8bc21a210a970073b6d1a47eff13afdd649e5cb3ecc3d56c06083 tx_index: 0 type_hashes: ~ - capacity: 1000.0 (CKB) data_bytes: 0 index: output_index: 0 tx_index: 1 lock_hash: 0xb686ca47423942cd64f4d091829450ad3b968b485d922b773a4672616a084c0c mature: true
OK, now I finally know how to set up the testnet and devnet, and can transfer CKB through the command line in the testnet!

Appendix: CKB Documentation

Here is a list of some links I collected:

  • https://docs.nervos.org

  • https://github.com/nervosnetwork/ckb/blob/develop/docs/get-ckb.md

  • https://github.com/nervosnetwork/ckb/tree/develop/docs

  • RFC: Simple UDT Draft Spec

  • RFC: anyone-can-pay lock

  • https://gist.github.com/WilfredTA/bb1d2a80c420f0910d40ca881c2bd5d4

  • https://github.com/nervosnetwork/ckb-cli/blob/develop/README.md

  • https://github.com/nervosnetwork/ckb/wiki/Chains

  • https://github.com/nervosnetwork/ckb/wiki

  • Introducing Godwoken - A missing piece of the cell model

  • SECBIT Labs - zkp-toolkit-ckb - a Zero-Knowledge Proof toolkit for CKB

  • https://github.com/nervosnetwork/wasm-secp256k1-test

  • Summa - Bitcoin SPV Utils

  • https://github.com/nervosnetwork/ckb-cli/wiki/Sub-Commands

End of text

The above is the first experience of Brian, a heavyweight Rust developer, in building and running CKB. Let’s summarize Brian’s development ideas:

1. Build your own CKB chain
→ Download the CKB GitHub repo
→ Find the development documentation to learn how to write, deploy, and test scripts
→ Start from the beginning of the document to find out how to create your own private chain
→ If you can’t find it, try to build a test network (Aggron) first.
→ Synchronous test network
→ Build dev chain
→ Mining on the dev chain
→ Create Account
→ dev chain completed.
2. Try to send a transaction
→ Start with how to use the underlying ckb-cli command line
→ Find wilki for command line operation
→ Generate Account
→ Ask for money from the faucet
→ Send transactions to other addresses
→ Check your browser to confirm that it is complete.

Let's summarize Brian's points:

  1. I can’t find any instructions on how to build my own CKB chain in the documentation.
  2. There is no instruction on how to build CKB in the Getting Start document.
  3. The version numbers of ckb-cli and ckb do not match, maybe one is v0.29.0 and the other is v0.27.1, but there is no special description
  4. The documentation for Aggron test is still from December
  5. There is no guide telling you how long it takes to sync the testnet or where to go to the block explorer, etc.
  6. There is not enough explanation for the special meaning of the fields, for example, what does lock_arg \ lock_hash \ hash_type do? They are not explained in the document (ps, maybe some content like rfc19 will be helpful)
  7. Dev chain can give you some guidance to let you know that it is here to build your own CKB chain
  8. ckb-cli does not provide any immediate feedback or prompts after entering the password
  9. It doesn't seem to explain why you need to set a password.
  10. The testnet was reset and there wasn’t enough guidance for developers on what they should do.
  11. A thousand-word comment suddenly appeared in [block_assembler] of ckb.toml, but some parts of the comment itself are difficult to understand
  12. The examples in the document are collapsed by default and may be accidentally overlooked.
  13. It seems that the documentation does not clearly explain why many instructions are done this way, such as why lock_arg must be prefixed with 0x, why massage must be filled with 0x, etc.
  14. What is capacity in a wallet? It seems that many of the technical terms seem to be known to developers.


Brian's first experience of building and running CKB is a very detailed developer experience report that is worth referring to and learning from. After reading it, do you also want to explore CKB? From the article, we can see that there are still many areas that need to be improved on Nervos CKB waiting to be discovered and improved. In fact, CKB "Lina" is still a child who is less than five months old, and it needs everyone's wisdom to help her grow together.
Nervos has always advocated the spirit of open source, and hopes to improve the project and ecology with the community. We are also very willing to see everyone's feedback. Here, we extend an invitation to all developers, and welcome you to experience CKB. Whether it is to find bugs, build applications, or simply issue transactions, whether it is praise or complaints, we welcome it very much, and these will be the best gifts for Lina.
What pitfalls have you encountered on CKB? Feel free to tell us in the comments section. We look forward to seeing more of your “experience reports”!

<<:  The Secret History of Bitcoin: The Mysterious Street Bitcoin Trader

>>:  Canaan Technology: I lost 1 billion last year, but I still have enough money in my account to live for another year

Recommend

Is it good for a woman to have a small mouth and thin lips?

Lips are one of the important parts of the human f...

Five characteristics of a playboy, have girls noticed?

There is an old saying that marriage is a woman’s...

Girls will marry rich men

Girls will marry rich men What is a rich palmistr...

The face of a woman who is prone to gossip in marriage

The face of a woman who is prone to gossip in mar...

What does it mean when the career line is broken?

Many people will find that their career lines are...

What is the fortune of people with flat arches?

The shape of a person's feet actually has as ...

What are mandarin duck eyes? Mandarin duck eyes face reading

What do mandarin duck eyes look like? Analysis of...

DeFi Dark Forest Adventure: This is how I recovered millions of dollars

Summary: The biggest problem is that the hacked w...

Physiognomy: Women's Physiognomy that Men Should Stay Away from

Physiognomy: Women's Physiognomy that Men Sho...

Boys with too light eyebrows will have bad luck in love

For a person, in fact, many aspects of his or her...