anchor

suspend fun <T : Any> anchor(data: T, serializer: KSerializer<T>, chainId: String): AnchorResult

Anchors data to a blockchain.

Example:

val anchor = blockchainService.anchor(
data = myData,
serializer = MyData.serializer(),
chainId = "algorand:testnet"
)
println("Anchored at: ${anchor.ref.txHash}")

Return

Anchor result with transaction reference

Parameters

data

The data to anchor

serializer

Kotlinx Serialization serializer for the data type

chainId

Blockchain chain identifier (CAIP-2 format)

Throws

if chain is not registered