joinNetwork
joinNetwork
is a method on the ARIO
class that joins a gateway to the ar.io network via its associated wallet.
joinNetwork
requires authentication.
Parameters
Parameter | Type | Description | Optional |
---|---|---|---|
qty | number | Number of tokens, in `mARIO` to stake when joining network. | false |
autoStake | boolean | If true, automatically stakes gateway rewards. | false |
allowDelegatedStaking | boolean | If true, allows third parties to delegate stake to the gateway. | false |
minDelegatedStake | number | Minimum number of tokens, in `mARIO` that can be delegated to the gateway. | false |
delegateRewardShareRatio | number | Percentage of gateway rewards to share with delegates. e.g. 10% | false |
label | string | Friendly name for gateway, min 1 character, max 64 characters. | false |
note | string | A note to be associated with gateway, max 256 characters. | false |
properties | string - ArweaveTxId | ArweaveTxId to properties object containing additional gateway configuration details. | false |
observerWallet | string - WalletAddress | Public wallet address for wallet used to upload network observations. | false |
fqdn | string | Fully qualified domain name, must be valid domain owned by gateway operator. | false |
port | number | Port number to use when accessing gateway, generally 443 (https) | false |
protocol | string - "http" || "https" | Protocol to use when accessing gateway, only "https" is supported for network participation. | false |
tags | array | An array of GQL tag objects to attach to the joinNetwork AO message. | true |
Example
joinNetwork
const fs = require("fs");
const { ARIO, ArweaveSigner, ARIOToken } = require("@ar.io/sdk");
async function main() {
const jwk = JSON.parse(fs.readFileSync("KeyFile.json"));
const ario = ARIO.init({
signer: new ArweaveSigner(jwk),
});
const { id: txId } = await ario.joinNetwork(
{
qty: new ARIOToken(10_000).toMARIO(), // minimum operator stake allowed
autoStake: true, // auto-stake operator rewards to the gateway
allowDelegatedStaking: true, // allows delegated staking
minDelegatedStake: new ARIOToken(100).toMARIO(), // minimum delegated stake allowed
delegateRewardShareRatio: 10, // percentage of rewards to share with delegates (e.g. 10%)
label: 'john smith', // min 1, max 64 characters
note: 'The example gateway', // max 256 characters
properties: 'FH1aVetOoulPGqgYukj0VE0wIhDy90WiQoV3U2PeY44', // Arweave transaction ID containing additional properties of the Gateway
observerWallet: '0VE0wIhDy90WiQoV3U2PeY44FH1aVetOoulPGqgYukj', // wallet address of the observer, must match OBSERVER_WALLET on the observer
fqdn: 'example.com', // fully qualified domain name - note: you must own the domain and set the OBSERVER_WALLET on your gateway to match `observerWallet`
port: 443, // port number
protocol: 'https', // only 'https' is supported
},
// optional additional tags
{ tags: [{ name: 'App-Name', value: 'My-Awesome-App' }] },
);
}
main();