@venezia is on PowPing!

PowPing is a place where you can earn Bitcoin simply by socializing, for FREE.
Never tried Bitcoin? It's OK! Just come, socialize, and earn Bitcoin.
Check out venezia's activities
Total Economy: 0.24 USD
Puzzle time: if x = OP_0, what is a valid unlock script of this contract? The first right answer will get 0.08$ 👀 ``` contract DemoMultiPublic { int x; constructor(int x) { this.x = x; } public function equal(int y) { require(y == this.x); } public function smaller(int y) { require(y < this.x); } public function larger(int y) { require(y > this.x); } } ```
unwriter tipped:
0.03 USD
4 days ago
math is hard this time
OP_1 OP_1NEGATE OP_0 Never actually read or used sCrypt (YET), so this is just best guess at what's going on here (and using Venezia's hint)
venezia tipped:
0.02 USD
4 days ago
venezia replied:
Very close, but can't pass at https://scrypt.studio/ .
venezia replied:
It looks like a correct answer for me. Don't know if is a bug of scrypt.sudio ?@xhliu
john replied:
It could be because it's backwards. I wrote it in the order that it would go into the stack. So OP_0 comes out first, even tho it looks like it comes out last. But I"m not sure how the IDE works. In other words, OP_1 goes into the stack first, but OP_1NEGATE would push that down lower, and when the script is fun, the first thing coming out of the stack would be OP_0. But maybe sCrypt does it the other way around?
venezia tipped:
0.01 USD
4 days ago
john replied:
I tried to run the code, but completely lost. Unfortunately. Can speaka un poco scripting lang, but obviously can't "write" it. LOL.
venezia replied:
Oh, I figured out. OP_1NEGATE is a function that take 1 parameter and return the negative, just like `(x) => { -x }` .
john replied:
Oh, ok, I though that's how it worked initially, and then I read it again and it really looked like it was just -1. So new answer would be: OP_1 OP_1 OP_1NEGATE OP_0
john replied:
whoops, nope: OP_1 OP_1NEGATE OP_1 OP_0
unwriter tipped:
0.02 USD
4 days ago
venezia replied:
Sorry, I did a mistake. There are two different opcodes: OP_1NEGATE (push -1 on stack), and OP_NEGATE (flip the sign)
unwriter tipped:
0.02 USD
4 days ago
john tipped:
0.01 USD
4 days ago
unwriter replied:
Wow there's a live hackathon going on in this thread
venezia replied:
So your origin answer should works. I think it's a bug of sCrypt.
venezia replied:
After reading the scrypt documentation carefully, I found that I completely misunderstood how it works. > In this case, the last operator of scriptSig has to be the index of the public function called, starting from 1. For example, if public function larger is called, scriptSig of y 3 can fulfill the contract below, in which 3 is the public function index. https://scryptdoc.readthedocs.io/en/latest/intro.html#multiple-public-functions.
john replied:
I'll just leave humbly-- having learned the difference between 1NEGATE and NEGATE is enough for me in one day! LOL. when I need to really use this stuff in the not-so-distant future, I'll dive deeper. But your thread was definitely worthwhile.
john replied:
Yeah, so the "contract" is like a "struct" in Swift language (what I speak), as you get the initializer ("construct") for free; whereas in Swift "classes" require a specifically written initializer. Still not sure how sCrypt works exactly, but first you'd need to call Test, like Test(0) to set x = 0 (or this.x, with "this" being equivalent in Swift to "self"). THEN, the the Test has 3 functions (or methods) which can be called: equals, larger, smaller. So if you simply call Test.equal(0) this would meet the TRUE requirement for "require" and the condition would be met. If you used Test.larger(1) then this would also pass, as 1 > 0. Finally, Test.smaller(-1) would also pass. However, it appears as tho you aren't supposed to call the functions as I did above (the Swifty way), but call them with an index where 1 = equals, 2 = smaller, and 3 => larger. So a solution would be something like "0 1" where 0 goes into the stack as "y" and "1" calls "equals" to see if 0 == 0. Final, and still not sure, answer: OP_0 OP_1. So Solval was right all along!
venezia tipped:
0.01 USD
4 days ago
Since there are three functions. Equal needs 0 as input Smaller needs any number less than 0 Larger needs any number greater zero. Check it out at https://scrypt.studio
venezia tipped:
0.01 USD
4 days ago
OP_0 OP_1
venezia tipped:
0.02 USD
4 days ago
venezia tipped:
0.09 USD
4 days ago
solval replied:
OP_1 OP_3 also works. But I don't know how to give a negative number for the 2nd public function.
solval replied:
got it. OP_1NEGATE OP_2
joe tipped:
0.06 USD
4 days ago
venezia replied:
"OP_0 OP_3 OP_1NEGATE OP_2" is a right answer! 🎆
137
Any number?
venezia tipped:
0.01 USD
4 days ago
venezia replied:
hint: three numbers are required to meet the three constraints
snugg replied:
for some reason, i thought it acted like an "or", where just 1 needed to pass
42
venezia tipped:
0.01 USD
4 days ago
Where's the translate button functionality when you need it! ;) (says the non coder)
venezia tipped:
0.01 USD
4 days ago
Is this all the code there is? The methods seem to be just for comparison, as far as I can see. Also, what language is this?
venezia tipped:
0.01 USD
4 days ago
venezia replied:
Yes, just comparison. I wanna start from the easiest. :) It's scrypt. Here is more info https://www.scrypt.io/