This project shows a rough proof-of-concept of how to embed Anchor IDLs inside deployed programs on the Solana block chain. It uses new ELF sections to store additional meta-data about the program, as well as the Anchor IDL itself. The manifest serves as the root description for discovering other traits about the binary, that are outside the scope of the ELF standard.
This is part of a bigger solution we're building, but it demonstrates how we're starting to think about the problem of including more information inside deployed programs.
- Compressed sections using
SHF_COMPRESSED
rather than plain-text. - Better definition of the manifest structure (e.g. JSON schema).
In order to try this demo, you need the following in your path:
-
pnpm
https://pnpm.io -
solana
CLI andanchor
https://solana.com/docs/intro/installation -
LLVM's tooling (the build that comes with Solana's tooling works, but so should other builds)g
-
Install npm packages i.e.
pnpm install
-
Run the build i.e.
./build
-
Run a Solana test validator e.g.
solana-test-validator
-
Deploy the Anchor project i.e.
(cd counter_anchor && anchor deploy)
-
Run the demo e.g.
ANCHOR_WALLET=$HOME/.config/solana/id.json npx tsx run.ts idpSeYFgfK6oheFdXciWNDZHmmDwuHvetG4gJWTwopX
You should see the Anchor program's IDL discovered from the binary in the validator, and instructions should be executed against it.