Skip to contents

Sends a transaction that includes arbitrary data (metadata) attached to the output. The data can be text, JSON, or any binary data (hex‑encoded). This is useful for storing small amounts of information on the blockchain.

Usage

mc_send_with_data(conn, address, amounts, data)

Arguments

conn

A connection object created by mc_connect.

address

Character string. Recipient address.

amounts

Either a numeric value (native) or a named list of assets.

data

Data to embed. Can be a character string (will be hex‑encoded), a list (will be converted to JSON then hex), or raw binary (not directly). The function automatically converts lists to JSON and then to hex.

Value

A character string containing the transaction ID.

Examples

if (FALSE) { # \dontrun{
# Send with a text note
txid <- mc_send_with_data(conn, "1A...", 0.1, "Hello, blockchain!")

# Send with structured JSON metadata
metadata <- list(id = 123, action = "transfer", tag = "payment")
txid <- mc_send_with_data(conn, "1A...", list(myasset = 10), metadata)
} # }