SLP templates using libauth
mainnet-pat opened this issue · comments
Hi, @bitauth, thank you for your nice library.
I am trying to generate the SLP's OP_RETURN scripts using the libauth and would like to ask you for your feedback.
I've taken the USDT example from the SLP spec and was successful to reproduce the Genesis transaction.
The resulting script look's like this and its bytecode generation like this
Am i doing it the right way?
I am not really satisfied that I need to use the vm evaluations like $(<0x01 decimals>)
and manually fiddle with endianness and the need to introduce the new bigIntToBinUint64BE
method.
Thanks for your feedback in advance,
pat.
An update to our release candidate libauth template
Thanks in advance
Hey @mainnet-pat, thanks for opening an issue, and sorry to keep you waiting.
That usage looks great, and I'm impressed you made it so far with just the tsdocs! These are all very new ideas and APIs (feedback appreciated!) so there's not really a "right way" to do anything yet (I regularly discover new tricks myself). I'll try to offer some tips though:
- I think the effect of
bigIntToBinUint64BE
can be achieved with$(<your_number> <8> OP_NUM2BIN OP_REVERSEBYTES)
, though there's nothing wrong with your current solution (manipulating data before passing it to the compiler). - For e.g.
$(<0x01 g_decimals>)
, can you replace with just0x01 g_decimals
? Evaluations are useful for manipulating data using opcodes, but in this case, if I understand correctly(?), you just want to output0x01
followed by theg_decimals
value, no push-wrapping or modification. (I made a note here that this might be a good target for the IDE to auto-fix. Thanks!)
Thanks a lot Jason.
Omitting $(<>)
made the scripts look nice and sleek.
I stayed with data preparation outside of libauth template, since I am doing this anyway for other thins apart from big integers.