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

[CKB] Transaction too large for GET via URL #44

Open
WhiteR4bbitt opened this issue Dec 3, 2024 · 7 comments
Open

[CKB] Transaction too large for GET via URL #44

WhiteR4bbitt opened this issue Dec 3, 2024 · 7 comments

Comments

@WhiteR4bbitt
Copy link

When generating a CKB transaction with lots of data, it fails to load in the JoyID pop-up (and pasting the URI manually in a new window fails to load)

image

In a few test transactions I used CKBFS (which creates a lot of Witnesses to store data)

I was able to find the limit for CKBFS, but that shouldn't matter so much as the JoyID Pop-up can't handle the amount of data being passed.
This is a limitation of browsers and the character length, so any future Transactions have the potential to run into this issue.
image

This can be replicated by attempting to mint a file on the imagiNation platform when choosing the CKBFS storage type --> https://imagination.to/create

These were the 2 files I used to figure out the current limit:
sample-text-not-working.txt
sample-text-working.txt

Test 2

Thinking about future transactions I ran a test using the Spore SDK. Using the createMultipleSpores method I mocked a batch mint of 500 and get the same issue as well.

@Flouse
Copy link

Flouse commented Dec 9, 2024

link code-monad/ckbfs#1 (comment)

@WhiteR4bbitt
Copy link
Author

WhiteR4bbitt commented Dec 11, 2024

link code-monad/ckbfs#1 (comment)

This can resolve the issue with CKBFS.

Future CKB Transactions could be large without the ability to split TXs regardless.

What was previously discussed as per code-monad/ckbfs#1 (comment)? Was using POST disregarded for any reason, maybe a combo adding query params for part of the data for validity? (This could also open up the option to embed JoyID and send the TX directly instead of a prompt window)

Anyways curious on previous discussions as to not waste time blabbing about possibilities.

--
At the end of the day this is a long term issue that should be solved, the above reply is just a "band-aid" for using CKBFS with files > 254kb, so a 500 kb file is 2 TXs, which again in this scenario is fine, but also inconvenient when thinking of long term UX.

@yuche
Copy link
Collaborator

yuche commented Dec 12, 2024

@WhiteR4bbitt

We are implementing new functionality that will allow developers to convert a CKB Raw Transaction into a challenge and then call signChallnege to sign it. This allows large transaction to end up with a short hash string, but at the costs of the user not knowing what they're signing. You might consider using these new APIs.

@yuche
Copy link
Collaborator

yuche commented Dec 18, 2024

@WhiteR4bbitt

@joyid/[email protected] just released. You can sign transaction hash using following code:

const challenge = await calculateChallenge(rawTx, witnessIndexes)
const signedData = await signChallenge(challenge, address)
const signedTx = buildSignedTx(rawTx, signedData, witnessIndexes)

@WhiteR4bbitt
Copy link
Author

@WhiteR4bbitt

@joyid/[email protected] just released. You can sign transaction hash using following code:

const challenge = await calculateChallenge(rawTx, witnessIndexes)
const signedData = await signChallenge(challenge, address)
const signedTx = buildSignedTx(rawTx, signedData, witnessIndexes)

Hey @yuche

I tried the above and when sending the TX I get error code 7 or 8 (regardless of me changing any code for Witnesses, it jumps between the 2)
I did try with and without WitnessIndexes and am wondering if there is an "empty witness" that should be used for JoyID or if this is an issue with there being 9-18 Witnesses in my test TXs. (I tried 2 files, 255kb and 500kb)

Basically Witness[0] has the empty default from building the TX before hand 0x1400000010000000140000001400000000000000

I also passed in the witnessIndex for the signChallenge config alongside the other 2 methods as in the past it has fixed weird issues when signing with JoyID (to explicitly set the WitnessIndex even if it's 0)

Here is my signed TX if it helps decode the problem.

{
  "version": "0x0",
  "cellDeps": [
    {
      "outPoint": {
        "txHash": "0x4dcf3f3b09efac8995d6cbee87c5345e812d310094651e0c3d9a730f32dc9263",
        "index": "0x0"
      },
      "depType": "depGroup"
    },
    {
      "outPoint": {
        "txHash": "0x469af0d961dcaaedd872968a9388b546717a6ccfa47b3165b3f9c981e9d66aaa",
        "index": "0x0"
      },
      "depType": "depGroup"
    }
  ],
  "headerDeps": [],
  "inputs": [
    {
      "since": "0x0",
      "previousOutput": {
        "txHash": "0x04929642f6194a2d7386b645566834cf834b9ef1f013d6e4c7b96a9a8d3d92e2",
        "index": "0x1"
      }
    }
  ],
  "outputs": [
    {
      "capacity": "0xb2b171d7aab",
      "lock": {
        "codeHash": "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac",
        "hashType": "type",
        "args": "0x00017df958616a8a44200a3468ce308fbd3e6832a6ed"
      }
    },
    {
      "capacity": "0x5b4505500",
      "lock": {
        "codeHash": "0xd23761b364210735c19c60561d213fb3beae2fd6172743719eff6920e020baac",
        "hashType": "type",
        "args": "0x00017df958616a8a44200a3468ce308fbd3e6832a6ed"
      },
      "type": {
        "codeHash": "0x31e6376287d223b8c0410d562fb422f04d1d617b2947596a14c3d2efb7218d3a",
        "hashType": "data1",
        "args": "0xb75be7f97626c3005a13b6028c6c9fbd42784ab4c6d66a7f22ecb718d24c8319"
      }
    }
  ],
  "outputsData": [
    "0x",
    "0x750000001800000040000000440000005200000071000000090000000100000002000000030000000400000005000000060000000700000008000000090000008a16cf4a0a000000746578742f706c61696e1b00000073616d706c652d746578742d6e6f742d776f726b696e672e74787404000000"
  ],
  "witnesses": [
    "0x08010000100000000801000008010000f4000000012b7a83ffc2b9d709323050779c94037ae31f6329a84107b48a35f62537aab2ba0ac855e433a00a0dc723a704a6c26fdd3126c35d28ff2cb5f8d4470e3b3d6e97000000000f0000cb001f00020d0d000f00000000000100000a0a00009800000d00000b008f000000010c0000000a0000004f0a00000000030a000e0000000000000e04ff00aaac0f000d000000000d00f10d00000ddc0000000000000500000009000d000000000a0000010e00000000050000000000000e01000b000000da0a05000f00000000ae05000000e1000d0a0400000b000000005b0000b300000000000a000c00009000000b0000000e0000000d00",
    "0x434b4246530030313031303130313031303130303130313031303031303130313030313031303130...Repeated",
    "8 more witnesses identical to the repeating one above"
  ]
}

@Neonckb
Copy link

Neonckb commented Jan 14, 2025

Just bumping this @yuche

@duanyytop
Copy link
Member

duanyytop commented Jan 15, 2025

Could you give us a file that includes the unsigned CKB raw transaction, signed CKB transaction, JavaScript code, and all the contract error code information? @WhiteR4bbitt

The file will be helpful for us. Thanks a lot

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

5 participants