Skip to contents

Creates a new stream on the blockchain. Streams are ordered collections of key‑value items that can be used for data storage, messaging, or other applications. The stream can be open (anyone can write) or restricted.

Usage

mc_create_stream(conn, name, open = TRUE, custom_fields = NULL)

Arguments

conn

A connection object created by mc_connect.

name

Character string. Name of the stream (must be unique).

open

Either a logical (TRUE for open stream, FALSE for restricted) or a list of parameters, e.g., list(restrict = "write"). For open streams, any address with send permission can publish. For restricted, only addresses with write permission on the stream can publish.

custom_fields

Optional list of custom fields (e.g., list(field1 = "value")).

Value

A character string containing the transaction ID (txid) of the stream creation.

Examples

if (FALSE) { # \dontrun{
# Create an open stream
txid <- mc_create_stream(conn, "mystream", open = TRUE)

# Create a restricted stream with custom fields
txid <- mc_create_stream(conn, "private", open = list(restrict = "write"),
                         custom_fields = list(owner = "admin"))
} # }