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. Moonbeam is EVM compatible so you can directly follow the Ethereum installation.

#Configuration

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

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

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

#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.api.moonriver.moonbeam.network',
  chainId: 1285
}

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

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?