Skip to content

Commit c9dc569

Browse files
committed
Merge branch 'master' of github.com:forta-network/docs
2 parents 894b74c + 4b8707e commit c9dc569

28 files changed

+744
-275
lines changed

.DS_Store

4 KB
Binary file not shown.

docs/.DS_Store

22 KB
Binary file not shown.
389 KB
Binary file not shown.

docs/api-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Forta currently supports GraphQL API access to intelligence emitted by detection bots. Each bot’s documentation will describe the types of intelligence it generates, and will often have details about the detection methodology used. For Premium Feeds in particular, bot documentation should also feature example queries you can use to get up and running quickly. The API endpoint is [https://api.forta.network/graphql](https://api.forta.network/graphql) and an API key is required.
44

5-
Note: Your query must also include the specific bot ID(s) you want intelligence from.
5+
Note: Your query must also include the specific bot ID(s) you want intelligence from. When querying for `alerts` you must specify `bots` when querying for `labels` you must specify `sourceid`.
66

77

88
### **Before you can access the API, you must:**

docs/bot-json-rpc-provider.md

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# V2 Bot JSON-RPC Provider Setup
2+
3+
With v2 detection bots, developers can scan any EVM-compatible chain by bringing their own RPC endpoints. This guide discusses a few options for setting up your bot's RPC provider for local development and production.
4+
5+
## Public RPC URLs
6+
7+
The simplest way to get started is to use a public RPC endpoint for your specific chain. These endpoints are free to use, but typically come with rate limits to prevent misuse. Depending on the rate limits, your bot's performance will vary. Unless you are certain that your bot will stay within the set limits, we don't recommend using public RPC URLs in production. However, you may find these convenient for local development.
8+
9+
## Private RPC URLs
10+
11+
Another common way to communicate with RPC providers is to create a private RPC endpoint which typically contains some sort of secret API key within the URL itself. These are usually offered through a freemium payment model with more generous rate limits. However, hardcoding the RPC URL (and secret API key) within the bot itself is a security issue because the bot Docker images are stored in a public repository which anyone can view. For this reason, private RPC URLs are better suited for local development but not for production.
12+
13+
## JWT-Authenticated RPC URLs
14+
15+
Certain RPC providers have the option to create a JWT-authenticated RPC endpoint that can **_only be accessed by scan nodes that are running your bot_**. Setting up this kind of RPC endpoint is easy and requires registering the Forta public key with the provider. Suggested providers that support this kind of authentication mechanism include (but are not limited to) [Alchemy](https://www.alchemy.com/), [dRPC](https://drpc.org/) and [Infura](https://www.infura.io/). The main benefit of using such a RPC endpoint is that you can hardcode the RPC URL into the bot without giving away public access to anyone who can view the bot's Docker image.
16+
17+
### Registering the Forta public key
18+
19+
For example, to [create a JWT-authenticated RPC URL on Alchemy](https://docs.alchemy.com/docs/how-to-use-jwts-for-api-requests) you would do the following:
20+
21+
1. Go to the [Alchemy JWT Public Keys dashboard](https://dashboard.alchemy.com/settings/jwt-public-keys)
22+
2. Click "Import Public Key"
23+
3. Enter a name for this new key
24+
4. Select the App ID (i.e. RPC endpoint) you want to associate with the public key
25+
5. Copy and paste the Forta public key (as seen below)
26+
6. Click "Create" to register the key
27+
7. Click on the created key's name to expand it and view the key ID e.g. `67694d31-0d90-47a4-8241-0a8546958512a`
28+
8. Use the key ID inside your bot e.g.
29+
30+
=== "Typescript/Javascript"
31+
32+
``` Typescript
33+
scanEthereum({
34+
rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2',
35+
rpcKeyId: '67694d31-0d90-47a4-8241-0a8546958512a',
36+
...
37+
})
38+
```
39+
40+
=== "Python"
41+
42+
``` Python
43+
scan_ethereum({
44+
'rpc_url': 'https://eth-mainnet.g.alchemy.com/v2',
45+
'rpc_key_id': '67694d31-0d90-47a4-8241-0a8546958512a',
46+
...
47+
})
48+
```
49+
50+
### Forta public key
51+
52+
```
53+
-----BEGIN PUBLIC KEY-----
54+
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0hsWiVoSFlrUsYPDRPjJ
55+
n9zghdlcVREmfSZgzdr5u//Y7Cv97waAhSB3xN8qjst5Uy/rD7fFD/6GN6FHMMg+
56+
fu0f/pLPJSby/mu+YBCg1LtsAXlLub8LaY20xUb4cBNHy++SzI1cQOjkqH9/vHO7
57+
V2aS3tc6+OS62Dy6NstB4ITskLmZdA8fJdye2LWS/DS95K37DCfIgFqxktFDovjW
58+
oCbJPTL4A/0Bs7tCEjUb4X7Z5v065W7Ly8W3W0m3oM09Bwr018WE+EzsSthE+E98
59+
nGpOUiStgoaKlDMRY+zrcjOTCHPzLn7C5aUOsyGuRJF+vy37ouq4YZSlbg87FcGw
60+
XuLONya3ZDR0caDMFOtD+fuDmFMSKk52ua+afNTygn5jDAGr+RNWcfGx0OeSbwO0
61+
5zmQ1FkIiqkoScunGFE74hYLcdCFx8CiwZzhKiwx2wRvgXnjzkZVCYZ6RwsyWADw
62+
MqHcc+S/+hYLUg0UNNHVSD+aJDjzneOc/DKL2h7Y3cdjX7tfJPobOaguYF+JdEzj
63+
VjL3a0dfT/2BHyzlpPBwCmSOZQwUqyzJV05rQfoVeqyZJhp6e1hTwTWi4Fff7TH5
64+
/jtZ8cixEzCblehA3dDD5XEvaWDEG+n0Qk6ZeH016c2dkrkLMQoHR+p+p3KL6PoW
65+
0xyzcLXL4r5ALWLwpeqSaasCAwEAAQ==
66+
-----END PUBLIC KEY-----
67+
```
68+
69+
## Forta RPC Cache
70+
71+
When running on scan nodes in **_production_**, v2 detection bots also have access to a RPC cache (courtesy of the Forta Network). The cache provides access to basic blockchain data including blocks, transactions and logs. The cache is _short-lived_ and only stores blockchain data for the **past 5 minutes for certain chains**. Currently the following 8 chains are supported by the cache:
72+
73+
- Ethereum (includes trace data)
74+
- Polygon
75+
- Base
76+
- BSC
77+
- Avalanche
78+
- Arbitrum
79+
- Fantom (includes trace data)
80+
- Optimism
81+
82+
## Local RPC URLs
83+
84+
Note that JWT-authenticated RPC URLs can only work inside of a scan node (i.e. only in production). When developing locally, these URLs will not work as they require a scan node environment. To work around this when developing locally, you can specify a local RPC URL in your bot that will be used **_only when running locally_**. This way you can use public/private RPC URLs locally without exposing them to the world. For example, you would put the public/private URLs inside your `forta.config.json` like so:
85+
86+
```json
87+
{
88+
...
89+
"localRpcUrls": {
90+
"1": "https://cloudflare-eth.com/",
91+
"137": "https://polygon-rpc.com"
92+
}
93+
}
94+
```
95+
96+
and then use them inside your bot like this:
97+
98+
=== "Typescript/Javascript"
99+
100+
``` Typescript
101+
scanEthereum({
102+
localRpcUrl: '1',
103+
rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2', // only used in prod
104+
rpcKeyId: '67694d31-0d90-47a4-8241-0a8546958512a', // only used in prod
105+
...
106+
})
107+
```
108+
109+
=== "Python"
110+
111+
``` Python
112+
scan_polygon({
113+
'local_rpc_url': '137',
114+
'rpc_url': 'https://polygon-mainnet.g.alchemy.com/v2', # only used in prod
115+
'rpc_key_id': '89694d31-0c50-58b4-8241-0e0543959513b', # only used in prod
116+
...
117+
})
118+
```

docs/bridge-guide-1.png

208 KB
Loading

docs/bridge-guide-2.png

124 KB
Loading

docs/bridge-guide-3.png

113 KB
Loading

docs/bridge-guide-4.png

238 KB
Loading

docs/bridging-fort.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,30 @@
22

33
You may need to bridge your FORT tokens from Ethereum to Polygon in order to stake on scan nodes or detection bots. This page will describe how to bridge your FORT tokens.
44

5-
1. Go to [https://wallet.polygon.technology/](https://wallet.polygon.technology/) and click on Polygon Bridge
6-
![Polygon Bridge](bridging-1.png)
7-
2. Log in by connecting your wallet
8-
![Connect wallet](bridging-2.png)
9-
3. Click "Deposit" and then click the dropdown list of tokens
10-
![Deposit](bridging-3.png)
11-
4. You may see the FORT token is not displayed. Click on "Manage token list"
12-
![Manage token list](bridging-4.png)
13-
5. Click on "Tokens", paste the FORT contract address (0x41545f8b9472D758bB669ed8EaEEEcD7a9C4Ec29) and then click "Add FORT"
14-
![Add FORT](bridging-5.png)
15-
6. You will now be able to find FORT in the list of tokens. Click on FORT
16-
![Select FORT](bridging-6.png)
17-
7. Select the amount of FORT you want to bridge and then click "Transfer" to bridge your tokens to Polygon
18-
![Transfer FORT](bridging-7.png)
5+
1. Go to [https://portal.polygon.technology/](https://portal.polygon.technology/) connect your wallet and click on **Bridge** in the left side menu.
6+
7+
![homepage](bridge-guide-1.png)
8+
9+
2. Here is where you will be able to configure your token transfer. Make sure that the **Transfer From** section (indicated as num. 1 in the diagram below) is set to Ethereum. Select the **FORT** token from the bottom right, you may need to search for the token here. Then enter the total number of FORT tokens you wish to bridge over. The **Transfer To** section (indicated as num. 2 in the diagram below) must be set to **Polygon POS**.
10+
11+
![bridge config](bridge-guide-2.png)
12+
![bridge search](bridge-guide-3.png)
13+
14+
**Please Note:**
15+
**DO NOT** bridge your FORT tokens over to Polygon zkEVM.
16+
You must have some ETH in your wallet in order to pay the gas fee.
17+
The correct contract address for the FORT token on Ethereum is 0x41545f8b9472D758bB669ed8EaEEEcD7a9C4Ec29.
18+
The correct contract address for the FORT token on Polygon is 0xd2863157539b1D11F39ce23fC4834B62082F6874.
19+
20+
3. Once you have your configuration complete, click on the large purple button at the the bottom that says **"Bridge FORT to Polygon"**. Confirm the transaction within your wallet UI. Once the transaction is complete you can begin delegating your FORT to the Forta Network.
21+
22+
**Please Note:**
23+
Bridging transactions can take around 30 minutes on average to complete. Do not be alarmed if you don't see your FORT tokens on Polygon immediatley.
24+
25+
![confirm](bridge-guide-4.png)
26+
27+
28+
29+
30+
31+
Navigate web3 with confidence by [adding the Forta Network Metamask Snap to your wallet](https://snaps.metamask.io/snap/npm/forta-network/metamask-snap/). Learn more about how to protect yourself from scams with Forta [here](https://docs.forta.network/en/latest/Forta-for-Metamask/).

0 commit comments

Comments
 (0)