The Prime Onchain Wallet REST API provides programmatic access to the Onchain Wallet, enabling workflow automation for tasks such as sending, receiving, and onchain trading. This enhances operational efficiency, minimizes manual intervention, and ensures secure, seamless transactions across supported blockchains.

Creating an Onchain Wallet

An onchain wallet can be created using the same Create Wallet endpoint detailed in the Wallets concepts page. See below for examples on how to process this creation:

WalletsService walletsService = PrimeServiceFactory.createWalletsService(client);

CreateWalletRequest request = new CreateWalletRequest.Builder()
.portfolioId("PORTFOLIO_ID_HERE")
.type(WalletType.ONCHAIN)
.name("ONCHAIN_WALLET_EXAMPLE")
.build();

CreateWalletResponse response = walletsService.createWallet(request);

To learn more about this SDK, please visit the Prime Java SDK.

Receiving funds into Prime Onchain Wallet

This functionality works identically to deriving a deposit address for any other Prime wallet. See Deposits for more information.

Creating an Onchain Transaction

Creating an onchain transaction is accomplished via the Create Onchain Transaction endpoint. While this endpoint processes the initiation of a transaction, please note:

  • The transaction still requires signing through the standard Onchain wallet flows.
  • Consensus approval still applies if required by the portfolio’s transfer rules.

When specifying the chain ID, it is important to remember that it is a numeric code representing the blockchain network. For example, the chain ID for Base is 8453. Other network codes can be looked up at Chainlist.

See below for an example request.

TransactionsService transactionsService = PrimeServiceFactory.createOnchainTransaction(client);

EvmParams evmParams = new EvmParams.Builder()
.chainId("CHAIN_ID_HERE")
.build();

CreateOnchainTransactionRequest request = new CreateOnchainTransactionRequest.Builder()
.portfolioId("PORTFOLIO_ID_HERE")
.walletId("WALLET_ID_HERE")
.rawUnsignedTransaction("RAW_UNSIGNED_TRANSACTION_HERE")
.evmParams(evmParams)
.amount("AMOUNT")
.build();

CreateOnchainTransactionResponse response = transactionsService.createOnchainTransaction(request);

To learn more about this SDK, please visit the Prime Java SDK.

Address Groups

Prime Onchain Wallet utilizes address groups, which are collections of addresses organized for specific purposes, such as grouping addresses associated with a particular Uniswap pool.

To list the available Onchain Address Groups, use the List Onchain Address Groups endpoint. An example request is shown below:

OnchainAddressBookService onchainAddressBookService = PrimeServiceFactory.createOnchainAddressBookService(client);

ListOnchainAddressBookRequest request = new ListOnchainAddressBookRequest.Builder()
    .portfolioId("PORTFOLIO_ID_HERE")
    .build();

ListOnchainAddressBookResponse response = onchainAddressBookService.listOnchainAddressBook(request);

To learn more about this SDK, please visit the Prime Java SDK.