The SOLANA RPC is an Internet Computer (ICP) canister designed to facilitate communication between the Solana blockchain and the Internet Computer using an on-chain API.
This canister sends API requests to JSON-RPC services via HTTPS outcalls. It enables functionalities similar to traditional Solana decentralized applications (dApps), including querying Solana smart contract states and submitting raw transactions.
The canister runs on the 34-node fiduciary subnet with the following principal: bd3sg-teaaa-aaaaa-qaaba-cai.
Refer to the Reproducible Builds section for information on how to verify a hash of a deployed WebAssembly module.
Before getting started, make sure to install the following on your machine:
- DFINITY SDK
- Docker
- PocketIC (for testing)
Additionally, make sure that the POCKET_IC_BIN
environment variable is set to the path of the pocket-ic
binary.
Add the following configuration to your dfx.json
file. Replace the ic
principal with the appropriate canister principal from the deployed canisters.
{
"canisters": {
"solana_rpc": {
"type": "custom",
"candid": "https://github.com/mfactory-lab/ic-solana/releases/latest/download/ic-solana-rpc.did",
"wasm": "https://github.com/mfactory-lab/ic-solana/releases/latest/download/ic-solana-rpc.wasm.gz",
"remote": {
"id": {
"ic": "bd3sg-teaaa-aaaaa-qaaba-cai",
"playground": "bd3sg-teaaa-aaaaa-qaaba-cai"
}
}
}
}
}
Note: Make sure to use the correct principal ID corresponding to your environment (e.g., ic
,playground
). Refer to the Deployment section for more details.
To run the project locally, follow these steps:
-
Start a replica:
dfx start --clean --background
This command starts a local Internet Computer replica in the background.
-
Build and deploy canisters:
dfx deploy solana_rpc --argument '(record {})'
This command builds and deploys your canisters to the local replica and generates a Candid interface.
-
Access the application:
Once the build and deployment are complete, your application will be accessible at:
http://localhost:4943?canisterId={asset_canister_id}
Replace
{asset_canister_id}
with the actual canister ID generated during deployment.
We use PocketIC for integration testing. Please make sure to have it installed and the
POCKET_IC_BIN
environment variable set to the path of the pocket-ic
binary.
You can run the tests with the following commands:
-
Run all tests:
make test
-
Run a specific test:
make test TEST="specified_test_here"
The canister is deployed to bd3sg-teaaa-aaaaa-qaaba-cai
.
You can check the Candid UI at
https://a4gq6-oaaaa-aaaab-qaa4q-cai.raw.icp0.io/?id=bd3sg-teaaa-aaaaa-qaaba-cai
.
The SOLANA RPC canister supports reproducible builds:
- Ensure Docker is installed on your machine.
- Run
./scripts/docker-build --rpc
in your terminal. - Run
sha256sum ic-solana-rpc.wasm.gz
on the generated file to view the SHA-256 hash.
Compare the generated SHA-256 hash with the hash provided in the repository to verify the build's integrity.
To learn more about the SOLANA RPC Canister and its integration with Solana and ICP, explore the following resources:
- Candid Interface
- Solana JSON-RPC API
- Internet Computer Developer Docs
- DFINITY SDK Documentation
- Internet Computer HTTPS Outcalls
This project is licensed under the Apache License 2.0.