Express Server

gill-node-express
Simple node Express API that comes with gill based on @solana/kit.
Getting started
Clone the repo:
git clone https://github.com/solana-foundation/templates
cd templates/gill/gill-node-expressInstall dependencies:
npm installStart the api:
npm run devBuild the api:
npm run buildThe artifacts will be in the dist directory. You can now run the api using npm run start or node dist/index.js.
Docker
Build the Docker image:
npm run docker:buildRun the Docker image:
npm run docker:runEnvironment variables
The following environment variables can be used to configure the API:
SOLANA_RPC_ENDPOINT: The Solana RPC endpoint to use. Defaults todevnet.SOLANA_SIGNER_PATH: The path to the keypair signer file. Defaults to./keypair-signer.json.CORS_ORIGINS: A comma-separated list of allowed origins for CORS. Defaults to*.
Examples (curl)
Below are some examples of how to use the API using curl. You can use jq to format the output.
Balance
This command will return the balance of the provided address.
curl http://localhost:3000/balance/FeeSoLT7WdoZVXsBPSZc7WKEuhVDVA1TKrNQoHacvxYmBalance (signer)
This command will return the balance of the signer's address.
curl http://localhost:3000/balance-signerCluster
This command will return the cluster based on the genesis hash of the connected cluster.
curl http://localhost:3000/clusterLatest blockhash
This command will return the latest blockhash of the connected cluster. It uses a cached blockhash if available.
curl http://localhost:3000/latest-blockhash