Closed Keith-CY closed 3 months ago
We can use pegjs to parse the .mol
format description file, and use it to parse these data.
Personally, I have doubts about the necessity of this feature.
Unlike Ethereum, where it is an uncommon and SUPER expensive practice to store textual content in data
in UTF-8 encoding on CKB. Ethereum is able to do this because when we transfer Ether to an EOA account, the data
field is ignored by the transaction execution, and usually the additional data does not raise the transaction fee too much.
However, writing a byte to data
costs an extra 1 CKB, we can look at this famous Ethereum transaction, which wrote a total of 8501 byte of data in data, if it is on CKB, it costs an additional 8501 CKB, although this 8501 CKB can be retrieved at anytime, most of the SDKs cannot manipulate such a cell with data, because the SDK will consider the cell is not a free one, and will not spend it.
So I think "decode data in UTF-8" is just a corner case, and maybe we should think more about this feature
Personally, I have doubts about the necessity of this feature.
Unlike Ethereum, where it is an uncommon and SUPER expensive practice to store textual content in
data
in UTF-8 encoding on CKB. Ethereum is able to do this because when we transfer Ether to an EOA account, thedata
field is ignored by the transaction execution, and usually the additional data does not raise the transaction fee too much.However, writing a byte to
data
costs an extra 1 CKB, we can look at this famous Ethereum transaction, which wrote a total of 8501 byte of data in data, if it is on CKB, it costs an additional 8501 CKB, although this 8501 CKB can be retrieved at anytime, most of the SDKs cannot manipulate such a cell with data, because the SDK will consider the cell is not a free one, and will not spend it.So I think "decode data in UTF-8" is just a corner case, and maybe we should think more about this feature
It's not limited to UTF-8
encoding, but depends on the business logic of the cell.
As I briefly mentioned in the discord channel, I suggest running a node.js service to go through cells and translate their raw data into business data with the help of dapps' SDKs.
The data should be explained by the dapp providers.
Furthermore, we can expose an API to accept decoded data of a transaction and authenticates dapp providers to decode the data. Once the decoding service can be deployed standalone, we can run it ourselves.
This feature can be adopted on witness
, too(I got this feature request recently)
I'm inspired by the translation feature on selection.
What if the data can be parsed partially by selection?
Complex strings containing multiple encoded data can be parsed separately.
Expected algorithms
IMO, this feature can be enabled on address, args, too
We can move this issue to #469 , it's also related to the way we display transaction information.
@Keith-CY @Kirl70 here's the UX plan, please check this translation-like user interaction design.
@Keith-CY @Kirl70 here's the UX plan, please check this translation-like user interaction design.
About whether this new feature needs a prompt/tips. I think it's unnecessary. The reason is: currently, the user's typical action is to click here if they want to copy the data for decoding. With the changes, when they click, the corresponding decoding pop up will display. So, the transition is quite natural, and there's no need for an additional prompt in the design.
关于此新功能是否需要提示。 我觉得不需要。理由是:现在目前的操作是,如果用户想要复制Data进行decode,他会点一下这里,然后复制。改动之后,他点击时,就会有相应的decode算法,所以过渡其实比较自然,就没有另起设计提示。
Design Draft: figma.com/file/6XNoimRDbFTTNm016rbIdU/Magickbase?type=design&node-id=29085%3A17636&mode=design&t=TRJHXdueGMbI8zsc-1
LGTM, it's better to have a Copy button next to the decoded content
LGTM, it's better to have a Copy button next to the decoded content
Copy
button has been added.
Related issue #498 , I will mark this as Hold On, and we can only track #498
Partially done by https://github.com/nervosnetwork/ckb-explorer-frontend/commit/4710e4c52ae446b212084755845662503f1ac5f4
Available in transaction parameters.witnesses
, Cell Info
E.g. https://pudge.explorer.nervos.org/transaction/0x5709cdc5cab0cfe17749d0118b4cf9b23fd1e06e64b8a4164b50972945dbc7b0#1
The decoder positioning will shift when used on the page, sometimes thinking that the current information cannot be decoded.
The decoder positioning will shift when used on the page, sometimes thinking that the current information cannot be decoded.
2024-04-03.13.59.19.mov
It should have been optimized
The decoder positioning will shift when used on the page, sometimes thinking that the current information cannot be decoded. 2024-04-03.13.59.19.mov
It should have been optimized
On which PR was the optimization performed? You can post a link. I still see this problem on Testnet.
The decoder positioning will shift when used on the page, sometimes thinking that the current information cannot be decoded. 2024-04-03.13.59.19.mov
It should have been optimized
https://pudge.explorer.nervos.org/transaction/0x5dc3868ae53725530b6bd74965d9576880f2858a34b2f9ede6a6d0e4ac310f22 This is an arbitrary data link on Testnet.
The decoder positioning will shift when used on the page, sometimes thinking that the current information cannot be decoded.
2024-04-03.13.59.19.mov
The position of the encoding pop-up window after clicking is as shown in the video.
Discussed in https://github.com/Magickbase/ckb-explorer-public-issues/discussions/324