Skip to content

Commit

Permalink
update code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
joaniefromtheblock committed Jul 18, 2024
1 parent a4659f5 commit b0d3f22
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 31 deletions.
32 changes: 20 additions & 12 deletions services/concepts/archive-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,38 @@ sidebar_position: 2

Archive data is data on the blockchain that is older than 128 blocks.

Infura provides free access to archive data on Ethereum and most networks. Infura provides access to [full nodes](#full-nodes)
and [archive nodes](#archive-nodes).
Infura provides free access to archive data on Ethereum and most networks.

:::success
## Infura-supported archive data

Archive data is automatically enabled and no further action is required by the user.
Access to archive data is automatically enabled on the following supported networks:

:::
|Mainnet |Testnet|
|--------|-------|
|Ethereum|Sepolia|
|Optimism|Sepolia|
|Polygon |Amoy |
|Arbitrum| |
|Celo | |

Infura provides access to [full nodes](#full-nodes)
and [archive nodes](#archive-nodes).

### Full nodes
## Full nodes

Full nodes maintain the current state of the blockchain and are responsible for providing data on request and executing smart contract transactions.

Full nodes store enough data to recalculate the chain in the event of a chain reorg. Beyond that, full nodes prune their data; only storing the data required for verifying transactions older than 128 blocks.

Pruning conserves disk space and helps with node sync time, thus reducing storage and computation costs. However, a pruned node cannot serve API requests for certain RPC methods older than 128 blocks.

### Archive nodes
## Archive nodes

Data older than 128 blocks are stored on archive nodes on the blockchain. These are full nodes running in archive mode.

Only an archive node can serve API requests for certain RPC methods older than 128 blocks. The Ethereum JSON-RPC and Websocket APIs include several methods which require access to an archive node.

### Methods requiring archive data
## Methods requiring archive data

Requests for data older than the most recent 128 blocks require access to archive data.

Expand All @@ -42,7 +50,7 @@ The following methods include a parameter for specifying a block number for the
- `eth_getStorageAt`
- `eth_call`

### Rate limits
## Rate limits

Infura applies [rate limits](../how-to/avoid-rate-limiting.md) to ensure network efficiency.

Expand All @@ -57,7 +65,7 @@ Rate limits kick in on archive requests after 25,000 per day. 75,000 standard re

:::info

If you need more archive requests, upgrade to the developer plan.
If you need more archive requests, upgrade to the Developer plan.

:::

Expand All @@ -74,6 +82,6 @@ If you need more archive requests, upgrade to the growth plan.

:::

#### Custom, team, and growth plans
### Custom, team, and growth plans

No change. Same as a standard request.
There is no change. The process remains the same as a standard request.
5 changes: 3 additions & 2 deletions services/get-started/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ service and does not currently support WebSockets.
## IPFS

:::caution Limited access
Infura is currently limiting IPFS services to customers that already have an active IPFS key.
New IPFS key creation is disabled for new and existing customers.

Infura restricts its IPFS service to a select set of qualified customers. Please [contact the Infura support team](https://support.infura.io/ipfs) for next steps. New IPFS key creation is disabled for all users, but existing IPFS customers can continue to use the IPFS service with their existing keys.

:::

| Network | Description | URL |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,7 @@ import TabItem from '@theme/TabItem';
}
]
}
```
```

</TabItem>
</Tabs>
29 changes: 13 additions & 16 deletions src/components/CodeTerminal/TerminalViewBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,28 @@ const TerminalViewBox = ({
response,
isExpansionNetwork = false,
}) => {

const exampleRequest = useMemo(() => {
const prepareParams =
params.length === 0
? ""
: params.map((param) => {
if ("boolean" === typeof param) return `${param}`;
return `"${param}"`;
});
const prepareParams = params.length === 0 ? "" : params.map(param => {
if ('boolean' === typeof param) return `${param}`
return `"${param}"`
});
if (isExpansionNetwork) {
return `curl -X 'GET' \\\n'https://${url}'`;
}
return `curl https://${url}/v3/${id} \\\n -X POST \\\n -H "Content-Type: application/json" \\\n -d '{\n "jsonrpc": "2.0",\n "method": "${method}",\n "params": [${params.length === 0 ? "" : prepareParams}],\n "id": 1\n }'`;
return `curl https://${url}/v3/${id} \\\n -X POST \\\n -H "Content-Type: application/json" \\\n -d '{\n "jsonrpc": "2.0",\n "method": "${method}",\n "params": [${params.length === 0 ? "" : prepareParams}],\n "id": 1\n }'`
}, [url, id, method, params, isExpansionNetwork]);

return (
<div className="terminal-wrapper">
<CodeBlock language="cURL">{exampleRequest}</CodeBlock>
<CodeBlock language="cURL">
{exampleRequest}
</CodeBlock>
{!hideFooter && (
<div style={{ marginTop: "-20px" }}>
<div style={{marginTop: "-20px"}}>
{logged && (
<div className="code-terminal-footer">
{response && (
<pre style={{ backgroundColor: "#292A35" }}>{response}</pre>
)}
{response && <pre style={{backgroundColor: "#292A35"}}>{response}</pre>}
</div>
)}
<div className="code-terminal-footer bg-light-gray">
Expand All @@ -57,8 +55,7 @@ const TerminalViewBox = ({
<Link
target="_blank"
to={`${API_URL}/register`}
rel="noreferrer"
>
rel="noreferrer">
create an account
</Link>{" "}
and reload the page to edit real requests
Expand All @@ -71,4 +68,4 @@ const TerminalViewBox = ({
);
};

export default TerminalViewBox;
export default TerminalViewBox;

0 comments on commit b0d3f22

Please sign in to comment.