Closed qieman closed 3 months ago
Please print the second CKB transaction to debug
On Sat, Jun 8, 2024 at 18:02 ZOU @.***> wrote:
I ran the example 1-issue-xudt.ts successfully issue the test xudt. But when I try to run 2-transfer-xudt.ts to make a transfer, I get the following error:
ResponseException [Error]: {"code":-32602,"message":"Invalid parameter for
tx
: Invalid Uint64 0x-35458b279: invalid digit found in string"}Here are some code details:
.evn file
True for CKB Mainnet and false for CKB Testnet, the default value is false
IS_MAINNET=false
The CKB secp256k1 private key whose format is 32bytes hex string with 0x prefix
CKB_SECP256K1_PRIVATE_KEY=0xca8eed37a6b98c5afc8bbaf5947305fc1fb764c22318b19f4812898b08d22443
CKB node url which should be matched with IS_MAINNET
CKB_NODE_URL=https://testnet.ckbapp.dev
CKB indexer url which should be matched with IS_MAINNET
CKB_INDEXER_URL=https://testnet.ckbapp.dev/indexer
// transfer function parameters { xudtType: { codeHash: '0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb', hashType: 'type', args: '0x8e65be9cd2d978d7d2a9c18d43644b12c65e0d4f2d0c499947aa0d5e57f2cdc5' }, receivers: [ { toAddress: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqgh2kd7w80g25ravzayjgjt889nd97wesse7pxnk', transferAmount: BigInt(1000) * BigInt(10 ** 8), } ]}
— Reply to this email directly, view it on GitHub https://github.com/ckb-cell/rgbpp-sdk/issues/224, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMNWJE26BET5XF4QPSFH5LZGLJCLAVCNFSM6AAAAABI73NZYWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DCNJYGA4DENA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
However, the transaction of the transfer was not successful. Here is the issue xudt transaction: https://pudge.explorer.nervos.org/address/ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0232dfnklxlr8m274596p3x52cr9hxqhg2wvw3c
These are the parameters of transfer function when I run 2-transfer-xudt.ts
// transfer function parameters in 2-transfer-xudt.ts
{
xudtType: {
codeHash: '0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb',
hashType: 'type',
args: '0x8e65be9cd2d978d7d2a9c18d43644b12c65e0d4f2d0c499947aa0d5e57f2cdc5'
},
receivers: [
{
toAddress: 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqgh2kd7w80g25ravzayjgjt889nd97wesse7pxnk',
transferAmount: BigInt(1000) * BigInt(10 ** 8),
}
]
}
Please add console.log(JSON.stringify(unsignedTx))
in
https://github.com/ckb-cell/rgbpp-sdk/blob/develop/examples/xudt-on-ckb/2-transfer-xudt.ts#L117
and give the log to us.
On Sat, Jun 8, 2024 at 6:44 PM ZOU @.***> wrote:
However, the transaction of the transfer was not successful. Here is the issue xudt transaction: https://pudge.explorer.nervos.org/address/ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq0232dfnklxlr8m274596p3x52cr9hxqhg2wvw3c
— Reply to this email directly, view it on GitHub https://github.com/ckb-cell/rgbpp-sdk/issues/224#issuecomment-2155984422, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABMNWJBLQ7VFFB2ZEDZDPPTZGLN7DAVCNFSM6AAAAABI73NZYWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVHE4DINBSGI . You are receiving this because you commented.Message ID: @.***>
The capacity of the last outputs is a negative number.
{"version":"0x0","cellDeps":[{"outPoint":{"txHash":"0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37","index":"0x0"},"depType":"depGroup"},{"outPoint":{"index":"0x0","txHash":"0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f"},"depType":"code"}],"headerDeps":[],"inputs":[{"previousOutput":{"txHash":"0x19d7aeab62bf78ac68553da204962096c7d9214a18804517c0f9089926cc63dd","index":"0x0"},"since":"0x0"}],"outputs":[{"lock":{"codeHash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hashType":"type","args":"0x17559be71de85507d60ba49224b39cb3697cecc2"},"type":{"codeHash":"0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb","hashType":"type","args":"0x8e65be9cd2d978d7d2a9c18d43644b12c65e0d4f2d0c499947aa0d5e57f2cdc5"},"capacity":"0x35458af00"},{"lock":{"codeHash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hashType":"type","args":"0xea8a9a99dbe6f8cfb57ab42e83135158196e605d"},"type":{"codeHash":"0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb","hashType":"type","args":"0x8e65be9cd2d978d7d2a9c18d43644b12c65e0d4f2d0c499947aa0d5e57f2cdc5"},"capacity":"0x35458af00"},{"lock":{"codeHash":"0x9bd7e06f3ecf4be0f2fcd2188b23f1b9fcc88e5d4b65a8637b17723bbda3cce8","hashType":"type","args":"0xea8a9a99dbe6f8cfb57ab42e83135158196e605d"},"capacity":"0x-35458af00"}],"outputsData":["0x00e87648170000000000000000000000","0x00589011d97507000000000000000000","0x"],"witnesses":[{"lock":"","inputType":"","outputType":""}]}
There is a bug in the xUDT transfer example code and I have created a pull request #225 to fix it.
Please switch the branch fix/transfer-xudt-capacity-error
and have a try again.
Thanks for your feedback.
I tried running it and it worked fine on the testnet and got a new error on the mainnet:
ResponseException [Error]: {"code":-302,"message":"TransactionFailedToVerify: Verification failed Transaction(InsufficientCellCapacity(Outputs[0]): expected occupied capaci
ty (0x35a4e9000) <= capacity (0x35458af00))" ...
unsigned tx:
{
version: '0x0',
cellDeps: [
{ outPoint: [Object], depType: 'depGroup' },
{ outPoint: [Object], depType: 'code' }
],
headerDeps: [],
inputs: [
{ previousOutput: [Object], since: '0x0' },
{ previousOutput: [Object], since: '0x0' }
],
outputs: [
{ lock: [Object], type: [Object], capacity: '0x35458af00' },
{ lock: [Object], capacity: '0xd805304d31' }
],
outputsData: [ '0x00e87648170000000000000000000000', '0x' ],
witnesses: [ { lock: '', inputType: '', outputType: '' }, '0x' ]
}
I know where the problem is and I have updated the code of the fix/transfer-xudt-capacity-error
branch.
Please pull the latest code and try again.
I see the problem, the receiver and sender use different locks resulting in different outputs capacities
I see the problem, the receiver and sender use different locks resulting in different outputs capacities
Yes. I calculated the capacity for each output instead of a fixed value and you can have a try.
I ran the example
1-issue-xudt.ts
successfully issue the test xudt. But when I try to run2-transfer-xudt.ts
to make a transfer, I get the following error:Here are some code details: