implement-arc-standards

Implement Algorand ARC standards in smart contracts and clients. Use when needing to understand ARC-4 ABI encoding or method signatures, working with application specifications (ARC-32 or ARC-56), calling ARC-4 methods from contracts or clients, encountering ABI encoding/decoding issues, or generating typed clients from app specs. Strong triggers include "What is ARC-4?", "How do I encode ABI arguments?", "What's the difference between ARC-32 and ARC-56?", "method selector not matching", "application specification", "arc56.json".

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "implement-arc-standards" with this command: npx skills add algorand-devrel/algorand-agent-skills/algorand-devrel-algorand-agent-skills-implement-arc-standards

Implement ARC Standards

ARC (Algorand Request for Comments) standards define conventions for encoding, method calls, and application specifications on Algorand. This skill covers the most essential ARCs for smart contract development.

Overview / Core Workflow

  1. Understand which ARC applies to your use case
  2. Implement the contract following ARC conventions
  3. Generate application specification files
  4. Use the app spec to build typed clients

How to proceed

Key ARCs for Smart Contract Development

ARCPurposeWhen to Use
ARC-4Application Binary Interface (ABI)All smart contract method calls, type encoding
ARC-22Read-only method annotationMethods that don't modify state
ARC-28Event logging specificationEmitting structured events
ARC-32Application Specification (deprecated)Legacy app specs (use ARC-56 instead)
ARC-56Extended App DescriptionModern app specs with full contract metadata

ARC-4: The Foundation

ARC-4 defines how to encode method calls and data types for Algorand smart contracts.

Method Signatures

A method signature uniquely identifies a method: name(arg_types)return_type

# Method signature: add(uint64,uint64)uint128
# Method selector: first 4 bytes of SHA-512/256 hash

from algopy import ARC4Contract, arc4

class Calculator(ARC4Contract):
    @arc4.abimethod
    def add(self, a: arc4.UInt64, b: arc4.UInt64) -> arc4.UInt128:
        return arc4.UInt128(a.native + b.native)
import { Contract } from '@algorandfoundation/algorand-typescript'
import { abimethod, UInt64, UInt128 } from '@algorandfoundation/algorand-typescript/arc4'

class Calculator extends Contract {
  @abimethod()
  add(a: UInt64, b: UInt64): UInt128 {
    return new UInt128(a.native + b.native)
  }
}

Method Selector Calculation

Method signature: add(uint64,uint64)uint128
SHA-512/256 hash: 8aa3b61f0f1965c3a1cbfa91d46b24e54c67270184ff89dc114e877b1753254a
Method selector: 8aa3b61f (first 4 bytes)

ARC-32 vs ARC-56

FeatureARC-32ARC-56
State schemaYesYes
Method descriptionsYesYes
Named structsNoYes
Default argument valuesPartialFull
Source mapsNoYes
Events (ARC-28)NoYes
StatusDeprecatedCurrent

Use ARC-56 for new projects. ARC-32 is maintained for backwards compatibility.

Generating App Specs

App specs are automatically generated when compiling with PuyaPy or PuyaTs:

# Generates ContractName.arc32.json and ContractName.arc56.json
algokit project run build

Using App Specs with Clients

// TypeScript with AlgoKit Utils
import { algorandClient } from '@algorandfoundation/algokit-utils'
import appSpec from './Calculator.arc56.json'

const client = algorand.client.getTypedAppClientById(CalculatorClient, {
  appId: 12345n,
  appSpec,
})

const result = await client.send.add({ args: { a: 10n, b: 20n } })
# Python with AlgoKit Utils
from algokit_utils import AlgorandClient
from artifacts.calculator_client import CalculatorClient

algorand = AlgorandClient.default_localnet()
client = algorand.client.get_typed_app_client(
    CalculatorClient,
    app_id=12345,
)

result = client.send.add(a=10, b=20)

Important Rules / Guidelines

RuleDetails
ARC-4 types only in ABIUse arc4.UInt64, arc4.String, etc. for method arguments and returns
Reference types as arguments onlyaccount, asset, application cannot be return types
15 argument limitMethods with 16+ args encode extras as a tuple in arg 15
Return prefixReturn values are logged with 151f7c75 prefix
Bare methods have no selectorBare calls use NumAppArgs == 0 for routing

Common Variations / Edge Cases

ScenarioApproach
Calling ARC-4 method from contractUse arc4.abi_call() for type-safe inner transactions
Creating contract with methodUse create="require" in @abimethod decorator
Read-only methods (ARC-22)Use readonly=True parameter in decorator
Emitting events (ARC-28)Use arc4.emit() with typed event structs

References / Further Reading

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

test-smart-contracts

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

troubleshoot-errors

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

search-algorand-examples

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

use-algokit-utils

No summary provided by upstream source.

Repository SourceNeeds Review