Skip to content

Latest commit

 

History

History
123 lines (80 loc) · 4.83 KB

README.md

File metadata and controls

123 lines (80 loc) · 4.83 KB

SOLANA RPC  GitHub license

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.

Prerequisites

Before getting started, make sure to install the following on your machine:

Additionally, make sure that the POCKET_IC_BIN environment variable is set to the path of the pocket-ic binary.

Quick start

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.

Running the project locally

To run the project locally, follow these steps:

  1. Start a replica:

    dfx start --clean --background

    This command starts a local Internet Computer replica in the background.

  2. 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.

  3. 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.

Testing

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"

Deployment on the Internet Computer

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.

Reproducible builds

The SOLANA RPC canister supports reproducible builds:

  1. Ensure Docker is installed on your machine.
  2. Run ./scripts/docker-build --rpc in your terminal.
  3. 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.

Learn more

To learn more about the SOLANA RPC Canister and its integration with Solana and ICP, explore the following resources:

License

This project is licensed under the Apache License 2.0.