All skills

Guide for writing TypeScript code with AlgoKit Utils (`@algorandfoundation/algokit-utils`). Use this skill whenever the user is building on Algorand with TypeScript — client setup, account management, payments, asset operations, atomic transaction groups, smart contract deployment and interaction (AppFactory, AppClient, ARC-56/ARC-32 specs), raw app calls, key registration, network management, testing with algorandFixture, error handling, and the low-level crypto primitives under `@algorandfoundation/algokit-utils/crypto` (Ed25519 keygen/signing/verification, SHA-512/256 `hash`, Peikert xHD BIP44 wallets, wrapped-secret patterns). Trigger on imports from `@algorandfoundation/algokit-utils` (incl. `/crypto`, `/testing`, `/transact` subpaths), references to `AlgorandClient`, `AppFactory`, `AppClient`, `AlgoAmount`, `algorandFixture`, `ed25519Generator`, `peikertXHdWalletGenerator`, `hash`, `WrappedEd25519Seed`, or `RawEd25519Signer`. Also on any TypeScript or JavaScript code that builds on Algorand.

Use this Skill: https://skilld.dev/gh/algorand-devrel/algorand-agent-skills/algokit-utils-ts

This session only. Nothing lands on disk.

referenceshashing.md

≈840 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Hashing

All snippets below import from @algorandfoundation/algokit-utils/crypto. This module exposes the SHA-512/256 primitive that the Algorand protocol uses everywhere — transaction IDs, Merkle roots, multisig addresses, and logic sig addresses. Most callers never need it directly; reach for it when you are building protocol-level helpers outside the transaction path.

Compute an Algorand-compatible hash

Use hash() to compute the SHA-512/256 digest that Algorand uses throughout the protocol.

import { hash } from "@algorandfoundation/algokit-utils/crypto";

const bytes = new TextEncoder().encode("Hello, Algorand!");
const digest = hash(bytes);

console.log(digest.length); // 32

What just happened: hash(bytes) computes sha512_256(bytes) (the NIST SHA-512/256 variant, not a truncated SHA-512) and returns the first 32 bytes. This is the exact hash function the Algorand protocol uses for transaction IDs, Merkle tree construction, logic sig addresses, multisig addresses, and every other hash256-shaped construction in the protocol. It is synchronous and pure — the same input always produces the same output.

Derive a multisig address

Combine participant public keys with the Algorand multisig domain separator and hash the result.

import { hash } from "@algorandfoundation/algokit-utils/crypto";

function multisigAddressBytes(
  version: number,
  threshold: number,
  pubkeys: Uint8Array[],
): Uint8Array {
  const prefix = new TextEncoder().encode("MultisigAddr");
  const merged = new Uint8Array(
    prefix.length + 2 + pubkeys.reduce((n, pk) => n + pk.length, 0),
  );
  merged.set(prefix, 0);
  merged[prefix.length] = version;
  merged[prefix.length + 1] = threshold;

  let offset = prefix.length + 2;
  for (const pk of pubkeys) {
    merged.set(pk, offset);
    offset += pk.length;
  }
  return hash(merged);
}

What just happened: Algorand multisig addresses are the SHA-512/256 hash of "MultisigAddr" || version || threshold || pubkey_1 || pubkey_2 || .... The snippet reproduces that construction using hash(). In normal code, prefer algorand.account.multisig(...) (see Account management) — it handles the byte layout and returns a fully-wired MultisigAccount with signers attached. Reach for hash() directly only when you are implementing a protocol helper outside the account-manager layer.

Derive a logic sig address

Prefix compiled TEAL bytes with Program and hash them to get the logic sig address.

import { hash } from "@algorandfoundation/algokit-utils/crypto";

function logicSigAddressBytes(program: Uint8Array): Uint8Array {
  const prefix = new TextEncoder().encode("Program");
  const merged = new Uint8Array(prefix.length + program.length);
  merged.set(prefix, 0);
  merged.set(program, prefix.length);
  return hash(merged);
}

What just happened: A logic sig address is hash("Program" || teal_bytes). hash() produces the 32-byte digest that becomes the account's raw public key bytes; base32-encoding those bytes with the Algorand checksum yields the familiar string address. As with multisig, algorand.account.logicsig(program) wraps this construction for you — the raw hash() call is only needed when you are working outside the account-manager layer.

Source: SKILL.md on GitHub

1 alert1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides a comprehensive guide for using the AlgoKit Utils TypeScript library. It follows security best practices, such as recommending environment variables for secrets, and uses standard testing mnemonics and placeholder domains in its code examples. No malicious patterns or security risks were detected.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: HIGH · 2 issues

Signed by skilld at 4235fb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 6 months ago

README badge

README badge for algorand-devrel/algorand-agent-skills/algokit-utils-ts