Catalog · How the catalog works
SolLib4Pascal
Solana for Modern Object Pascal
- ★ 12 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README

SolLib4Pascal
Solana blockchain SDK for Object PascalSolLib4Pascal is a Solana blockchain SDK for Object Pascal, providing JSON RPC clients, wallet management, transaction building, and program interfaces for seamless Solana integration in Object Pascal applications, released under the permissive MIT License.
Table of Contents
- Features
- Available Programs
- Getting Started
- Quick Examples
- Running Tests
- Contributing
- Sponsors
- Tip Jar
- License
- Branding
Features
- JSON RPC API -- full coverage of Solana JSON RPC methods
- Streaming JSON RPC API -- WebSocket-based subscription support
- Wallet and accounts -- HD wallet derivation from mnemonic phrases
- Keystore -- secure key storage
- Transaction encoding/decoding -- base64 and wire format support
- Message encoding/decoding -- base64 and wire format support
- Instruction decompilation -- decode instructions back to structured data
- Program interfaces -- typed wrappers for native and SPL programs
Available Programs
Native Programs
System Program
Loader Programs
BPF Loader Program
Solana Program Library (SPL)
Compute Budget Program | Address Lookup Table Program | Memo Program | Token Program | Token Swap Program | Associated Token Account Program | Shared Memory Program
Getting Started
Prerequisites
| Compiler | Minimum Version |
|---|---|
| Delphi | 10.4 or later |
Compile-Time Dependencies
Installation
Add the SolLib sources and its dependencies to your compiler search path.
Quick Examples
Fetch Balance and Send a Memo
var
LRpc: IRpcClient;
LHttpClient: IHttpApiClient;
LWallet: IWallet;
LFrom: IAccount;
LBlock: IRequestResult<TResponseValue<TLatestBlockHash>>;
LBalance: IRequestResult<TResponseValue<UInt64>>;
LTxBytes: TBytes;
LSignature, LMnemonicWords: string;
LBuilder: ITransactionBuilder;
LPriorityFees: IPriorityFeesInformation;
begin
LHttpClient := THttpApiClient.Create();
LRpc := TClientFactory.GetClient(TCluster.MainNet, LHttpClient);
LMnemonicWords := 'Your Mnemonic Words';
LWallet := TWallet.Create(LMnemonicWords);
LFrom := LWallet.GetAccountByIndex(0);
// Get balance
LBalance := LRpc.GetBalance(LFrom.PublicKey.Key);
if LBalance.WasSuccessful then
Writeln(Format('Balance: %d lamports', [LBalance.Result.Value]))
else
Writeln('Balance: <unavailable>');
LBlock := LRpc.GetLatestBlockHash;
if (LBlock = nil) or (not LBlock.WasSuccessful) or (LBlock.Result = nil) then
raise Exception.Create('Failed to fetch recent blockhash.');
// Build priority fee information
LPriorityFees := TPriorityFeesInformation.Create(
TComputeBudgetProgram.SetComputeUnitLimit(400000), // limit
TComputeBudgetProgram.SetComputeUnitPrice(100000) // price (micro-lamports)
);
// Build transaction (Send a simple memo transaction)
LBuilder := TTransactionBuilders.Legacy;
LTxBytes :=
LBuilder
.SetRecentBlockHash(LBlock.Result.Value.Blockhash)
.SetFeePayer(LFrom.PublicKey)
.SetPriorityFeesInformation(LPriorityFees)
.AddInstruction(TMemoProgram.NewMemo(LFrom.PublicKey, 'Hello from SolLib'))
.Build(LFrom);
LSignature := LRpc.SendTransaction(LTxBytes);
Writeln(Format('Transaction Signature: %s', [LSignature]));
end;Versioned (v0 / v1) Transactions
TTransactionBuilders.V0 and .V1 build versioned transactions, each exposing only the methods
valid for that version, so invalid combinations don't compile. Version 0 carries address lookup
tables (AddAddressTableLookup); version 1 (SIMD-0385, live on mainnet since epoch 1035) instead
carries the compute-budget and priority-fee settings in the message via SetTransactionConfig, and
allows larger transactions (up to 4096 bytes). Legacy (unversioned) transactions use
TTransactionBuilders.Legacy, shown in the example above.
var
LV0Builder: IVersionedTxV0Builder;
LV1Builder: IVersionedTxV1Builder;
LConfig: TTransactionConfig;
LV0Bytes, LV1Bytes: TBytes;
begin
// Version 0: address lookup tables.
LV0Builder := TTransactionBuilders.V0;
LV0Bytes :=
LV0Builder
.SetRecentBlockHash(LBlockHash)
.SetFeePayer(LFrom.PublicKey)
.AddAddressTableLookup(LLookup)
.AddInstruction(TSystemProgram.Transfer(LFrom.PublicKey, LTo, 1000))
.Build(LFrom);
// Version 1: in-message transaction config (no Compute Budget instructions needed).
// The builder takes ownership of the config passed to SetTransactionConfig.
LConfig := TTransactionConfig.Create;
LConfig.ComputeUnitLimit := UInt32(20000);
LConfig.PriorityFee := UInt64(5000);
LConfig.HeapSize := UInt32(64 * 1024);
LConfig.LoadedAccountsDataSizeLimit := UInt32(64 * 1024);
LV1Builder := TTransactionBuilders.V1;
LV1Bytes :=
LV1Builder
.SetRecentBlockHash(LBlockHash)
.SetFeePayer(LFrom.PublicKey)
.SetTransactionConfig(LConfig)
.AddInstruction(TSystemProgram.Transfer(LFrom.PublicKey, LTo, 1000))
.Build(LFrom);
end;Running Tests
Tests are provided for Delphi.
- Delphi (desktop): Open and run
SolLib.Tests/Delphi.Tests/SolLib.Tests.dprin the IDE.
Additional samples can be found in the SolLib.Examples folder.
Contributing
Contributions are welcome. Please open an issue for bug reports or feature requests, and submit pull requests.
Sponsors
Tip Jar
If you find this library useful and would like to support its continued development, tips are greatly appreciated! 🙏
| Cryptocurrency | Wallet Address |
|---|---|
Bitcoin (BTC) |
bc1quqhe342vw4ml909g334w9ygade64szqupqulmu |
Ethereum (ETH) |
0x53651185b7467c27facab542da5868bfebe2bb69 |
Solana (SOL) |
BPZHjY1eYCdQjLecumvrTJRi5TXj3Yz1vAWcmyEB9Miu |
License
This project is licensed under the MIT License.


Bitcoin (BTC)
Ethereum (ETH)
Solana (SOL)