DocsStandard library

Standard library

Syscalls reach the chain. Each figure is the whole call, the builtin call included, measured on the Weft program.

SyscallDoesUnits
log()write a line to the transaction log678 +3 per byte
load()read a key from the script's storage552 +224 per value read
store()write a key to the script's storage697 +21 per byte, +224 per value written
account()read an account's lamports, owner and data length3,955
transfer()move lamports from the signer through the System Program3,759
sha256()hash a string1,548
now()unix time from the Clock sysvar484
slot()the current slot from the Clock sysvar486
signer()the address that signed the run519

Helpers run in the interpreter: len, str, num, int, push, pop, keys, values, range, floor, ceil, abs, min, max, sqrt, upper, lower, split, join, contains, type. Each language also keeps its own spellings — console.log and Math.floor in JavaScript, print and append in Python, print and tostring in Lua, display in Lisp.