How To Connect To Moonbeam or Moonriver With Magic

How To Connect To Moonbeam or Moonriver With Magic

#Installation - Moonbeam

Via Magic SDK, you can connect to Moonbeam's Moonbase Alpha Testnet. Moonbeam is EVM compatible so you can directly follow the Ethereum installation.

#Configuration

// Mainnet
const customNodeOptions = {
  rpcUrl: 'https://rpc.api.moonbeam.network',
  chainId: 1287
}

// Or connect to Moonbeam's Testnet
const customNodeOptions = {
  rpcUrl: 'https://rpc.testnet.moonbeam.network',
  chainId: 1287
}

// Setting network to Moonbase Alpha Testnet
const magic = new Magic('YOUR_PUBLISHABLE_API_KEY', { network: customNodeOptions });

//Testnet Block Explorer URL: https://moonbase.subscan.io/

#Installation - Moonriver

You can also connect to Moonriver, which is currently live on Kusama, Polkadot's canary network. Moonriver is also EVM compatible so you can directly follow the Ethereum installation.

#Configuration

const customNodeOptions = {
  rpcUrl: 'https://rpc.moonriver.moonbeam.network',
  chainId: 1285
}

// Setting network to Moonriver
const magic = new Magic('YOUR_PUBLISHABLE_API_KEY', { network: customNodeOptions });

//Block Explorer URL: https://moonriver.subscan.io/

Did you find what you were looking for?

How To Connect To Moonbeam or Moonriver With Magic

Did you find what you were looking for?