Skip to main content

Initialize Push Chain Client

Overview

Initializing the SDK client gives you:

  • Chain-agnostic PushChainClient for submitting on-chain calls
  • Automatic RPC & block-explorer resolution (with optional overrides)
  • Built-in UEA (Universal Executor Account) and origin-account getters
  • End-to-end gas abstraction, signature orchestration & debug traces

Just pass your universal signer and network, and you’re ready to write and transact on Push Chain from any wallet.

Initialize Push Chain Client

PushChain.initialize(signer, {options}): Promise<PushChainClient>

// Import @pushchain/core and ethers
// Ensure you have created Universal Signer.
// If not done, then check out Create Universal Signer.

// Initialize Push Chain Client
const pushChainClient = await PushChain.initialize(universalSigner, {
network: PushChain.CONSTANTS.PUSH_NETWORK.TESTNET,
});

TheseArgumentsare mandatory

ArgumentsTypeDefaultDescription
signerUniversalSigner-Chain-agnostic signer responsible for signing transactions and messages.
options.networkPushChain.CONSTANTS.PUSH_NETWORK-Push Chain network to conenct to. For example: PushChain.CONSTANTS.PUSH_NETWORK.TESTNET
PushChain.CONSTANTS.PUSH_NETWORK
PushChain.CONSTANTS.PUSH_NETWORK.TESTNET PushChain.CONSTANTS.PUSH_NETWORK.TESTNET_DONUT PushChain.CONSTANTS.PUSH_NETWORK.LOCALNET
options.rpcUrlsPartial<Record<CHAIN, string>>{}Custom RPC URLs mapped by chain IDs. If not provided, the default RPC URLs for the network will be used. Example: rpcUrls: {[CHAIN.ETHEREUM_SEPOLIA]: 'https://sepolia.infura.io/v3/your-api-key', [CHAIN.SOLANA_DEVNET]: 'https://api.devnet.solana.com'}
Advanced Arguments
ArgumentsTypeDefaultDescription
options.blockExplorersPartial<Record<CHAIN, string[]>>{[CHAIN.PUSH_TESTNET_DONUT]: ['https://donut.push.network']}Custom block explorer URLs mapped by chain IDs. If not provided, the default block explorer URLs for the network will be used.
options.printTracesbooleanfalseWhen true, console logs the internal trace logs for debugging requests to nodes
Returns `PushChainClient` <object>
// PushChainClient object
{
orchestrator: Orchestrator {
universalSigner: {
account: [Object],
signMessage: [Function: signMessage],
signAndSendTransaction: [Function: signAndSendTransaction],
signTypedData: [Function: signTypedData]
},
pushNetwork: 'TESTNET_DONUT',
rpcUrls: {},
printTraces: false,
progressHook: undefined,
pushClient: PushClient {
publicClient: [Object],
pushChainInfo: [Object],
ephemeralKey: '...'
}
},
universalSigner: {
account: {
address: '0xC8AE31cF444CAB447921277c4DcF65128d5B25a8',
chain: 'eip155:11155111'
},
signMessage: [Function: signMessage],
signAndSendTransaction: [Function: signAndSendTransaction],
signTypedData: [Function: signTypedData]
},
blockExplorers: { 'eip155:42101': [ 'https://donut.push.network' ] },
universal: {
origin: [Getter],
account: [Getter],
sendTransaction: [Function: bound execute],
signMessage: [Function: signMessage],
signTypedData: [Function: signTypedData]
},
explorer: {
getTransactionUrl: [Function: getTransactionUrl],
listUrls: [Function: listUrls]
}
}

Let's create your first Push Chain client! Try the code in live playground 👇.

VIRTUAL NODE IDE

Access Account Information

Once initialized, your PushChainClient exposes:

PropertyDescription
pushChainClient.universal.accountPush Chain execution account: for native Push Chain wallets this is your EOA or smart account; for cross-chain wallets this is your UEA (Universal Executor Account) that holds gas and executes txns.
pushChainClient.universal.originOrigin account on the source chain (e.g. eip155:1), representing your wallet’s native address.
// execution vs. origin accounts
const execAccount = pushChainClient.universal.account; // Account that writes on Push Chain
const originAccount = pushChainClient.universal.origin; // Source chain account that is mapped to the execution account

Next Steps