429个有关solana/metaplex的问题

发布于 2025-01-24 06:38:15 字数 1419 浏览 3 评论 0原文

我认为Solana/Metaplex等应该能够快速处理大量交易。我刚刚写了一项负载测试,以进行50个现有的SPL令牌(与之关联的Metaplex令牌数据)进行50件薄荷,

我没有指定任何特定的节点/RPC-而不是群集IE TestNet,

我应该在这里做什么?

{"name":"Error","message":"failed to get info about account 2fvtsp6U6iDVhJvox5kRpUS6jFAStk847zATX3cpsVD8: Error: 429 Too Many Requests:  {\"jsonrpc\":\"2.0\",\"error\":{\"code\": 429, \"message\":\"Too many requests from your IP, contact your app developer or [email protected].\"}, \"id\": \"76627a31-4522-4ebb-ae22-5861fa6781f0\" } \r\n","stack":"Error: failed to get info about account 2fvtsp6U6iDVhJvox5kRpUS6jFAStk847zATX3cpsVD8: Error: 429 Too Many Requests:  {\"jsonrpc\":\"2.0\",\"error\":{\"code\": 429, \"message\":\"Too many requests from your IP, contact your app developer or [email protected].\"}, \"id\": \"76627a31-4522-4ebb-ae22-5861fa6781f0\" } \r\n\n    at Connection.getAccountInfo (/Users/ffff/dev/walsingh/TOKENPASS/tpass-graphql/graphql/node_modules/@metaplex/js/node_modules/@solana/web3.js/lib/index.cjs.js:5508:13)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Token.getAccountInfo (

I thought Solana/Metaplex etc should be able to handle large numbers of transactions in quick succession. I just wrote a load test to do 50 mints of an existing SPL token (that has metaplex token-data associated with it)

In my code I dont specify any particular node/rpc - rather just the cluster i.e. testnet

What should I be doing here ?

{"name":"Error","message":"failed to get info about account 2fvtsp6U6iDVhJvox5kRpUS6jFAStk847zATX3cpsVD8: Error: 429 Too Many Requests:  {\"jsonrpc\":\"2.0\",\"error\":{\"code\": 429, \"message\":\"Too many requests from your IP, contact your app developer or [email protected].\"}, \"id\": \"76627a31-4522-4ebb-ae22-5861fa6781f0\" } \r\n","stack":"Error: failed to get info about account 2fvtsp6U6iDVhJvox5kRpUS6jFAStk847zATX3cpsVD8: Error: 429 Too Many Requests:  {\"jsonrpc\":\"2.0\",\"error\":{\"code\": 429, \"message\":\"Too many requests from your IP, contact your app developer or [email protected].\"}, \"id\": \"76627a31-4522-4ebb-ae22-5861fa6781f0\" } \r\n\n    at Connection.getAccountInfo (/Users/ffff/dev/walsingh/TOKENPASS/tpass-graphql/graphql/node_modules/@metaplex/js/node_modules/@solana/web3.js/lib/index.cjs.js:5508:13)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async Token.getAccountInfo (

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

笑看君怀她人 2025-01-31 06:38:15

您遇到的429号问题是RPC速率限制。 TestNet在撰写本文时具有以下速率限制:

  • 每10秒的最大请求数:
  • 单个RPC每10秒的最大请求每10秒的最大请求数:
  • 每IP的40最大并发连接:40最大
  • 连接率每10个最大连接率每IP秒:
  • 每30秒的最大数据量最大:100 MB

您可能会遇到这些限制之一。一般建议是要访问无率限制的RPC之一,因为公共端点并不是要测试您可以通过多少交易。

QuickNode,Triton和Genesysgo提供了用于使用的RPC。

The 429 issue you are running into is a RPC rate limit. Testnet has the following rate limits at the time of writing:

  • Maximum number of requests per 10 seconds per IP: 100
  • Maximum number of requests per 10 seconds per IP for a single RPC: 40
  • Maximum concurrent connections per IP: 40
  • Maximum connection rate per 10 seconds per IP: 40
  • Maximum amount of data per 30 second: 100 MB

You probably ran into one of these limits. The general recommendation is to go get access to one of the RPCs without rate limits, as the public endpoints are not meant for testing how many transactions you can get through.

Quicknode, Triton, and Genesysgo provide RPC infra to use.

囚我心虐我身 2025-01-31 06:38:15

公共 rpc 的rps是5。
超过RPS时,您会得到429错误
您可以在@solana/web3.js中自定义连接

例如

export const fetchWithTimeout = async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
  const maxRetries = 300; // Number of retry attempts

  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    try {
      await sleep(200);
      let res = await Promise.race([
        fetch(input, init), // This fetch call returns a Promise<Response>
        // Timeout Promise that rejects after 5 seconds
        new Promise<Response>((_, reject) => setTimeout(() => reject(new Error('Request Timeout')), 5000)),
      ]);
      if (res.status === 429 /* Too many requests */) {
        throw Error();
      }
      return res;
    } catch (error) {
      if (attempt === maxRetries) {
        // If it's the last attempt, reject the promise
        break;
      }
      // Wait for a brief moment before retrying (optional)
      await new Promise((resolve) => setTimeout(resolve, 1000)); // Optionally wait for 1 second before retrying
    }
  }

  // If we exit the loop without returning, throw an error (this should not happen)
  throw new Error('Request Timeout');
};
const connection: Connection = new Connection(RPC_ENDPOINT, {
  fetch: fetchWithTimeout,
  commitment: 'confirmed',
});

如果对您有帮助,请给我投票。

The rps of public rpc is 5.
When you exceed the rps, you get 429 errors.
you can just customize Connection in @solana/web3.js.

for example

export const fetchWithTimeout = async (input: RequestInfo | URL, init?: RequestInit): Promise<Response> => {
  const maxRetries = 300; // Number of retry attempts

  for (let attempt = 1; attempt <= maxRetries; attempt++) {
    try {
      await sleep(200);
      let res = await Promise.race([
        fetch(input, init), // This fetch call returns a Promise<Response>
        // Timeout Promise that rejects after 5 seconds
        new Promise<Response>((_, reject) => setTimeout(() => reject(new Error('Request Timeout')), 5000)),
      ]);
      if (res.status === 429 /* Too many requests */) {
        throw Error();
      }
      return res;
    } catch (error) {
      if (attempt === maxRetries) {
        // If it's the last attempt, reject the promise
        break;
      }
      // Wait for a brief moment before retrying (optional)
      await new Promise((resolve) => setTimeout(resolve, 1000)); // Optionally wait for 1 second before retrying
    }
  }

  // If we exit the loop without returning, throw an error (this should not happen)
  throw new Error('Request Timeout');
};
const connection: Connection = new Connection(RPC_ENDPOINT, {
  fetch: fetchWithTimeout,
  commitment: 'confirmed',
});

If it is helpful for you, Please vote me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文