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

GraphQL query not returning proper values based on tags after being posted then mined with Bundlr + Arweave #35

Closed
dabit3 opened this issue Apr 3, 2022 · 16 comments

Comments

@dabit3
Copy link

dabit3 commented Apr 3, 2022

Hi, so I've been trying out the bundlr JS client, specifically the WebBundlr client, and I'm experiencing issues having the data mined to the network.

I've also noticed that there are a couple of different ways you all have referenced sending a transaction. For example, in the demo application you use this syntax:

await bundler?.uploader.upload(img, [{ name: "Content-Type", value: "image/png" }])

But in the documentation I see this:

const transaction = bundlr.createTransaction(data, { tags });

await transaction.sign();
await transaction.upload();

As for me, I've tried both, and am not sure if there is also maybe something I'm doing wrong in my code. Here's a look at essentially what I'm doing:

async function connect() {
    await window.ethereum.request({ method: 'eth_requestAccounts' })
    const provider = new providers.Web3Provider(window.ethereum);
    await provider._ready()
  
    const bundlr = new WebBundlr("https://node1.bundlr.network", "matic", provider)
    await bundlr.ready()
  
    setBundlrInstance(bundlr)
  }

/* create a transaction (plain text, JSON, file, image, video, etc..) */
async function createTransaction() {
  const data = "hello world"
  const tags = [
    { name: 'App-Name', value: 'PublicSquare' },
    { name: 'Content-Type', value: 'text/plain' },
    { name: 'Version', value: '1.0.1' },
    { name: 'Type', value: 'post' }
  ]

  const transaction = bundlrInstance.createTransaction(data, { tags })

  await transaction.sign()
  await transaction.upload()

  console.log('transaction id: ', transaction.id)
}

The data seems to be saving to the network, but after a while it is dropped.

I have had one or two transactions mined, but I've been doing so much experimentation I'm not sure why those worked but my others did not.

Is there anything that I should know that might help me understand better how this works?

Thanks for your time.

@joshbenaron
Copy link
Contributor

Hey @dabit3! Would you be able to provide some tx IDs that we can check please? There are lots of components which could be amiss here (outside of Bundlr). Including the gateway etc.

@dabit3
Copy link
Author

dabit3 commented Apr 4, 2022

Hey, sure. Here is some recent transaction information:

id: U3z0fpSWYREVNyv_0I2yjRtd4rzuMV9BnX3tYqoAOaQ
block: 906695

id: mEiGk7VPZ89g8OCHRodfntvBum3CUOKn2bXxCBjutjA
block: 906699

For some context - the goal is to rebuild the example application that is set up in the Arweave documentation, the Twitter app built on Arweave. https://arwiki.wiki/#/en/creating-a-dapp-02

Submitting the transaction seems to work, when I query it shows up, but after a while (around an hour) it drops.

@joshbenaron
Copy link
Contributor

Hey,

The data appears to be available (i.e. not dropped).
e.g.
https://arweave.net/mEiGk7VPZ89g8OCHRodfntvBum3CUOKn2bXxCBjutjA
https://arweave.net/U3z0fpSWYREVNyv_0I2yjRtd4rzuMV9BnX3tYqoAOaQ

How are you testing whether a transaction exists or not?

@dabit3
Copy link
Author

dabit3 commented Apr 4, 2022

Ok interesting. Here's more details:

First, I create a transaction. Then when I run the query, the data is returned fine and the block height is initially set to -1.

Screen Shot 2022-04-04 at 6 37 22 PM

After some time, the query no longer returns the result in the selection set.

Here is the query I'm running:

{
  query: `{
    transactions(first: 50,
      tags: [
        {
          name: "App-Name",
          values: ["PublicSquare"]
        },
        {
          name: "Content-Type",
          values: ["text/plain"]
        }
      ]
    ) {
      edges {
        node {
          id
          owner {
            address
          }
          data {
            size
          }
          block {
            height
            timestamp
          }
          tags {
            name,
            value
          }
        }
      }
    }
  }`
}

Here are a couple of new transaction IDs:

0MtwwGCAGZUZa3ZLpNRikaBbQPT1eXguqhDY_Szh-N4
3DBDf-L5ilOt4Hy-NjjkVOQxfjPtXkaWKF-8SCvfxB4

@joshbenaron
Copy link
Contributor

Ah - GraphQL. We've seen some issues here recently. So Bundlr is separate from arweave.net - in the sense that it's nor our codebase, nor our infrastructure so it's out of our control. I've flagged an issue with the team that maintains arweave.net

@dabit3
Copy link
Author

dabit3 commented Apr 4, 2022

Ah ok interesting, I'll also flag this with them.

@joshbenaron
Copy link
Contributor

Just for further clarity. Bundlr txs have a -1 height until they hit L1. But sometimes the gateway can miss Bundlr txs and think that it never hit Arweave (when it does)

@joshbenaron
Copy link
Contributor

I'd actually be able to tell you the specific tx ids of the bundles those Bundlr txs were included in and which miners on the network are storing them

@dabit3
Copy link
Author

dabit3 commented Apr 5, 2022

Ah ok interesting... I may try a new set of tags and queries just out of curiosity to see if that changes things for any reason at all. If there's anything else I can add or help with in terms of troubleshooting please let me know.

I am creating some educational material / resources around this tech stack and think that this combination is going to be important for me to use so I'd love to understand how to make it all work properly together.

@joshbenaron
Copy link
Contributor

You may want to try again now. I've just lowered bundle size so the gateway should be able to more easily find Bundlr txs

@dabit3
Copy link
Author

dabit3 commented Apr 5, 2022

Ok cool thank you, giving it another shot and will report back by tomorrow, thanks for all of your help thus far!

@dabit3
Copy link
Author

dabit3 commented Apr 5, 2022

Hey @joshbenaron update: yes, this is working for me now! Thank you for your help.

Question: is this something that I should consider when creating educational content around using the GraphQL interface for Arweave going forward or is this more of a uncommon scenario that will not affect most users?

@dabit3
Copy link
Author

dabit3 commented Apr 7, 2022

Not 100% certain just yet, but I feel like I may be running into this issue again on another combination of query / tags. Any ideas if something changed since the last time you updated the gateway?

@dabit3 dabit3 changed the title Transactions not being mined / being dropped (unsure if syntax is correct) GraphQL query not returning proper values based on tags after being posted then mined with Bundlr + Arweave Apr 7, 2022
@dumbfounder
Copy link

We are also having this issue testing bundlr with the following tx's:
AV3Q6gMkO4BlZE2dze0Ai5HF3wPmRnsTU5wQlmvlhgM
mv57cCG5ZvUzcCA169olWh1x5IdE024EiARntvQblAo
9sljLRwddnQ0WxPOeZ9gNRhbX2XU3clE3KRR_-KkUvE
E9Js_5P-Gj3Y_P5ZKZCCv7JJIGWgjRpKBMg9f_tsnMI
2qrnGycd7k6ckapI-RMBVPHRpgYBcENRuaFchNMxMzg
They showed up for a while in arweave.net/graphql (optimistically cached) but then disappeared. We can download the files though ok. Not available in viewblock either (but also not sure if viewblock supports bundled tx's).

We are seeing this happen for every tx we have tried.

@dabit3
Copy link
Author

dabit3 commented May 12, 2022

bump

@dabit3
Copy link
Author

dabit3 commented May 24, 2022

Seems like this is working now for me so will close the issue

@dabit3 dabit3 closed this as completed May 24, 2022
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

3 participants