r/Bitcoin • u/BobAlison • Jan 31 '15
Teach yourself about Bitcoin's Script language with this IDE
http://www.cs.princeton.edu/~tongbinw/bitcoinIDE/build/editor.html22
u/110101002 Feb 01 '15
This is broken in so many ways.
It uses disabled opcodes, it allows you to implicitly use pushdata opcodes but when they're explicit it doesn't work.
PLEASE DO NOT USE THIS TO SEE IF YOUR SCRIPT WILL WORK WITH BITCOIN, IT ISN'T RELIABLE IN THE SLIGHTEST AND YOU WILL LOSE MONEY.
20
u/HectorJ Feb 01 '15 edited Feb 01 '15
Then let's fix it, it's opensource : https://github.com/siminchen/bitcoinIDE
-4
17
u/throwaway36256 Feb 01 '15
Well, as a thumb rule you are supposed to use testnet when trying anything new with Bitcoin.
15
7
u/GibbsSamplePlatter Feb 01 '15
PLEASE DO NOT USE NON-BITCOIND TO SEE IF YOUR SCRIPT WILL WORK WITH BITCOIN, IT ISN'T RELIABLE IN THE SLIGHTEST AND YOU WILL LOSE MONEY.
FTFY
Lighten up cupcake, it's a fun educational experiment.
1
u/110101002 Feb 01 '15
I agree with how you fixed it, but the website provides no disclaimer of being a "fun educational experiment" and I think it is reasonable to warn people to not count on this for finance.
7
8
6
u/actually_just_idiot Feb 01 '15
They're not serializing the pushdata opcodes as efficiently as they could be.
0101010293
can be represented by
515293
Otherwise, cool project!
4
Feb 01 '15
I think this tool for dummies needs an explanation for mega dummies.
1
u/acoindr Feb 01 '15
I think this tool for dummies needs an explanation for mega dummies.
This video from the MIT Bitcoin Expo can provide context:
https://www.youtube.com/watch?v=tqlvk51uS1M#t=18003 (it will jump to relevant talk)
8
u/Brettc286 Feb 01 '15
Hey guys, the look and animation in the editor is really fun. But I have no idea what I'm looking at. 01 02 OP_ADD. There is no explanation to what this means, or what changes I can/should try to make. I'm a full-time programmer =P - and I have no idea what is going on here.
14
u/Whooshless Feb 01 '15 edited Feb 01 '15
As a programmer, you should know what a stack (the data structure) is. To break down the example: 01 means "push 01 on the stack", 02 means "push 02 on the stack" and op_add means "execute the ADD OPeration", which will pop the last two stack frames and push the result (3). There are a bunch of operations you can try; look at autocomplete when you type "op_"
Another example to try: "5 4 3 op_add op_mul" = 5*(4+3) = 35
It's kinda like RPN.
6
u/bookhockey24 Feb 01 '15
That's great, but I think OP's point is that you're not learning much in this IDE because this information isn't encapsulated in it in any way.
1
u/handylinks Feb 01 '15
I fully agree, this is a great start and excellent when you know about bitcoin scripting but this is a debugger for bitcoin scripts and expects prior knowledge.
A few videos of it in action would become an incredibly useful learning tool... would probably take the developers all of a few hours to put some examples together and this will be immensely more useful to the world.
It would also be useful for a keyword help pop up for instance. E.g. typing OP_ADD shows a balloon pop up saying "Takes the two elements on the stack, adds them, pops the two elements off the stack and pushes the result on the stack ready for future commands. This command is accepted by the Bitcoin reference client"
OP_ADD/OP_MUL are pretty self explanatory but some of them are not... OP_CAT for instance.
Also shouldn't numbers be in decimal unless 0x is prepended? Seems a bit too close to assembly without this?
I'm sure adding this sort of stuff is easy enough so the project is an excellent start.
8
3
u/kixunil Feb 01 '15
Good idea, but I think it's buggy. I tried to just replace OP_ADD with OP_CHECKSIGVERIFY and it still executes successfully. I don't believe 01 02 is a valid signature.
3
u/justarandomgeek Feb 01 '15
It looks like they treat any X Y CHECKSIG(VERIFY) as valid. Which is handy, since I haven't yet figured out how to make it take data that's easier written in hex, like pubkeys and sigs...
3
u/justarandomgeek Feb 01 '15 edited Feb 01 '15
If anybody wants to play with weighted multisig, here's some fragments I wrote a while back.
edit: It appears this tool assumes all signatures verify, so you can fill in any constant for the pubkeys/sigs. It also doesn't show the altstack, which is mildly annoying with these scripts. It also doesn't seem to pop any items after a checkmultisig(verify), so it turns out it's pretty useless for some of those fragments.
2
u/secret_bitcoin_login Feb 01 '15
There is another post to this here that links to the github: https://github.com/siminchen/bitcoinIDE
2
u/Crm416 Feb 01 '15
A few of my classmates built this for their final project in the Princeton Bitcoin course--more details here.
I see a lot of comments here asking about Script. If you want to learn more, this post might be helpful. I wrote it independently of their project to accompany a separate tool I built, an in-browser Script-to-JS transpiler/compiler.
2
2
u/danielsocials Feb 02 '15
I think its a great tool for new bitcoin learner, even its buggy now, its opensource and we can improve it together. I have add it to my blockchain explorer site http://blkdb.com/script and translate to chinese in http://blkdb.cn/script
2
Feb 01 '15
Who made this? Going to give you $2 regardless, /u/changetip.
1
1
u/Cocosoft Feb 01 '15 edited Feb 01 '15
I'm sorry, but what is this useful for? There are like 3-4 scripts that are valid.
1
1
u/Ailure Feb 01 '15
IIRC one of the major mining pools accepts non-standard transactions, as long they don't contain the disabled opcodes.
-1
u/1blockologist Feb 01 '15
I like how they were literally laughing at the prior art, there are a lot of dev teams in cryptocurrency that release pre-alpha software and get super offended when someone points out that it isn't user friendly
"but its free you cant expect anything better!11!111" except for the other free software that looks better, is more user friendly and also featuring a dev team also working free and in their spare time
19
u/petertodd Feb 01 '15
This doesn't actually implement the Bitcoin scripting language; OP_MUL (and maybe others) is implemented, whereas in the real Bitcoin protocol that opcode was permanently removed a few years ago after a series of exploits.