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

Add mainnet docs + refacto node running docs #255

Merged
merged 9 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/config/link-check.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"pattern": "^http://manpages.ubuntu.com"
},
{
"pattern": "^https://test.massa.net/api/v2"
"pattern": "^https://mainnet.massa.net/api/v2"
},
{
"pattern": "^https://buildnet.massa.net/api/v2"
Expand Down
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ yarn-error.log*
.yarn
.pnp.*

# downlaoded files
# downloaded files
external/client/buildnet/config.toml
external/client/securnet/config.toml
external/client/testnet/config.toml
external/client/mainnet/config.toml
external/node/buildnet/config.toml
external/node/securnet/bootstrap_whitelist.json
external/node/securnet/config.toml
external/node/testnet/bootstrap_whitelist.json
external/node/testnet/config.toml
external/node/mainnet/bootstrap_whitelist.json
external/node/mainnet/config.toml

*.mdx-e

# IDE
.idea
.vscode
145 changes: 129 additions & 16 deletions docs/build/api/jsonrpc.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,25 @@ Summary of the current state: time, last final blocks (hash, thread,
slot, timestamp), clique count, connected nodes count.

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_status",
"params": []
}'
```

</TabItem>

<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -174,10 +189,24 @@ Get information about the block
of the graph.

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_cliques",
"params": []
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -222,10 +251,24 @@ Get information about active
their roll counts for the current cycle.

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_stakers",
"params": [ {"offset": 0, "limit": 2 }]
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -268,10 +311,24 @@ Get information about
(es) (balances, block creation, \...).

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_addresses",
"params": [["AU12gAkmGeozFceJD4tQmbVvihYdX2KyWZcYLL8xdYZeP4EuWYdex"]]
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -361,10 +418,24 @@ Get information about block graph
within the specified time interval.

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_graph_interval",
"params": [{"start": 1678095527706, "end": 1678095529706}]
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -447,10 +518,24 @@ Get information about [block(s)](https://docs.massa.net/docs/learn/architecture/
associated to a given hash(s).

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_blocks",
"params": [["B122ByHzPVJ3QFwmuYcZ4vZYzq6rfkqx7BJSJdFNHWp9j2o5Fpxv"]]
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -551,10 +636,24 @@ Get information about
(s) information associated to a given operation(s) ID(s).

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_operations",
"params": [["O1LMr9xyL9fVSbUvZao4jy6t2Pj5UPtLG8x1fxvS6SD7dPb5S52"]]
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down Expand Up @@ -616,10 +715,24 @@ Get information about
(s) (content, finality \...)

<Tabs>
<TabItem value="json" label="cURL" default>
<TabItem value="json (Mainnet)" label="cURL (Mainnet)" default>

```shell
curl --location --request POST 'https://mainnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"id": 1,
"method": "get_endorsements",
"params": [["E12kB72Jz4iMWkVkckS2e6cUBm4e5XEW77biDjSysAWmQkNrvuJr"]]
}'
```

</TabItem>
<TabItem value="json (Buildnet)" label="cURL (Buildnet)">

```shell
curl --location --request POST 'https://test.massa.net/api/v2' \
curl --location --request POST 'https://buildnet.massa.net/api/v2' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
Expand Down
24 changes: 24 additions & 0 deletions docs/build/api/providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,30 @@ Be aware that the latency you encounter may vary depending on the provider's geo
To enhance redundancy and facilitate load balancing, consider using multiple providers.

<Tabs>
<TabItem value="mainnet" label="🖥 MainNet" default>
<table>
<thead>
<tr>
<th>Provider</th>
<th>Protocol</th>
<th>Endpoint URL</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="/docs/build/networks-faucets/public-networks">Massa Labs</a></td>
<td><code>JsonRPC</code></td>
<td><code>https://mainnet.massa.net/api/v2</code></td>
</tr>
<tr>
<td><a href="/docs/build/networks-faucets/public-networks">Massa Labs</a></td>
<td><code>gRPC</code></td>
<td><code>grpc://mainnet.massa.net:33037</code></td>
</tr>
</tbody>
</table>
</TabItem>

<TabItem value="buildnet" label="👷 BuildNet" default>
<table>
<thead>
Expand Down
30 changes: 10 additions & 20 deletions docs/build/massa-web3/massa-web3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,51 +146,35 @@ You can easily initialize a client instance using the ClientFactory class:

<Tabs>
<TabItem value="mainnet-client" label="Mainnet" default>

```typescript
const baseAccount: IAccount = await WalletClient.getAccountFromSecretKey(
privateKey
);
const chainId = CHAIN_ID.MainNet;

const testnetClient: Client = await ClientFactory.createDefaultClient(
DefaultProviderUrls.MAINNET,
chainId,
true, // retry failed requests
baseAccount // optional parameter
);
```

</TabItem>

<TabItem value="testnet-client" label="Testnet" default>

```typescript
const baseAccount: IAccount = await WalletClient.getAccountFromSecretKey(
privateKey
);

const testnetClient: Client = await ClientFactory.createDefaultClient(
DefaultProviderUrls.TESTNET,
true, // retry failed requests
baseAccount // optional parameter
);
```

</TabItem>

<TabItem value="buildnet-client" label="Buildnet" default>

```typescript
const baseAccount: IAccount = await WalletClient.getAccountFromSecretKey(
privateKey
);
const chainId = CHAIN_ID.BuildNet;

const testnetClient: Client = await ClientFactory.createDefaultClient(
DefaultProviderUrls.BUILDNET,
chainId,
true, // retry failed requests
baseAccount // optional parameter
);
```

</TabItem>

<TabItem value="labnet-client" label="Labnet" default>
Expand All @@ -199,9 +183,11 @@ const testnetClient: Client = await ClientFactory.createDefaultClient(
const baseAccount: IAccount = await WalletClient.getAccountFromSecretKey(
privateKey
);
const chainId = CHAIN_ID.LabNet;

const testnetClient: Client = await ClientFactory.createDefaultClient(
DefaultProviderUrls.LABNET,
chainId,
true, // retry failed requests
baseAccount // optional parameter
);
Expand All @@ -215,9 +201,11 @@ const testnetClient: Client = await ClientFactory.createDefaultClient(
const baseAccount: IAccount = await WalletClient.getAccountFromSecretKey(
privateKey
);
const chainId = CHAIN_ID.Sandbox;

const testnetClient: Client = await ClientFactory.createDefaultClient(
DefaultProviderUrls.LOCALNET,
chainId,
true, // retry failed requests
baseAccount // optional parameter
);
Expand All @@ -232,6 +220,7 @@ You can also create a custom client connecting to a node whose ip and ports are
const baseAccount: IAccount = await WalletClient.getAccountFromSecretKey(
privateKey
);
const chainId = CHAIN_ID.Sandbox;

// initialize a custom client using an own provider
const providers: Array<IProvider> = [
Expand All @@ -247,6 +236,7 @@ const providers: Array<IProvider> = [

const customClient: Client = await ClientFactory.createCustomClient(
providers,
chainId,
true, // retry failed requests
baseAccount // optional parameter
);
Expand Down
7 changes: 6 additions & 1 deletion docs/build/networks-faucets/local-network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ Setup your node to use the secret you just generated as its public key and staki
{}
```

- optionally, if you need a non-standard configuration, you can modify the file `massa-node/base_config/config.toml` depending on what you are trying to do.
- You also have to modify the file `massa-node/base_config/config.toml` to match the same ChainID as a Sandbox node, as it defaults to the Mainnet ChainID of 77658377.
```javascript
{
chain_id = 77
}
```

You can now launch your node:
```bash
Expand Down
Loading
Loading