Compile, deploy, call · ≈ 9 min

The manifest: how the chain knows your ABI

Your .py file is the code. The manifest declares what the outside world may call, and with what types.

A deployable contract is two files:

mycontract/
  contract.py      # the code
  manifest.json    # the ABI and metadata

The manifest names your functions and their types. Here is a real one, trimmed from the Animica token standard:

{
  "name": "Counter",
  "version": "1.0.0",
  "language": "python-vm",
  "source": { "path": "contract.py" },
  "abi": {
    "events": [
      {"name": "Incremented",
       "fields": [{"name": "by", "type": "int"}, {"name": "value", "type": "int"}]}
    ],
    "functions": [
      {"name": "init",
       "stateMutability": "nonpayable",
       "inputs": [{"name": "owner", "type": "bytes"}],
       "outputs": []},
      {"name": "inc",
       "stateMutability": "nonpayable",
       "inputs": [{"name": "by", "type": "int"}],
       "outputs": [{"type": "int"}]},
      {"name": "get",
       "stateMutability": "view",
       "inputs": [],
       "outputs": [{"type": "int"}]}
    ]
  }
}

stateMutability: "view" marks a function that only reads. Those can be answered by any node without a transaction, which is why get() is free and inc() is not. Getting this wrong does not break your contract, but it does mean callers pay gas to read a value they could have had for nothing.

The manifest is a declaration, not a check on your Python. If you rename a function in contract.py and forget the manifest, compilation still succeeds and callers get "no such function" at run time. Change both together.

Stuck? Ask

Answered by Animica's own free inference network. It is donated GPU capacity, so give it 20-30 seconds.