Returns the owner's script of a name output: the output script behind the
name prefix.
The prefix is parsed like Namecoin's CNameScript: pushes up to the first
OP_DROP, OP_2DROP or OP_NOP, then any further OP_DROP, OP_2DROP or
OP_NOP. Pushes are read with their real length, so empty and one-byte
values do not shift the result. As in Doichain Core, the script is a non-name
script if the prefix holds an opcode that is not a push (such as OP_1 for a
value) or the wrong number of pushes for its operation: one for
OP_NAME_NEW, three for OP_NAME_FIRSTUPDATE, two for OP_NAME_UPDATE and
OP_NAME_DOI.
Parameters
script: Buffer
The output script.
Returns Buffer | undefined
The owner's script, or undefined if the script carries no name.
Example
constowner = nameops.nameScriptOwner(output); if (owner) console.log(address.fromOutputScript(owner, network));
Returns the owner's script of a name output: the output script behind the name prefix.
The prefix is parsed like Namecoin's
CNameScript: pushes up to the firstOP_DROP,OP_2DROPorOP_NOP, then any furtherOP_DROP,OP_2DROPorOP_NOP. Pushes are read with their real length, so empty and one-byte values do not shift the result. As in Doichain Core, the script is a non-name script if the prefix holds an opcode that is not a push (such asOP_1for a value) or the wrong number of pushes for its operation: one forOP_NAME_NEW, three forOP_NAME_FIRSTUPDATE, two forOP_NAME_UPDATEandOP_NAME_DOI.