This repository shows you how you can easily integrate Solana blockchain into your Android app using the Portal Android SDK. It covers the following features.
- Generate a Solana Wallet
- Fetch and display Solana and PyUSD balances.
- Transfer PyUSD to a given Solana address.
- Backup the wallet with password as the key to Portal servers.
- Recover the wallet with password as the key from Portal servers.
Portal SDK also covers the following backup method which were not covered in this example app but you learn how to implement them through our docs.
- Backup with iCloud
- Backup with GDrive
- Backup with Passkey
- Clone the repo to your local system
- Open the project in your Android Studio.
- Go to your Portal Dashboard settings page and create a client test API key (screenshots are attached below for your convenience).
- Update the PORTAL_CLIENT_API_KEY field in
app/src/main/java/io/portalhq/portalhackathon/core/commonconstants/PortalConstants.ktwith your Portal client id (screenshot below). - Run the app and it should work without any issues.
Most of the files in the app are for skeleton of the app and not directly related to Portal SDK. Below are the important files which have Portal SDK code in Action.
PortalModule.kt: This is where Portal SDK is being initialized. For more info on how to initialized Portal SDK please refer to this doc.PortalRepository.kt: This repository file contains all the features that are performed in this example app using the Portal Android SDK like createWallet, backupWallet, sendPyUsd etc.PortalSolanaApi.kt: This file contains code to interact with Portal Assets API which is used to build a solana transaction and also fetch solana balances. In the future we do plan to integrate it inside our SDK but for now it is separate and hence the separate API client here.BlockChainConstants.kt: This file contains common blockchain related constants (like solana keychain urls).PortalConstants.kt: This file contains common Portal related constants (like Portal client API key).HomeScreen.kt: This is the main screen UI of the app which contains all UI elements of this app (like generate wallet, transfer PyUSD etc.)HomeViewModel.kt: This ViewModel controls the presentation and events coming from HomeScreen.kt and also holds the view state for this screen.
You can ignore all other files as those files are all helper classes.
To fully test this app (like for example to transfer funds) you will need to load your wallet with TestNet Solana and PyUSD tokens. Below are some faucets that you can use.
Portal's SDKs have several pieces of core functionality.
- Generating a Wallet: This function creates MPC key shares on your local device and the Portal servers. These key shares support all EVM chains and Solana.
- Signing a Transaction: This function signs a provided transaction, and can broadcast that transaction to a chain when an RPC gateway URL is provided.
- Signature Hooks: By default this repo will submit a transaction without prompting a user, but you can use signature hooks to build a prompt for users before submitting a transaction for signing.
Portal supplies several APIs for simplifying your development.
- Get Assets: This endpoint returns a list of fungible asset (native, ERC-20, and SPL tokens) associated with your client for a given chain.
- Get NFTs: This endpoint returns a list of the NFTs associated with your client for a given chain.
- Get Transactions: This endpoint returns a list of the historic transactions associated with your client for a given chain.
- Build a Transaction - Send Asset: This endpoint builds a formatted transaction to send a fungible asset (native, ERC-20, and SPL tokens) for a given chain.
- Evaluate a Transaction: This endpoint can simulate a transaction and/or scan a transaction for security concerns.
- PYUSD on Solana: An overview of PYUSD on Solana.
- PYUSD Quick Start Guide: A quick overview of PYUSD and information behind it.
- PYUSD Solana Testnet Faucet: Use this faucet to get testnet PYUSD on Solana.
- What is PayPal USD: Information about how PYUSD works.
- PYUSD Solana (SPL) Mainnet Address:
2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo - PYUSD Solana (SPL) Devnet Address:
CXk2AMBfi3TwaEL2468s6zP8xq9NxTXjp9gjMgzeUynM
- Intro to Solana Development: An introduction to development on Solana.
- Solana SPL Token Docs: Documentation on SPL tokens.
Need help or want to request a feature? Reach out to the PayPal & Portal teams on the official hackathon Slack channel.





