Is there a SDK for server-side C programming for Solana?


I have a requirement to submit signed transactions to Solana blockchain in a server written in C programming language.

I can use sendTransaction of JSON RPC API (JSON RPC API | Solana Docs), but it requires a serialized transaction.

My question is how do I reach up to a serialized transaction byte array?

  1. I don’t see a C SDK similar to the JavaScript web3js. Is there a C SDK? or is there a C SDK under development or are there already C primitives for the purpose?

  2. I can find the transaction format in JSON, generated from web3js. Eg. JSON format of transfer transaction to fill data.

  3. How do sign the transaction in C?

  4. How do I serialize the signed transaction in C?

Once I have the serialized byte array, I can proceed to submit to blockchain.

Mind someone help me in this? Best is a tiny C example for transfer SOL or tokens.

I need to know above 3 and 4 only. I can give it try and feedback.

Many thanks in advance.

Best regards

Please try transaction.serialize(), if you already built a transaction object.

Example sendTransaction given by Solana is as follows:

curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' { "jsonrpc": "2.0", "id": 1, "method": "sendTransaction", "params": [ "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT" ] }

What is the format of the binary data given to “params”? Where is it documented?

If I know the binary format of a fully signed transaction, I can convert it to base64 to be sent.

My current requirement is a SOL and token transfer transactions.