If you want to create an indexer, you're in the right place.
But if you like to contribute to the indexing framework itself, head over to the framework repo
There are three way's to create your indexer after you create a new project:
- If you have an IDL, use the Anchor Indexer Generator.
- Use one of the pre-built, customized indexer examples in the package folder as a starting point.
- Build one from scratch.
- Make a fork of this project in your GitHub Workspace.
- Create a package with your project name's and put it inside
/packagesdirectory. - Modify the
lerna.jsonfile and ensure to add your project to the list. - Write your custom indexer code or copy it from another project like the
spl-lendingindexer in the package folder. - Substitute the
INDEXERvariable inside.github/workflows/main.ymlfile, changing it to your project's name:
- name: Build and export
uses: docker/build-push-action@v3
with:
context: .
tags: aleph-framework:latest
outputs: type=docker,dest=/tmp/aleph-framework.tar
build-args: |
INDEXER=XXXXXX- Once your indexer code is finished and working, create a PR on GitHub and push it.
- Label your PR with the
deploytag. - The GitHub action will be triggered, and you will be able to download the final root filesystem of your indexer, ready to be pushed to Aleph network.
- You will find this rootfs file inside
Actions->"Name of your last commit"->Artifacts->rootfs.squashfs. - Download it, upload this
rootfs.squashfsruntime file to IPFS, pin it, and you will be ready to proceed with the deployment.
Using this method you will need to store you wallet private key's inside GitHub Secrets.
- Go to repository
Secretstab and add a new one likeWALLET_PRIVATE_KEY. - Inside
.github/workflows/main.ymlfile, uncomment the last action that is commented and ensure to replaceXXXXXXwith the IPFS hash of yourrootfs.squashfsfile uploaded:
- uses: aleph-im/aleph-github-actions/publish-runtime@main
id: publish-runtime
with:
fs_path: ./rootfs.squashfs
private-key: ${{ secrets.WALLET_PRIVATE_KEY }}
runtime_hash: XXXXXX
indexer: spl-lending- Pushing this new changes with a PR or a simple commit to the repository, the GitHub action will be triggered.
- Once the action finishes successfully, inside
Actions->"Name of your last commit"->Generate runtimejob ->Publish runtimestep, you will be able to see the VM address:
https://aleph.sh/vm/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- Have installed
aleph-client(See https://github.com/aleph-im/aleph-client).
- Pin your
rootfs.squashfsruntime file hash (that is already uploaded to IPFS) inside Aleph network:
aleph pin RUNTIME_HASH --private-key WALLET_PRIVATE_KEY- Download the program files in the current directory through here.
- Deploy the program inside a persistent VM at Aleph network (changing INDEXER by your indexer name):
aleph program ./program "run.sh INDEXER" --persistent --private-key WALLET_PRIVATE_KEY --runtime RUNTIME_HASH- Once command finishes, you will be able to see the VM address:
https://aleph-vm-lab.aleph.cloud/vm/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX