Skip to content

JuLC API Reference

This document covers all supported Java operations in the JuLC compiler, the standard library functions, and the typed ledger access API.

Java TypeUPLC RepresentationNotes
int, long, BigIntegerIntegerAll mapped to arbitrary-precision integers
booleanBool (Constr 0/1)false = Constr(0,[]), true = Constr(1,[])
byte[]ByteStringRaw bytes
StringString (UTF-8)Converted via EncodeUtf8/DecodeUtf8
PlutusDataDataOpaque on-chain data
List<T>, JulcList<T>BuiltinListBuiltin list of Data
Map<K,V>, JulcMap<K,V>BuiltinList(Pair)Map encoded as list of pairs
Optional<T>Constr 0/1Some = Constr(0,[x]), None = Constr(1,[])
Tuple2<A,B>Constr(0, [a, b])Generic pair with auto-unwrap
Tuple3<A,B,C>Constr(0, [a, b, c])Generic triple with auto-unwrap
RecordsConstr(0, fields)Each field is a Data element
Sealed interfacesConstr(tag, fields)Tag based on permit order
@NewType recordsUnderlying typeZero-cost alias (identity on-chain)
PubKeyHash, PolicyId, TokenName, TxId, ScriptHash, ValidatorHash, DatumHashByteStringLedger hash types
ValueMap(Pair)Named RecordType with instance methods
JulcArray<T> (PV11)BuiltinArrayO(1) random access array (CIP-156). PV11+ only

JulcList<T> and JulcMap<K,V> are interfaces in julc-core/types/ that resolve to the same ListType/MapType as List/Map. They provide IDE autocomplete for on-chain methods (.contains(), .size(), .get(), etc.).

JulcList<PubKeyHash> signers = txInfo.signatories(); // typed list of PubKeyHash
JulcMap<Credential, BigInteger> withdrawals = txInfo.withdrawals();

Protocol Version 11+ only. Arrays use CIP-156 builtins and are not available on PV10 networks.

JulcArray<T> is an immutable array interface providing O(1) random access on-chain. Create from a list via list.toArray() or JulcArray.fromList(list).

JulcList<BigInteger> list = ...;
JulcArray<BigInteger> arr = list.toArray(); // ListToArray builtin
BigInteger elem = arr.get(0); // IndexArray builtin (O(1))
long len = arr.length(); // LengthOfArray builtin

Off-chain: backed by JulcArrayImpl, wrapping java.util.List with O(1) index access.

Generic tuples with auto-unwrapping field access based on type arguments.

Tuple2<BigInteger, byte[]> result = MathLib.divMod(a, b);
BigInteger quotient = result.first(); // auto-generates UnIData
byte[] remainder = result.second(); // auto-generates UnBData
// Construction auto-wraps
var t = new Tuple2<BigInteger, BigInteger>(val1, val2); // auto-wraps via IData

Raw Tuple2 (no type args) defaults to DataType for backward compatibility. Tuple2/Tuple3 are not switchable (registered as RecordType, but switch requires SumType). Use field access instead.

Zero-cost type aliases for single-field records with a supported underlying type (byte[], BigInteger, String, boolean).

@NewType
public record AssetClass(byte[] policyId) {}
// On-chain: identity (no ConstrData wrap)
// AssetClass.of(bytes) is auto-registered

Seven ledger hash types have .of(byte[]) factory methods:

TypeUsageOn-chain
PubKeyHash.of(bytes)Create from raw bytesIdentity
ScriptHash.of(bytes)Identity
ValidatorHash.of(bytes)Identity
PolicyId.of(bytes)Identity
TokenName.of(bytes)Identity
DatumHash.of(bytes)Identity
TxId.of(bytes)Identity

These replace the ugly (PubKeyHash)(Object) bytes casts in user code.

SignatureOn-chainOff-chain
PlutusData.cast(data, TargetType.class)Identity (zero cost)Unchecked cast

Replaces the (TargetType)(Object) data double-cast pattern. Works with records, sealed interfaces, ledger types, JulcMap, byte[], and hash types. The second argument must be a literal ClassName.class expression.

For generic collections (JulcList, JulcMap), use an explicit type declaration to preserve element types:

JulcList<MyRecord> items = PlutusData.cast(data, JulcList.class); // element type: MyRecord
JulcMap<BigInteger, MyRecord> m = PlutusData.cast(data, JulcMap.class); // typed keys + values
var items2 = PlutusData.cast(data, JulcList.class); // element type: DataType (avoid)

float, double, char, arrays (T[] — use JulcArray<T> on PV11+ or List<T>), null, collections other than List/Map/Optional/JulcArray, generic classes, inheritance (use sealed interfaces instead).

OperatorJava ExampleUPLC BuiltinNotes
+a + bAddIntegerFor BigInteger/int/long operands
+s1 + s2AppendStringFor String operands
+b1 + b2AppendByteStringFor byte[] operands
-a - bSubtractInteger
*a * bMultiplyInteger
/a / bDivideInteger
%a % bRemainderInteger

The + operator is type-aware: the compiler infers the operand type and dispatches to the correct builtin.

OperatorJava ExampleUPLC BuiltinNotes
==a == bEqualsIntegerFor BigInteger/int/long (default)
==s1 == s2EqualsStringFor String operands
==b1 == b2EqualsByteStringFor byte[] operands
==d1 == d2EqualsDataFor PlutusData, records, sealed interfaces
==x == yIfThenElseFor boolean operands
!=a != bnegated equalitySame type dispatch as ==
<a < bLessThanInteger
<=a <= bLessThanEqualsInteger
>a > bLessThanInteger (swapped)
>=a >= bLessThanEqualsInteger (swapped)
OperatorJava ExampleUPLC Translation
&&a && bIfThenElse(a, b, false) (short-circuit)
||a || bIfThenElse(a, true, b) (short-circuit)
!!aIfThenElse(a, false, true)
if (condition) {
return x;
} else {
return y;
}
return condition ? x : y;

Switch Pattern Matching (Sealed Interfaces)

Section titled “Switch Pattern Matching (Sealed Interfaces)”
sealed interface Action permits Deposit, Withdraw {}
record Deposit(BigInteger amount) implements Action {}
record Withdraw(BigInteger amount) implements Action {}
// In validator:
return switch (action) {
case Deposit d -> d.amount() > 0;
case Withdraw w -> w.amount() > 0 && hasSigner;
};

Switch expressions check exhaustiveness at compile time. All variants of the sealed interface must be covered. The default -> branch can be used as a catch-all for uncovered variants, but prefer explicit cases for clarity.

if (action instanceof Deposit d) {
return d.amount() > 0;
}
boolean found = false;
for (var item : list) {
if (item == target) {
found = true;
}
}

Desugared to a recursive fold. Supports single/multi-accumulator, break, and nesting. See For-Loop Patterns.

BigInteger sum = 0;
BigInteger i = 0;
while (i < 10) {
sum = sum + i;
i = i + 1;
}

Desugared to tail-recursive call via Z-combinator.

C-style for(;;), do-while, try-catch-finally, throw, continue.

All variables are immutable (functional semantics). Reassignment is only supported inside for-each and while loop bodies (accumulator pattern).

// OK
BigInteger x = 42;
var y = x + 1;
// NOT OK - assignment not supported
x = x + 1;

The var keyword is supported and types are inferred from the initializer.

Records compile to Constr-encoded Data with fields in declaration order.

record VestingDatum(byte[] beneficiary, BigInteger deadline) {}
// Construction
var datum = new VestingDatum(pkh, 1000);
// Field access
byte[] b = datum.beneficiary();
BigInteger d = datum.deadline();

Static methods in the validator class (without @Entrypoint) are compiled as helper functions. Recursive helper methods use Z-combinator transformation.

@SpendingValidator
class MyValidator {
static boolean isPositive(BigInteger x) {
return x > 0;
}
@Entrypoint
static boolean validate(BigInteger redeemer, PlutusData ctx) {
return isPositive(redeemer);
}
}
ListsLib.any(list, x -> x > 0)
ListsLib.filter(list, x -> Builtins.unIData(x) > 100)
ListsLib.foldl((acc, x) -> acc + Builtins.unIData(x), BigInteger.ZERO, list)

Lambda bodies can be a single expression or a block:

ListsLib.filter(items, item -> {
var threshold = new BigInteger("100");
return Builtins.unIData(item) > threshold;
});

Equivalent instance method syntax (lambda types auto-inferred):

list.any(x -> x.compareTo(BigInteger.ZERO) > 0)
list.filter(x -> Builtins.unIData(x).compareTo(BigInteger.valueOf(100)) > 0)
// foldl is only available as ListsLib.foldl (no instance method)

When using ScriptContext as a parameter type, the compiler provides typed access to all ledger fields without manual Data decoding.

@Entrypoint
static boolean validate(MyDatum datum, PlutusData redeemer, ScriptContext ctx) {
TxInfo txInfo = ctx.txInfo();
PlutusData redeemer2 = ctx.redeemer();
ScriptInfo scriptInfo = ctx.scriptInfo();
// ...
}
MethodReturn TypeField IndexDescription
txInfo.inputs()List<TxInInfo>0Transaction inputs
txInfo.referenceInputs()List<TxInInfo>1Reference inputs
txInfo.outputs()List<TxOut>2Transaction outputs
txInfo.fee()BigInteger3Transaction fee (lovelace)
txInfo.mint()Value4Minted/burned value
txInfo.certificates()JulcList<TxCert>5Certificates
txInfo.withdrawals()JulcMap<Credential, BigInteger>6Reward withdrawals
txInfo.validRange()Interval7Validity time range
txInfo.signatories()JulcList<PubKeyHash>8Required signers
txInfo.redeemers()JulcMap<ScriptPurpose, PlutusData>9All redeemers
txInfo.datums()JulcMap<DatumHash, PlutusData>10Datum hash map
txInfo.txId()TxId11Transaction hash
txInfo.votes()JulcMap<Voter, JulcMap<GovernanceActionId, Vote>>12Governance votes
txInfo.proposalProcedures()JulcList<ProposalProcedure>13Proposal procedures
txInfo.currentTreasuryAmount()Optional<BigInteger>14Current treasury
txInfo.treasuryDonation()Optional<BigInteger>15Treasury donation
  • TxInInfo: outRef() (TxOutRef), resolved() (TxOut)
  • TxOut: address() (Address), value() (Value), datum() (OutputDatum), referenceScript() (Optional)
  • TxOutRef: txId() (byte[]), outputIndex() (BigInteger)
  • Address: credential() (Credential), stakingCredential() (Optional)
  • Credential: sealed interface with PubKeyCredential(byte[] hash) and ScriptCredential(byte[] hash)
  • OutputDatum: sealed interface with NoOutputDatum, OutputDatumHash(byte[]), OutputDatum(PlutusData)
  • ScriptInfo: sealed interface with MintingScript(byte[]), SpendingScript(TxOutRef, Optional), RewardingScript(Credential), CertifyingScript(BigInteger, TxCert), VotingScript(Voter), ProposingScript(BigInteger, ProposalProcedure)
  • Interval: from() (IntervalBound), to() (IntervalBound)
  • IntervalBound: boundType() (IntervalBoundType), isInclusive() (boolean)
  • IntervalBoundType: sealed with NegInf, Finite(BigInteger), PosInf
// Full typed chain from context to list methods
boolean hasSigner = ctx.txInfo().signatories().contains(datum.beneficiary());
MethodReturn TypeUPLC Translation
.abs()BigIntegerIfThenElse(x < 0, 0 - x, x)
.negate()BigIntegerSubtractInteger(0, x)
.max(other)BigIntegerIfThenElse(a < b, b, a)
.min(other)BigIntegerIfThenElse(a <= b, a, b)
.equals(other)booleanEqualsInteger
.add(other)BigIntegerAddInteger
.subtract(other)BigIntegerSubtractInteger
.multiply(other)BigIntegerMultiplyInteger
.divide(other)BigIntegerDivideInteger
.remainder(other)BigIntegerRemainderInteger
.mod(other)BigIntegerModInteger
.signum()BigIntegerIfThenElse chain
.compareTo(other)BigIntegerIfThenElse chain
.intValue()intIdentity
.longValue()longIdentity
MethodReturn TypeDescription
.isEmpty()booleanReturns true if empty
.size()BigIntegerReturns the number of elements
.head()TReturns the first element (decoded)
.tail()List<T>Returns the list without the first element
.get(index)TReturns element at index (decoded)
.contains(target)booleanRecursive search with type-aware equality
.reverse()List<T>Returns a reversed copy
.concat(other)List<T>Concatenates two lists
.take(n)List<T>Returns first n elements
.drop(n)List<T>Returns list after dropping first n elements
.prepend(elem)List<T>Prepends element with auto-wrap (BigInteger->IData, byte[]->BData, etc.)
.map(f)JulcList<PlutusData>Apply function to each element (wraps results to Data)
.filter(pred)JulcList<T>Keep elements matching predicate
.any(pred)booleanTrue if any element matches
.all(pred)booleanTrue if all elements match
.find(pred)TFirst matching element (error if none)

Chaining is supported: sigs.tail().isEmpty(), sigs.tail().contains(pkh).

foldl is only available as a static call (ListsLib.foldl), not as an instance method.

MethodReturn TypeDescription
.get(key)Optional<V>Lookup value by key
.containsKey(key)booleanCheck if key exists
.size()BigIntegerNumber of entries
.isEmpty()booleanTrue if no entries
.keys()List<K>All keys as list
.values()List<V>All values as list
.insert(key, value)Map<K,V>Insert/update entry (returns pair list)
.delete(key)Map<K,V>Remove entry (returns pair list)

MapType variables always hold pair lists internally. insert and delete return pair lists (not MapData-wrapped).

MethodReturn TypeDescription
.lovelaceOf()BigIntegerExtract ADA amount
.isEmpty()booleanTrue if value is empty
.assetOf(policy, token)BigIntegerExtract specific token amount

Caveat: value.assetOf(policyId, tokenName) uses EqualsData internally. If policyId/tokenName are byte[] (ByteStringType), wrap with Builtins.bData() before passing.

MethodReturn TypeDescription
.key()KFirst element with auto-decode
.value()VSecond element with auto-decode
MethodReturn TypeUPLC Translation
.equals(other)booleanEqualsString
.length()BigIntegerLengthOfByteString(EncodeUtf8(s))
MethodReturn TypeUPLC Translation
.equals(other)booleanEqualsByteString
.length()BigIntegerLengthOfByteString
.lengthBigIntegerLengthOfByteString (field access form)
.hash()byte[]UnBData (for list iteration context)
MethodReturn TypeDescription
.isPresent()booleanTrue if Some (tag == 0)
.isEmpty()booleanTrue if None (tag == 1)
.get()TUnwrap the inner value (decoded)

Raw PlutusData variables support .equals() and ==/!= operators using EqualsData.

Import from com.bloxbean.cardano.julc.stdlib.lib.* in validators. See Standard Library Guide for comprehensive documentation.

MethodArgsDescription
signedBy(txInfo, pkh)TxInfo, ByteStringCheck if pkh is in signatories
getTxInfo(ctx)ScriptContextExtract TxInfo (legacy — prefer ctx.txInfo())
getRedeemer(ctx)ScriptContextExtract redeemer
getSpendingDatum(ctx)ScriptContextExtract optional spending datum
txInfoInputs(txInfo)TxInfoGet inputs list
txInfoOutputs(txInfo)TxInfoGet outputs list
txInfoSignatories(txInfo)TxInfoGet signatories list
txInfoValidRange(txInfo)TxInfoGet validity time range
txInfoMint(txInfo)TxInfoGet minted/burned value
txInfoFee(txInfo)TxInfoGet transaction fee
txInfoId(txInfo)TxInfoGet transaction hash
txInfoRefInputs(txInfo)TxInfoGet reference inputs
txInfoWithdrawals(txInfo)TxInfoGet withdrawals map
txInfoRedeemers(txInfo)TxInfoGet redeemers map
findOwnInput(ctx)ScriptContextFind the input being validated → Optional<TxInInfo>
getContinuingOutputs(ctx)ScriptContextGet outputs to same script → JulcList<TxOut>
ownInputScriptHash(ctx)ScriptContextGet script hash of own input → byte[]
findDatum(txInfo, datumHash)TxInfo, ByteStringLookup datum by hash
valueSpent(txInfo)TxInfoTotal value of all inputs
valuePaid(txInfo, address)TxInfo, AddressValue paid to an address
ownHash(scriptInfo)ScriptInfoGet own script hash
scriptOutputsAt(txInfo, hash)TxInfo, ByteStringOutputs at script hash
listIndex(list, index)List, IntegerGet element at index
trace(msg)StringEmit trace message
MethodArgsDescription
isEmpty(list)ListCheck if list is empty
length(list)ListCount elements
head(list)ListFirst element
tail(list)ListRest of list
reverse(list)ListReverse a list
concat(a, b)List, ListConcatenate two lists
nth(list, n)List, IntegerGet element at index
take(list, n)List, IntegerFirst n elements
drop(list, n)List, IntegerDrop first n elements
contains(list, elem)List, DataCheck membership (EqualsData)
containsInt(list, n)List, IntegerCheck integer membership
containsBytes(list, bs)List, ByteStringCheck bytestring membership
hasDuplicateInts(list)ListCheck for duplicate integers
hasDuplicateBytes(list)ListCheck for duplicate bytestrings
empty()(none)Create empty list
prepend(elem, list)Data, ListPrepend element to list
any(list, pred)List, LambdaTrue if any element matches
all(list, pred)List, LambdaTrue if all elements match
find(list, pred)List, LambdaFind first matching (Optional)
foldl(f, init, list)Lambda, init, ListLeft fold
map(list, f)List, LambdaTransform elements
filter(list, pred)List, LambdaKeep matching elements
zip(a, b)List, ListPair elements from two lists
MethodArgsDescription
geqMultiAsset(a, b)Value, ValueMulti-asset >= comparison
leq(a, b)Value, ValueMulti-asset <= comparison
eq(a, b)Value, ValueMulti-asset equality
isZero(value)ValueCheck if value is zero
singleton(policy, token, amount)BS, BS, IntegerCreate single-token value
negate(value)ValueNegate all amounts
flatten(value)ValueFlatten to list of triples
flattenTyped(value)ValueFlatten to typed JulcList<AssetEntry>
add(a, b)Value, ValueAdd two values
subtract(a, b)Value, ValueSubtract values
countTokensWithQty(mint, policy, qty)Value, BS, IntegerCount tokens with exact quantity under policy
findTokenName(mint, policy, qty)Value, BS, IntegerFind token name with exact quantity under policy
MethodArgsDescription
lookup(map, key)Map, DataLookup value by key
member(map, key)Map, DataCheck key membership
insert(map, key, value)Map, Data, DataInsert/update entry
delete(map, key)Map, DataRemove entry by key
keys(map)MapGet all keys
values(map)MapGet all values
toList(map)MapConvert to pair list
fromList(list)ListConvert pair list to map
size(map)MapCount entries
MethodArgsDescription
txOutAddress(txOut)TxOutGet output address
txOutValue(txOut)TxOutGet output value
txOutDatum(txOut)TxOutGet output datum
outputsAt(outputs, address)List, AddressFilter outputs by address
countOutputsAt(outputs, addr)List, AddressCount outputs at address
uniqueOutputAt(outputs, addr)List, AddressGet exactly one output at address
outputsWithToken(outs, pol, tn)List, BS, BSFilter by token
valueHasToken(val, pol, tn)Value, BS, BSCheck if value has token
lovelacePaidTo(outputs, addr)List, AddressTotal lovelace to address
paidAtLeast(outs, addr, min)List, Address, IntegerCheck minimum payment
getInlineDatum(txOut)TxOutGet inline datum
resolveDatum(txOut, datumsMap)TxOut, MapResolve datum (inline or by hash)
findOutputWithToken(outputs, scriptHash, policy, token)List, BS, BS, BSFind output at script address with specific token
findInputWithToken(inputs, scriptHash, policy, token)List, BS, BS, BSFind input at script address with specific token
MethodArgsDescription
abs(x)IntegerAbsolute value
max(a, b)Integer, IntegerMaximum
min(a, b)Integer, IntegerMinimum
pow(base, exp)Integer, IntegerExponentiation
sign(x)IntegerSign (-1, 0, or 1)
divMod(a, b)Integer, IntegerReturns Tuple2(quotient, remainder)
quotRem(a, b)Integer, IntegerReturns Tuple2(quotient, remainder)
expMod(base, exp, mod)Integer, Integer, IntegerModular exponentiation
MethodArgsDescription
between(interval, lower, upper)Interval, Integer, IntegerCheck if interval is within bounds
never()(none)Empty interval
isEmpty(interval)IntervalCheck if interval is empty
finiteUpperBound(interval)IntervalExtract upper bound (if finite)
finiteLowerBound(interval)IntervalExtract lower bound (if finite)
MethodArgsDescription
verifyEcdsaSecp256k1(key, msg, sig)BS, BS, BSVerify ECDSA secp256k1 signature
verifySchnorrSecp256k1(key, msg, sig)BS, BS, BSVerify Schnorr secp256k1 signature
ripemd_160(bs)BSRIPEMD-160 hash

Note: sha2_256, sha3_256, blake2b_256, blake2b_224, keccak_256, and verifyEd25519Signature are available directly via Builtins.*.

MethodArgsDescription
take(bs, n)BS, IntegerTake first n bytes
lessThan(a, b)BS, BSLexicographic less-than
lessThanEquals(a, b)BS, BSLexicographic less-than-or-equal
integerToByteString(be, w, i)Bool, Integer, IntegerInteger to byte string
byteStringToInteger(be, bs)Bool, BSByte string to integer
at(bs, index)BS, IntegerGet byte at index
cons(byte_, bs)Integer, BSPrepend a byte
slice(bs, start, length)BS, Integer, IntegerExtract a slice
length(bs)BSLength of bytestring
drop(bs, n)BS, IntegerDrop first n bytes
append(a, b)BS, BSConcatenate two bytestrings
empty()(none)Empty bytestring
zeros(n)IntegerBytestring of n zero bytes
equals(a, b)BS, BSEquality check
encodeUtf8(s)StringEncode string to UTF-8 bytes
decodeUtf8(bs)BSDecode UTF-8 bytes to string
serialiseData(d)DataSerialize data to CBOR bytes
hexNibble(n)IntegerConvert nibble (0-15) to hex ASCII code
toHex(bs)BSConvert bytestring to hex-encoded bytestring
intToDecimalString(n)IntegerConvert integer to decimal digit bytestring
utf8ToInteger(bs)BSParse UTF-8 decimal string to integer
MethodArgsDescription
andByteString(pad, a, b)Bool, BS, BSBitwise AND
orByteString(pad, a, b)Bool, BS, BSBitwise OR
xorByteString(pad, a, b)Bool, BS, BSBitwise XOR
complementByteString(bs)BSBitwise complement
readBit(bs, index)BS, IntegerRead single bit
writeBits(bs, indices, val)BS, List, BoolWrite bits at indices
shiftByteString(bs, n)BS, IntegerShift by n bits
rotateByteString(bs, n)BS, IntegerRotate by n bits
countSetBits(bs)BSCount set (1) bits
findFirstSetBit(bs)BSIndex of first set bit
MethodArgsDescription
credentialHash(cred)CredentialExtract hash from credential
isScriptAddress(addr)AddressTrue if script address
isPubKeyAddress(addr)AddressTrue if pub key address
paymentCredential(addr)AddressExtract payment credential

BLS12-381 elliptic curve operations. Available on PV10+. See Standard Library Guide for full documentation.

MethodArgsDescription
g1Add(a, b)G1, G1Add two G1 elements
g1Neg(a)G1Negate a G1 element
g1ScalarMul(scalar, g1)Integer, G1Scalar multiplication of G1
g1Equal(a, b)G1, G1Check G1 equality
g1Compress(g1) / g1Uncompress(bs)G1 / BSG1 compression
g1HashToGroup(msg, dst)BS, BSHash to G1
g2Add, g2Neg, g2ScalarMul, g2Equal, g2Compress, g2Uncompress, g2HashToGroupG2 equivalents
millerLoop(g1, g2)G1, G2Compute Miller loop pairing
mulMlResult(a, b)ML, MLMultiply two Miller loop results
finalVerify(a, b)ML, MLFinal pairing verification
g1MultiScalarMul(scalars, points)List, ListMulti-scalar multiplication on G1
g2MultiScalarMul(scalars, points)List, ListMulti-scalar multiplication on G2

Protocol Version 11+ only. Native MaryEra Value operations via CIP-153 builtins. For PV10 networks, use ValuesLib. See Standard Library Guide for full documentation.

MethodArgsDescription
insertCoin(policy, token, amount, value)BS, BS, Integer, ValueInsert/update token quantity
lookupCoin(policy, token, value)BS, BS, ValueLook up token quantity (0 if absent)
union(a, b)Value, ValueMerge two Values by adding quantities
contains(a, b)Value, ValueCheck a >= b element-wise
scale(scalar, value)Integer, ValueScale all quantities
fromData(mapData)DataConvert Map-encoded PlutusData to native Value
toData(value)ValueConvert native Value back to Map encoding
AnnotationTargetDescription
@SpendingValidatorClassSingle-purpose spending validator
@MintingValidatorClassSingle-purpose minting validator
@WithdrawValidatorClassSingle-purpose withdrawal validator
@CertifyingValidatorClassSingle-purpose certifying validator
@VotingValidatorClassSingle-purpose voting validator
@ProposingValidatorClassSingle-purpose proposing validator
@MultiValidatorClassMulti-purpose validator (handles multiple script purposes)
@EntrypointMethodMarks the validator entrypoint method
@Entrypoint(purpose = Purpose.MINT)MethodPurpose-specific entrypoint for multi-validators
@ParamFieldParameterized field applied at deployment
@OnchainLibraryClassReusable library class (auto-discovered from classpath)
@NewTypeClassZero-cost type alias for single-field records

The Purpose enum controls dispatch in @MultiValidator classes:

ValueScriptInfo TagDescription
Purpose.DEFAULTManual dispatch (user switches on ScriptInfo)
Purpose.MINT0MintingScript
Purpose.SPEND1SpendingScript
Purpose.WITHDRAW2RewardingScript
Purpose.CERTIFY3CertifyingScript
Purpose.VOTE4VotingScript
Purpose.PROPOSE5ProposingScript

Type-safe evaluator for testing individual on-chain methods without a full ScriptContext.

Factory methods:

MethodDescription
JulcEval.forClass(Class<?>)Load source from src/main/java
JulcEval.forClass(Class<?>, Path)Load source from custom root
JulcEval.forSource(String)Use inline Java source

Proxy mode:

var proxy = JulcEval.forClass(MyHelper.class).create(MyInterface.class);

Fluent call mode:

var result = JulcEval.forClass(MyHelper.class).call("methodName", arg1, arg2);

CallResult extraction:

MethodReturn Type
.asInteger()BigInteger
.asLong()long
.asInt()int
.asByteString()byte[]
.asBoolean()boolean
.asString()String
.asData()PlutusData
.asOptional()Optional<PlutusData>
.asList()List<PlutusData>
.as(Class<T>)T
.auto()Object
.rawTerm()Term

Supported argument types: BigInteger, int, long, boolean, byte[], String, PlutusData, PlutusDataConvertible

import com.bloxbean.cardano.julc.onchain.annotation.*;
import com.bloxbean.cardano.julc.onchain.ledger.*;
import com.bloxbean.cardano.julc.core.PlutusData;
import java.math.BigInteger;
@SpendingValidator
class VestingValidator {
record VestingDatum(byte[] beneficiary, BigInteger deadline) {}
@Entrypoint
static boolean validate(VestingDatum datum, PlutusData redeemer, ScriptContext ctx) {
TxInfo txInfo = ctx.txInfo();
boolean hasSigner = txInfo.signatories().contains(datum.beneficiary());
boolean pastDeadline = datum.deadline() > 0;
return hasSigner && pastDeadline;
}
}