Skip to main content
Version: 5.0.0

Register Node

Register a light node to participate on the network

await api.send.registerNode(
NODE_ID,
NODE_OWNER_ADDRESS,
NODE_SIGNING_PUBLIC_KEY
);
important

This operation uses a relayer account that the sender authorizes to submit the transfer transaction. You can learn more about relayers HERE.

important

You can get the AVN_GATEWAY_URL and Relayer here.

const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "https://gateway.testnet.aventus.io";

// A function to sign
const signerFunc = {
sign: async (data, signerAddress) => await signData(data, signerAddress),
};

const multiUserOptions = {
setupMode: SetupMode.MultiUser,
signingMode: SigningMode.RemoteSigner,
hasPayer: true,
defaultLogLevel: "error",
signerFunc,
};

const avnSdk = new AvnApi(AVN_GATEWAY_URL, singleUserOptions);

// The address or public key of the node
const NODE_ID = "5DA...gxV";

// The address or public key of the node owner
const NODE_OWNER_ADDRESS = "0x2a...b0e";

// The public key (32 bytes hex value) of the generated signing key
const NODE_SIGNING_PUBLIC_KEY = "0xca04d5bddcd9c5af2e...f3201ba8abc3fbed31f";

// The privileged address that can register nodes
const NODE_REGISTRAR_ADDRESS = "5Dh...GxV";

async function main() {
await avnSdk.init();
const api = await avnSdk.apis(NODE_REGISTRAR_ADDRESS);

let result = await api.send.registerNode(
NODE_ID,
NODE_OWNER_ADDRESS,
NODE_SIGNING_PUBLIC_KEY,
);
// Returns a request id
console.log(result);
}

(async () => {
await main();
})();


You have now successfully submitted a transaction to register a node.

tip

You can query the state of your transaction here using the returned result.