CKB Developer's first Live Coding teaches exclusive cheats

Posted Jun 4, 20204 min read

Yesterday, the school sister performed the first three-hour live Coding in the Nervos live broadcast room. During the live broadcast, the school sister realized Open Transaction on site and also responded to everyone's requests. Women's clothing appeared.

???
WX20200604-173908@2x.png

image(2).png

Sister Xue said, if the response is good, then the series will continue to be broadcast in the future, if the response is not good... then this is the first and the last time for everyone to do Live Streaming.(Everyone travels and cherishes, don t forget to leave a comment in the comment area!)

This Live Streaming lasted a full three hours, which also made us have to lament the physical and mental strength of Xuejie. Believe me, this must not be beyond ordinary people's reach.As for whether there is a rollover? Let's take a look at the video review first ?

Tencent Video: https://v.qq.com/x/page/v0976...

In daily work, the school sister often needs to implement OTX. In line with the principle of not making all contracts by yourself and leaving everyone a chance, the school sister waited for a while after this Proposal came out. However, since this Proposal came out in March, no one has done it. Now the school sister urgently needs this contract, so she has to start her own hands.

Although our current contract development has many processes and routines to go, there are many debugging tools available, but these tools are not actually used frequently by everyone. We often hear people say, "I tuned for another night, and I couldn't get stuck there again." Wait for these situations. But in fact, some situations may not be so complicated, as long as you change the method can be achieved smoothly.

Therefore, in this live broadcast process, Xuejie explained the following four contents for us in detail:

  • Open Transaction concept
  • Transaction structure
  • Build & debug CKB script
  • Some useful suggestions

The entire live broadcast sister showed everyone how to write a contract better. The sister said that the most important point of writing a CKB contract is to first figure out the contract structure:

  • What does your transaction look like?
  • What kind of transaction does your contract accept?
  • What kind of transaction will be rejected by your contract?

If you have such a sufficiently complete data set, the process of actually writing a contract will become much simpler. Because when you have enough tests, you can carry out more convenient development.

You can write code to verify some transactions, and then use various tools to help you debug these contracts. You can even write some log messages to show the data used in the contract and debug the contract. As a result, contract development will become faster and faster.

Some practical tools

Xuejie has shared a lot of useful development tools and information throughout:

?standalone-debugger:Do you need to run a CKB chain every time you test a contract? Not necessary! Let's try standalone-debugger without running the CKB chain, directly test the contract, support debug, printf, you can view the contract cycle number and the complete contract running path, etc.:
https://github.com/xxuejie/ck...

?**Perkins' tent**:Create a CKB server directly through a docker image package, which not only contains ckb but also includes graphql-server, a more powerful ckb-indexer, flow control function, etc.:
https://github.com/xxuejie/pe...

?Felix:This is a DApp based on Lumos that sends red packets within telegram. Lumos is a dApp development framework based on JavaScript/TypeScript, so that developers can quickly develop based on JS/TS CKB ecological dApp now. Felix will develop more new functions based on it later:
https://github.com/xxuejie/felix

We hope to use these tools to help you simplify the debugging process as much as possible. If you can master some debugging skills from this streaming and help you reduce some contract development time, then this Live Coding will achieve its goal .

Small flower

Burning Field Episode

In the three-hour Live Streaming process, the school sister played a burning song for everyone in the interval of one hour:Memories and killing New Century Evangelion theme song "cruel na angel " , And My three-body chapter Beihai Biography ending night song "Night Star", once again brought us into the programmer's two-dimensional culture, and Nervos' naming origin(1000 words omitted here).

Young and ignorant chose EMACS

Some people said that when they saw that the elder sister was using EMACS, they didn't know that it was the editor he chose when he was young and ignorant. Now it is just muscle memory. Sister Xue has been trying to eliminate it, but has not been successful. At present, Xuejie is writing her own editor and expects to switch to her own editor in the near future.

Postscript

For some well-known reasons, the barrage function of the live broadcast last night passed us by, and this may be the biggest "rollover" during the live broadcast. Anyway, if you encounter any problems in the process of writing a contract, or if you have any new ideas that need to be communicated, you are welcome to leave a message or come to our forum to tell us that the school sister and the CKB team will know everything. **.

?talk.nervos.org?

Finally, I sincerely hope that everyone, whether it is the contract development process or the dApp development process, will be more and more smooth, stunning four on CKB! **