Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xUDT example met TransactionFailedToVerify when issue token #472

Closed
rink1969 opened this issue Oct 17, 2024 · 5 comments
Closed

xUDT example met TransactionFailedToVerify when issue token #472

rink1969 opened this issue Oct 17, 2024 · 5 comments
Assignees

Comments

@rink1969
Copy link

我是自己起了个dev节点,然后自己挖矿
运行xUDT example的时候,pivkey填的直接是coinbase地址的私钥
然后就遇到这个错误。

我调试了一下,好像构造交易的时候不管output用多少capacity,一股脑把账户上所有的live cell都塞到了inputs里
因为我用的是coinbase地址,所以一下塞了好几千个input

然后我转了500个ckb到一个单独的地址上,用这个地址的私钥,再跑xUDT example就没问题了

@RetricSu
Copy link
Collaborator

看起来应该是没有细化 input 需要的 capacity,我们会改一下

@RetricSu RetricSu self-assigned this Oct 21, 2024
@RetricSu
Copy link
Collaborator

RetricSu commented Oct 21, 2024

@rink1969 我这好像没法复现,你用默认例子中默认的私钥(offckb 中这个账号会有 42000000 CKB) 会有这个 input 全部塞入的现象吗?能否提供下使用的 examples 例子的代码链接、本地链的版本等信息。

@rink1969
Copy link
Author

我这测试还是会有这个问题。
关键倒不是账户里面的ckb有多少,主要是账户下面live cell特别多。

我也看了一下代码,并尝试了修改。
https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/xudt/lib.ts#L49 的 completeInputsAll 改成用 completeInputsByCapacity 就可以了。

另外还有一个小问题: https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/xudt/index.tsx#L47 这里的 balance > 6100000000 是不是应该把后面的8个0去掉?因为我看 https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/xudt/index.tsx#L26 这里设置balance的时候已经把单位从shannon转成ckb了

@rink1969
Copy link
Author

我起的本地链版本是0.117.0
另外因为是自己起的devnet节点,xUDT合约也是自己部署的,所以demo也有挺多修改
但是我检查了一下,应该跟这个issue没关系。

@RetricSu
Copy link
Collaborator

RetricSu commented Oct 23, 2024

另外还有一个小问题: https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/xudt/index.tsx#L47 这里的 balance > 6100000000 是不是应该把后面的8个0去掉?

是的,我修复了下

我也看了一下代码,并尝试了修改。把 https://github.com/nervosnetwork/docs.nervos.org/blob/develop/examples/xudt/lib.ts#L49 的 completeInputsAll 改成用 completeInputsByCapacity 就可以了。

这个有兴趣提个 PR 吗?

发现还有其他例子也用了这个 completeInputsAll 而不是 completeInputsByCapacity, 还是我一并改了比较合适:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants