Create

Register a program to run on Aleph.im virtual machines.

Warning

At this moment, you can only upload your program as a .zip file. Don't forget to compress them in this format before sending them!

Usage

Import the Store declaration to interact with the Publish function and the Item type to choose your storage location.

import { messages } from 'aleph-sdk-ts';
import { ItemType } from 'aleph-sdk-ts/dist/messages/message';
import { readFileSync } from "fs";

// Or used optimized import

import { Publish as publishProgram } from 'aleph-sdk-ts/dist/messages/program';

Then call the publishProgram function, with the required parameters as follow:


(async() => {
  const fileContent = readFileSync("<Your program path>");
  
  const res = await publishProgram({
      account: account,
      channel: "TEST",
      file: fileContent,
      entrypoint: "main:app" // This value referred to the `Basic Progam` example
  })

})

Parameters

Return

After sending your program, you can find it on the Aleph Explorer. This is an example of a Hello world test.

When you are sending a Program Message, the function returns the transaction. Inside it, you can find the item_hash field that is referring to your program location.

# Url format:
https://aleph.sh/vm/{Your program item_hash}

#Example of the Hello World program:
https://aleph.sh/vm/5d9dfafd5598a4a6b1c3f5b9a79023a783d60d73ac65d695d7e573ad048fc0f1

You can "pin" your programs' hashes with a Post message for example with some tags and references to allow you to retrieve them easily.

Last updated