Irys-xyz / js-sdk

5 stars 6 forks source link

Two tx id pointing to the same receipt #18

Open gbogarinb opened 4 weeks ago

gbogarinb commented 4 weeks ago

Hi, I'm having a weird issue where two tx ids are poiting to the same receipt, some context: I made a tool to upload files, the tx of the upload is stored beforehand since it can be deduced based on the tags and anchor, Basically this

  const tx = irys.createTransaction(file, { anchor, tags });
  await tx.sign();
  console.log(`Transaction: ${tx.id}`);

Now for some reason, the second time I did this, the tx for the same file changed, it still fails when I try to upload with const receipt = await irys.uploadFile(path.join(dirPath, file.filename), { tags: tags, anchor: paddedAnchor }); But the transaction that it fails with is not the same that it generated beforehand. These are the transactions tx1 6MM7sei8s8g9PfjzShxdKrN9H6dxKRHW41qH87bXStF4 tx2 T4DMg1hT7mSldtqCRKi1PN1Lvvpdw08FRFsfR3nrPWM <-- this is the unexpected one.

Still, when I tried to see the receipt for the second transaction, it pointed to the first, so not sure what's going on.

https://devnet.irys.xyz/tx/T4DMg1hT7mSldtqCRKi1PN1Lvvpdw08FRFsfR3nrPWM <-- I have no record of ever sending this transaction. https://devnet.irys.xyz/tx/6MM7sei8s8g9PfjzShxdKrN9H6dxKRHW41qH87bXStF4 <-- I do see this one in my logs.

This is the error I receive when trying to upload the file that the tool thinks should have the tx2. Error: Transaction 6MM7sei8s8g9PfjzShxdKrN9H6dxKRHW41qH87bXStF4 already received

Now if I'm deducing the transaction wrong, I still don't know why that transaction would point to tx1 in the first place.

Edit: So I found that a bunch of other files that I uploaded previously now changed the tx id as well, but somehow this new tx still resolves to the original receipt, is this normal?

Edit 2: My dependencies.

"dependencies": {
    "@irys/query": "^0.0.9",
    "@irys/sdk": "^0.2.10",
    "@metaplex-foundation/mpl-token-metadata": "^3.2.1",
    "@metaplex-foundation/umi": "^0.9.2",
    "@solana/web3.js": "^1.95.2",
    "arweave": "^1.10.0",
  }

Edit 3: I found that the first time I did the upload, the two transactions were already different, and this happens with one wallet, but with another wallet it gives the same transaction always.

gbogarinb commented 2 weeks ago

Ok I think the devnet is making some changes and now is returning the txid as a base58 string, I think that solves the mistery, but I'll leave this open if some dev wants to add some info.