After writing the Celestia script, the inscription complained: "Cosmos' basic skills are not solid."

CN
PANews
Follow
1 year ago

Author: Wuyue, Geek Web3

On December 17th, I learned that there would be CIAS inscriptions on Celestia, so I planned to rush to write a script for inscriptions. Now, I have a lot of complaints about Celestia, the Cosmos ecosystem it is in, and the CIAS event itself.

Actually, writing a script for inscriptions is not difficult, mainly divided into three modules: wallet construction, connecting nodes, and flooding transactions. The first two steps can be quickly implemented by referring to the developer documentation of the target public chain.

I first visited the Celestia official website and Github, and found that there were no use cases for building scenarios for developers, mainly related to node operation and other documents. Of course, this can be understood, because Celestia is not a ToC blockchain. Celestia just mentions that it is based on Cosmos in an inconspicuous place, and can interact with its mainnet using CosmJS.

So I went straight to CosmJS. But Cosmos, how should I put it, can't even do the documentation well. I went directly to Github, and normally, this kind of JS would have usage examples on Github. But its tutorial is hidden on a secondary page, and after clicking in, following its configuration, there was an error in the end.

This error is not due to environmental issues, but because its tutorial did not keep up with version updates, often changing class names and causing other issues. Even after switching npm library versions in the old tutorial, some examples still did not work, so I gave up after struggling for a while.

So I googled it again, and found that the correct documentation is on the official website rather than on Github, which is somewhat illogical. Again, can't the readme on Github be updated to point to the official website?

After obtaining the correct documentation, I quickly completed the wallet construction and node connection steps, and started building the flooding transaction module. Simply put, this module is a for loop that handles transaction signing and network requests. But here, I encountered some problems:

All transaction methods in the CosmJS library only expose the parameters of the transaction itself, but its sequence is not exposed (sequence is similar to the nonce in Ethereum, it is a transaction counter set to prevent replay attacks, and both the nonce and sequence are automatically incremented after each transaction is sent).

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

Surprisingly, it fetches the sequence when signing from the network (as well as the chainId), which requires going through sendTokens() -> signAndBroadCast -> sign(). Waiting for the network to return after each transaction submission will affect the speed of flooding, and will also increase unnecessary network requests, which is not conducive to flooding, and of course, not conducive to speeding up/canceling a transaction.

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

Let's take a look at the transaction sending method in Ethereum Web3JS, where you can specify the nonce yourself. But in CosmJS, you cannot. I still think Ethereum's design is much more reasonable, as you can directly specify the nonce for canceling/speeding up transactions. If a transaction gets stuck, you can customize a transaction with the same nonce to replace the stuck transaction, and of course, it can also be used for our flooding attack.

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

Due to the tight time, and several other functions in other libraries that needed to be modified, I decided not to use Proxy to rewrite them, but to directly modify them in the CosmJS library.

The idea of the script triggering flooding transactions is to continuously initiate transactions and generate signatures through a for loop, send them to the RPC node, and after initiating 20 transactions, start the loop again.

The sequence is only fetched locally at the beginning of each flooding cycle, not like the default behavior in the CosmJS library, where the sequence is requested from the node after each transaction. The chainId is written as a fixed value, and does not need to be repeatedly requested from the node. (Editor's note: The number of loops set here is relatively low, obviously the author is not that aggressive yet. When someone was inscribing Conflux, they changed the number of loops in each cycle to 1000, sending out about 200 different transactions per minute)

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

In the end, I got a rudimentary Celestia script. On the evening of December 17th, after the CIAS was disconnected, I tested this script briefly and sent out hundreds of transactions. After the CIAS resumed on the early morning of December 19th, I did indeed inscribe some CIAS (about 1800). But there are still other things to complain about:

  • On December 17th, Celestia's RPC nodes had a serious data desynchronization issue, with significant differences in block heights between different RPC nodes. When you requested the sequence of your own account from the node, the results returned were basically inconsistent, which was very frustrating. The Celestia block explorer was also unavailable, basically causing confusion. It can be said that at this time, although the Celestia network did not crash and could still produce blocks, it was probably close to its limit.
  • On the same day, the CIAS inscription official saw that Celestia was struggling, and temporarily announced that all inscription forging transactions after block height 48460 were invalid, giving off a "exchange pulling the plug" vibe. And the CIAS website itself also crashed.

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

  • Some people believe that the native consensus protocol of the Cosmos chain is very poor in terms of block consensus, and I have no comment on this, but it is clear that the purpose of pulling the plug on CIAS last night is intriguing.
  • On December 17th, it was very difficult to select a node with the fastest data synchronization, because almost all RPC nodes were overloaded and often unresponsive. I later tried writing some code to automatically switch nodes.
  • The format of CIAS inscriptions itself is not quite consistent with other inscriptions, for example, in the json of brc-20, all numbers are strings, while in cia-20, they are actual numbers.

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

  • The cost of CIAS inscriptions reached a peak of 1.5~2U per inscription last night, and some people even paid 80U for an inscription. Such high fees reflect the limited TPS, and the founder of Celestia claimed that it can process 10k transactions per second, which is obviously nonsense.

Complaints after writing Celestia script for inscriptions: Cosmos basic skills are not solid

Overall, the experience on the evening of December 17th can be summed up in one sentence: Celestia definitely did not handle measures for large-scale traffic well at that time, and was also very perfunctory in terms of RPC node configuration (it is hard to imagine that dozens of RPC nodes could be blown up in just an hour).

The situation was much better on the evening of the 19th, except for the surge in gas fees, there were no major issues in other aspects. It can only be said that Celestia, as a DA network specifically for distributing data to light nodes, temporarily withstood the test, but it is unknown if there will be any other pitfalls in the future.

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到support@aicoin.com,本平台相关工作人员将会进行核查。

OKX:注册返20%
链接:https://www.okx.com/zh-hans/join/aicoin20
Ad
Share To
APP

X

Telegram

Facebook

Reddit

CopyLink