Skip to main content
Version: 3.5.0

Remote Nonce Caching

This guide will walk you through successfully installing the API and initialising for Remote Nonce Caching.

The first thing we need to do is ensure that you have npm installed. You'll find instructions on how to do this here. You'll also find instructions on how to install the avn-api library.

Create an account The easiest way to create an account is to create it using a supported wallet. Supported wallets are: PolkadotJS, Subwallet, Nova, Talisman.

We Need AVT
AVT is the utility token of the Aventus network. It's required to do the below:

  1. Access the Blockchain network via the API. You need 1 AVT in your account to use the API. The AVT needs to be lifted (moved) to the Aventus Network, and there are also instructions for that too here.

  2. Transaction Fee: Note, all transactions on the AVN must be paid for using AVT, so going forward it's important for you to have some AVT in your account. There are multiple ways to purchase AVT and this page provides instructions on how to get some.

Once you have some AVT in your account, of which you can check your account balance by typing your address into the explorer here, we can now configure the Remote Nonce Caching.

important

You can get the AVN_GATEWAY_URL for both mainnet and public testnet here.
An example Remote Nonce Cache Provider can be found here. However this is test code, use it at your own risk.

First we install the prerequisites.

const { AvnApi, SetupMode, SigningMode } = require("avn-api");
const AVN_GATEWAY_URL = "replace with AVN_GATEWAY_URL";

Then we initialise the API

const TestNonceCacheProvider =
"import the example nonce cache provider, the link is above"; //require('./testRedisNonceCacheProvider');
const testCacheProvider = new TestNonceCacheProvider();

const options = {
setupMode: SetupMode.MultiUser,
signingMode: SigningMode.RemoteSigner,
hasPayer: false,
defaultLogLevel: "error",
signer,
nonceCacheType: NonceCacheType.Remote,
cacheProvider: testCacheProvider,
};

const avnSdk = new AvnApi(AVN_GATEWAY_URL, options);
async function main() {
// initialise the api sdk and return
await avnSdk.init();
return avnSdk;
}