Constellation Network
IntroductionFundamentalsFor DevelopersNode Validators
  • Index
  • Guide
    • Introduction
    • Provider Activation
    • Sending RPC Requests
    • Signing Data
    • Supported Connectors
    • Using External Libraries
  • API Reference
    • Overview
    • Wallet provider API
      • Overview
      • errorTypes
      • version
      • getProvider()
  • Chain Provider API
    • Overview
    • activated
    • chain
    • version
    • on()
    • removeListener()
    • async activate()
    • async onAsync()
    • async removeListenerAsync()
    • async request()
  • Constellation RPC API
    • Overview
    • dag_accounts
    • dag_chainId
    • dag_getBalance
    • dag_getMetagraphBalance
    • dag_getMetagraphPendingTransaction
    • dag_getMetagraphTransaction
    • dag_getPendingTransaction
    • dag_getPublicKey
    • dag_getTransaction
    • dag_requestAccounts
    • dag_sendMetagraphTransaction
    • dag_sendMetagraphDataTransaction
    • dag_signMetagraphDataTransaction
    • dag_sendTransaction
    • dag_signData
    • dag_signMessage
    • wallet_watchAsset
    • dag_delegatedStake
    • dag_withdrawDelegatedStake
    • dag_allowSpend
    • dag_tokenLock
  • Ethereum RPC API
    • Overview
    • eth_accounts
    • eth_blockNumber
    • eth_call
    • eth_chainId
    • eth_estimateGas
    • eth_gasPrice
    • eth_getBalance
    • eth_getBlockByHash
    • eth_getBlockByNumber
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getCode
    • eth_getFilterChanges
    • eth_getFilterLogs
    • eth_getLogs
    • eth_getStorageAt
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex
    • eth_getTransactionByHash
    • eth_getTransactionCount
    • eth_getTransactionReceipt
    • eth_getUncleByBlockHashAndIndex
    • eth_getUncleByBlockNumberAndIndex
    • eth_getUncleCountByBlockHash
    • eth_getUncleCountByBlockNumber
    • eth_newBlockFilter
    • eth_newFilter
    • eth_protocolVersion
    • eth_requestAccounts
    • eth_sendTransaction
    • eth_signTypedData
    • eth_signTypedData_v4
    • eth_uninstallFilter
    • net_version
    • personal_sign
    • web3_sha3
  • Resources
    • Stargazer Github
    • Stargazer Connector Github
    • Stargazer Demos Github
    • Stargazer Chrome
    • Stargazer Android
    • Stargazer IOS
    • EIP-1193
Powered by GitBook

Main

  • Website
  • Get DAG
  • Explore Projects
  • Partners

Socials

  • Telegram
  • Discord
  • X (Twitter)

Tools

  • Wallet
  • DAG Explorer
  • Coingecko

© 2025 CONSTELLATION NETWORK

On this page
  • Provider Activation
  • Detect Stargazer​
  • Obtain a ChainProvider​
  • Activate your provider​
  • Scope of the activation​
  • ChainProvider identity​

Was this helpful?

Export as PDF
  1. Guide

Provider Activation

PreviousIntroductionNextSending RPC Requests

Last updated 2 months ago

Was this helpful?

Provider Activation

A chain provider allows you to interact with any available network. In this guide, you will learn how to obtain a chain provider and activate it.

Tip

With the Stargazer Extension installed you can test the following examples in the browser console ().

Detect Stargazer

The Stargazer browser extension injects a instance under window.stargazer each time a page loads. You can check the existence of this property using the following snippet.

TypeScript

if (window.stargazer) {
  console.log("Stargazer version " + window.stargazer.version + " detected");
} else {
  console.log("Stargazer not detected");
}

Copy

Obtain a ChainProvider

Once you've verified your app has access to a instance you can obtain a to interact with a network of your choice (Constellation or Ethereum).

TypeScript

const provider = window.stargazer.getProvider("constellation");

Copy

Activating the provider is required before it can be used to interact with the user's wallet. When activation is triggered, a popup is triggered for the user to allow your site access to their wallet. The user may choose a subset of their wallets to share if they have multiple. Activation can be achieved with one of the following methods.

Calling dag_requestAccounts or eth_requestAccounts RPC methods, depending on the provider being used, will send an activation request for the user to accept. If the user accepts the request, the RPC method will return available accounts for the provider; if not, it will throw an error.

TypeScript

await dagProvider.request({ method: "dag_requestAccounts", params: [] });
// ["DAG88C9WDSKH451sisyEP3hAkgCKn5DN72fuwjfX"] provider was activated

await ethProvider.request({ method: "eth_requestAccounts", params: [] });
// ["0xAab2C30c02016585EB36b7a0d5608Db787c1e44E"] provider was activated

Copy

Warning

TypeScript

const activated = await provider.activate("A Cool App Name");

Copy

All chain providers are instantiated once per page, and per chain with the following setup:

TypeScript

const constellationProviderA = window.stargazer.getProvider("constellation");
const constellationProviderB = window.stargazer.getProvider("constellation");

const ethereumProviderA = window.stargazer.getProvider("ethereum");
const ethereumProviderB = window.stargazer.getProvider("ethereum");

Copy

Two chain providers from the same network and page will share the same underlying reference:

  • Object.is(constellationProviderA, constellationProviderB) will be true.

  • Object.is(ethereumProviderA, ethereumProviderB) will be true.

  • Object.is(constellationProviderA, ethereumProviderB) will be false.

  • Object.is(constellationProviderB, ethereumProviderA) will be false.

Read more about the and the .

Activate your provider

Using dag_requestAccounts or eth_requestAccounts RPC methods

Read more about the different RPC methods available both for and .

Activate method (deprecated)

This method of activation has been deprecated in favor of the specification, in both Constellation and Ethereum providers.

You can send an activation request to the user using the provider's method. Once the user accepts the request you'll be able to use the provider's RPC interface and methods for the selected chain.

Read more about the different RPC methods available both for and .

Scope of the activation

Activations are issued for the page and cover all chains available (currently Constellation and Ethereum) and on all providers given. If you have been granted activation in the past the user will not be asked to grant it again. If the user is logged out, they will be prompted to log in again.

ChainProvider identity

devtools
​
WalletProvider
​
WalletProvider
ChainProvider
WalletProvider API
ChainProvider API
​
​
Constellation
Ethereum
​
EIP-1102
activate()
Constellation
Ethereum
​
origin
​