Builtins

You can find the Aiken equivalents of those builtins in aiken-lang/prelude (opens in a new tab).

BuiltinsType ArgsTerm ArgsResult
ifThenElse1(α)(Bool, (α), (α))α
addInteger-(Integer, Integer)Integer
subtractInteger-(Integer, Integer)Integer
multiplyInteger-(Integer, Integer)Integer
divideInteger-(Integer, Integer)Integer
modInteger-(Integer, Integer)Integer
quotientInteger-(Integer, Integer)Integer
remainderInteger-(Integer, Integer)Integer
equalsInteger-(Integer, Integer)Bool
lessThanInteger-(Integer, Integer)Bool
lessThanEqualsInteger-(Integer, Integer)Bool
integerToByteString-(Bool, Integer, Integer)Integer
appendString-(String, String)String
equalsString-(String, String)Bool
encodeUtf8-(String)Bytestring
appendByteString-(Bytestring, Bytestring)Bytestring
consByteString-(Integer, Bytestring)Bytestring
indexByteString-(Bytestring, Integer)Integer
sliceByteString-(Integer, Integer, Bytestring)Bytestring
lengthOfByteString-(Bytestring)Integer
equalsByteString-(Bytestring, Bytestring)Bool
lessThanByteString-(Bytestring, Bytestring)Bool
lessThanEqualsByteString-(Bytestring, Bytestring)Bool
decodeUtf8-(Bytestring)String
byteStringToInteger-(Bool, Bytestring)Integer
chooseData2(α)(Data, (α), (α), (α), (α), (α))α
constrData-(Integer, List Data)Data
unConstrData-Data(Integer, List Data)
iData-(Integer)Data
unIData-(Data)Integer
bData-(Bytestring)Data
unBData-(Data)Bytestring
mapData-(List (Pair Data Data))Data
unMapData-(Data)List (Pair Data Data)
listData-(List Data)Data
unListData-(Data)List Data
equalsData-(Data, Data)Bool
serialiseData-(Data)Bytestring
chooseList3(α, β)(List (α), (β), (β))β
mkNilData-(Unit)List (Data)
mkNilPairData-(Unit)List (Pair Data Data)
mkCons(α)((α), List (α))List (α)
headList(α)(List (α))α
tailList(α)(List (α))List (α)
nullList(α)(List (α))Bool
mkPairData-(Data, Data)Pair (Data) (Data)
fstPair(α, β)Pair (α) (β)α
sndPair(α, β)Pair (α) (β)β
blake2b_224-(Bytestring)Bytestring
blake2b_256-(Bytestring)Bytestring
keccak_256-(Bytestring)Bytestring
sha2_256-(Bytestring)Bytestring
sha3_256-(Bytestring)Bytestring
verifyEd25519Signature4-(Bytestring, Bytestring, Bytestring)Bool
verifyEcdsaSecp256k1Signature4-(Bytestring, Bytestring, Bytestring)Bool
verifySchnorrSecp256k1Signature4-(Bytestring, Bytestring, Bytestring)Bool
bls12_381_G1_add-(G1Element, G1Element)G1Element
bls12_381_G1_scalarMul-(Integer, G1Element)G1Element
bls12_381_G1_neg-G1ElementG1Element
bls12_381_G1_equal-(G1Element, G1Element)Bool
bls12_381_G1_compress-G1Elementbytestring
bls12_381_G1_uncompress-bytestringG1Element
bls12_381_G1_hashToGroup-(Bytestring, Bytestring)G1Element
bls12_381_G2_add-(G2Element, G2Element)G2Element
bls12_381_G2_scalarMul-(Integer, G2Element)G2Element
bls12_381_G2_neg-G2ElementG2Element
bls12_381_G2_equal-(G2Element, G2Element)Bool
bls12_381_G2_compress-G2Elementbytestring
bls12_381_G2_uncompress-BytestringG2Element
bls12_381_G2_hashToGroup-(Bytestring, Bytestring)G2Element
bls12_381_millerLoop-(G1Element, G2Element)MillerLoopResult
bls12_381_mulMlResult-(MillerLoopResult, MillerLoopResult)MillerLoopResult
bls12_381_finalVerify-(MillerLoopResult, MillerLoopResult)Bool
trace(α)(string, (α))α

Footnotes

  1. Returns the second argument when the predicate is True, and the third argument when False.

  2. Each argument corresponds to each of the constructors of a builtin data (in this order): constr, map, list, integer and bytestring. The evaluation will continue with whatever branch actually corresponds to the given term value.

  3. Returns the second argument when the list is empty, and the third argument otherwise.

  4. Arguments are respectively: the public key, the message and the signature 2 3