Skip to content

Commit 37dd375

Browse files
committed
OutputScriptFactory: add method for taproot output scripts
1 parent 6048fc8 commit 37dd375

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Script/Factory/OutputScriptFactory.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,12 @@ public function witnessCoinbaseCommitment(BufferInterface $commitment): ScriptIn
193193
new Buffer("\xaa\x21\xa9\xed" . $commitment->getBinary())
194194
]);
195195
}
196+
197+
public function taproot(BufferInterface $key32): ScriptInterface
198+
{
199+
if ($key32->getSize() !== 32) {
200+
throw new \RuntimeException('Taproot key should be 32 bytes');
201+
}
202+
return ScriptFactory::sequence([Opcodes::OP_1, $key32]);
203+
}
196204
}

0 commit comments

Comments
 (0)