The name, at most MAX_NAME_LENGTH bytes.
The value, at most MAX_VALUE_LENGTH bytes. It may be empty.
The output script of the holder.
The name output script.
const output = nameops.nameDoiScript(
name.normalize('NFC'),
value,
address.toOutputScript(holderAddress, networks.doichain),
);
psbt.setVersion(0x7100);
psbt.addOutput({ script: output, value: 1_000_000 });
TypeError if the name or the value is too long, or if the owner's script is empty or carries a name itself.
Returns the output script of an
OP_NAME_DOIoperation, which registers, transfers or updates a name on Doichain:OP_NAME_DOI <name> <value> OP_2DROP OP_DROP <owner's script>.Name and value are pushed with their length in bytes, never as a number opcode, so an empty value or a one-byte value such as
0x05still makes a name script. Strings are encoded as UTF-8 exactly as given: normalize a name the way your application registers names (for example withname.normalize('NFC')).The owner's script decides who holds the name. Build it from an address with
address.toOutputScript(address, networks.doichain), which also checks the network and the address type.Psbtsigns name inputs held by P2PKH and P2WPKH scripts. A transaction with a name output needs version0x7100: set it before anybody signs.