Bitcoin Forum
September 24, 2024, 12:37:25 PM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Implementing OP_MUL with OP_ADD  (Read 139 times)
RobinLinus (OP)
Newbie
*
Offline Offline

Activity: 20
Merit: 39


View Profile WWW
February 06, 2020, 10:58:56 AM
Last edit: February 06, 2020, 11:09:44 AM by RobinLinus
Merited by ABCbits (1)
 #1

For fun I implemented OP_MUL using OP_ADD. You can find the code here on Github.

Feedback very appreciated!

And I have a question: do you guys know any good source for advanced bitcoin scripts? Is there something like a library for scripts?
pooya87
Legendary
*
Offline Offline

Activity: 3584
Merit: 10898



View Profile
February 06, 2020, 02:19:35 PM
Merited by ABCbits (1)
 #2

Quote
The result of a * b must fit into a signed 32-bit integer.
generally speaking result of all arithmetic operations can overflow that is why the result is always a 64-bit integer. the only rule is that the value that is popped to be evaluated as an integer can not be bigger than 32-bit.

you should also add some explanation about your OP_MUL, it is not easy to figure out.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!