Original bitcoin core has one script.cpp.where is interepreter for it?I want to write hello world compiler to understand this.?

0

How to understand script.cpp and its interpreter.I understand register and postfix operation. I want to understand how script is parsed into machine code.Can i write hello world such as only pushing value into the stack.

Nishant Singh

Posted 2019-02-01T06:49:13.580

Reputation: 1

You mean where in the source code in the original Bitcoin v0.1 source code was the script interpreter? It was in script.cpp: https://github.com/bitcoin/bitcoin/blob/v0.1.5/script.cpp#L44L806

Pieter Wuille 2019-02-03T19:48:29.210

Answers

1

I want to understand how script is parsed into machine code.

Unlike Ethereum, Script isn't compiled. It's interpreted, like Javascript. The opcodes are evaluated on-the-fly.

Can I write hello world such as only pushing value into the stack?

Maybe try entering

0x0c 0x48656c6c6f20776f726c6421

to https://matiu.github.io/opcodes-playground/? (0x0c is the length of the text, as a push operation)

MCCCS

Posted 2019-02-01T06:49:13.580

Reputation: 5 827