Back to Course

3. Advanced Course

0% Complete
0/0 Steps
  1. 1. What is Taproot?
  2. 2. Blockchain bridges – what are they?
  3. 3. What is Ethereum Plasma?
  4. 4. What is Ethereum Casper?
  5. 5. What is Zk-SNARK and Zk-STARK? 
  6. 6. What is Selfish Mining? 
  7. 7. What is spoofing in the cryptocurrency market? 
  8. 8. Schnorr signatures - what are they? 
  9. 9. MimbleWimble - what is it? 
  10. 10. What is digital property rights in NFT?
  11. 11. What are ETFs and what role do they play in the cryptocurrency market? 
  12. 12. How to verify a cryptocurrency project – cryptocurrency tokenomics 
  13. 13. What is the 51% attack on blockchain?
  14. 14. What is DAO, and how does it work?
  15. 15. Zero-knowledge proof – a protocol that respects privacy 
  16. 16. What is EOSREX?
  17. 17. What is Proof of Elapsed Time (PoET)?
  18. 18. Mirror Protocol – what it is? 
  19. 19. What are synthetic assets? 
  20. 20. How to create your own NFT? 
  21. 21. Definition of DeFi, and what are its liquidations?
  22. 22. New identity system - Polygon ID
  23. 23. Ethereum Foundation and the Scroll protocol - what is it?
  24. 24. What is Byzantine fault tolerance in blockchain technology?
  25. 25. Scalability of blockchain technology - what is it?
  26. 26. Interchain Security - new Cosmos (ATOM) protocol
  27. 27. Coin Mixing vs. Coin Join - definition, opportunities, and threats
  28. 28. What is Ethereum Virtual Machine (EVM) and how does it work?
  29. 29. Soulbound Tokens - what are they, and how do they work?
  30. 30. Definition of LIDO - what is it?
  31. 31. What are Threshold Signatures, and how do they work?
  32. 32. Blockchain technology and cyberattacks.
  33. 33. Bitcoin script - what it is, and what you should know about it.
  34. 34. What is zkEVM, and what are its basic features?
  35. 35. Do confidential transactions on blockchain exist? What is a Confidential Transaction?
  36. 36. Algorithmic stablecoins - everything you should know about them.
  37. 37. Polygon Zk Rollups ZKP - what should you know about it?
  38. 38. What is Web3 Infura?
  39. 39. Mantle - Ethereum L2 scalability - how does it work?
  40. 40. What is the NEAR Rainbow Bridge?
  41. 41. Liquid Staking Ethereum and LSD tokens. What do you need to know about it?
  42. 42. Top 10 blockchain oracles. How do they work? How do they differ?
  43. 43. What are Web3.js and Ether.js? What are the main differences between them?
  44. 44. What is StarkWare, and recursive validity proofs
  45. 45. Quant Network: scalability of the future
  46. 46. Polygon zkEVM - everything you need to know
  47. 47. What is Optimism (OP), and how do its roll-ups work?
  48. 48. What are RPC nodes, and how do they work?
  49. 49. SEI Network: everything you need to know about the Tier 1 solution for DeFi
  50. 50. Types of Proof-of-Stake Consensus Mechanisms: DPoS, LPoS and BPoS
  51. 51. Bedrock: the epileptic curve that ensures security!
  52. 52. What is Tendermint, and how does it work?
  53. 53. Pantos: how to solve the problem of token transfer between blockchains?
  54. 54. What is asymmetric encryption?
  55. 55. Base-58 Function in Cryptocurrencies
  56. 56. What Is the Nostr Protocol and How Does It Work?
  57. 57. What Is the XDAI Bridge and How Does It Work?
  58. 58. Solidity vs. Rust: What Are the Differences Between These Programming Languages?
  59. 59. What Is a Real-Time Operating System (RTOS)?
  60. 60. What Is the Ethereum Rinkeby Testnet and How Does It Work?
  61. 61. What Is Probabilistic Encryption?
  62. 62. What is a Pinata in Web 3? We explain!
  63. 63. What Is EIP-4337? Will Ethereum Account Abstraction Change Web3 Forever?
  64. 64. What are smart contract audits? Which companies are involved?
  65. 65. How does the AirGapped wallet work?
  66. 66. What is proto-danksharding (EIP-4844) on Ethereum?
  67. 67. What is decentralised storage and how does it work?
  68. 68. How to Recover Cryptocurrencies Sent to the Wrong Address or Network: A Practical Guide
  69. 69. MPC Wallet and Multilateral Computing: Innovative Technology for Privacy and Security
  70. 70. Threshold signature in cryptography: an advanced signing technique!
  71. 71. Vanity address in cryptocurrencies: what is it and what are its characteristics?
  72. 72. Reentrancy Attack on smart contracts: a threat to blockchain security!
  73. 73. Slither: a static analyser for smart contracts!
  74. 74. Sandwich Attack at DeFi: explanation and risks!
  75. 75. Blockchain RPC for Web3: A key technology in the world of decentralized finance!
  76. 76. Re-staking: the benefits of re-posting in staking!
  77. 77. Base: Evolving cryptocurrency transactions with a tier-2 solution from Coinbase
  78. 78. IPFS: A new era of decentralized data storage
  79. 79. Typical vulnerabilities and bridge security in blockchain technology
  80. 80. JumpNet - Ethereum's new sidechain
Lesson 33 of 80
In Progress

33. Bitcoin script – what it is, and what you should know about it.

Bitcoin Script, otherwise known as “Bitcoin Script”, is nothing more than the language that Bitcoin uses to do everything it does. We’re talking about sending wallet funds or even creating a user account, among other things. All these functions are contained in one tool. Which one? That’s our topic for today.

Bitcoin Script – definition

Bitcoin Script is the programming language used by Bitcoin. It is used to process transactions. The code written in this way is read from left to right, and is based on a series of linear structures, called stacks. Stacks, in turn, contain data, which are arranged in LIFO (Last In-First Out) order. Interestingly, each instruction executed in this language is executed one after the other.

Bitcoin Script is basically a language of instructions. They are recorded with every transaction made. The instructions themselves describe how users can access and make appropriate use of the bitcoins available on the network.

Interestingly, the Bitcoin programming language is not a Full Turing language. This means that its full functionality is limited – it cannot solve problems and create loops. This limited is intentional, as it prevents infinite loops and error detection, which can create malware.

However, the programming language is an important part of the entire Bitcoin ecosystem. It allows programs and computers to perform our actions. Bitcoin for this purpose uses opcodes, which mainly serve as functions. They manipulate memory, maths, loops or call other essential functions.

What is opcode and operation code?

OPCODE, or Operation Code. It is a part of a programming language instruction, whose task is to specify the operation to be performed. The specification and format of the opcode is determined by a set of instructions called the ISA, which processes the entered instruction. The processor usually handles this task.

In Bitcoin and not only, but also in the case of many other cryptocurrencies, opcodes are the backbone of the system through which we can program the transaction instructions. We remind you that most cryptocurrencies are basically programmable money. “Programmable” is our key word because Bitcoin Script is a programming language where all instructions are given in opcodes. They, in turn, are predetermined by the BTC network. In practice, we distinguish 256 opcodes, which start with the number 0-255 in the Bitcoin ecosystem. Currently, only 116 are active.

And it is opcodes that allow us to perform various operations on the Bitcoin network. We are talking about performing transactions, controlling data flow, stack management, logic management or even cryptographic operations. A full and updated list of opcodes can be found in the Bitcoin code, which is publicly available.

Bitcoin Script – breakdown

The programming language is divided into two important scripts: scriptSig and scriptPubKey. Let’s discuss both of them:

  1. ScriptSig is an unlocking script. It requires a public key and a digital signature.
  2. scriptPubKey is a locking script. It contains the hash of the public key (bitcoin address).

Why was Bitcoin Script created?

The programming language was created to make transactions quick and easy. Script, in terms of programming, is designed very simply. It basically determines whether an operation can be performed or not. The Bitcoin script allows us to send a transaction when certain conditions are met. This feature makes Bitcoin and other cryptocurrencies something unique. Moreover, the script prevents errors in the system. It makes transactions on the network easy to calculate, while not slowing it down.

How the transaction goes using Bitcoin Script

We mentioned earlier that the script itself contains two components: scriptPubKey and scriptSig. The first contains the actions to be performed, and the second contains the signature and public key to verify the authenticity of the transaction being made. As a result, only authorized people have access to the funds and can perform any actions on them. The operations performed in opcode are as follows:

  1. opdup duplicates the element that is on the top stack.
  2. ophash160 deals with input data, which is encoded twice. First using SHA-256, and then using RIPEMD -160.
  3. opequalverify checks that the data has been entered correctly.
  4. opchecksig deals with input and output data. It checks that the data and script of the entire transaction are summarized in the hash.

If the above steps have been done correctly, we move on to the script. The owner’s public key is duplicated first. It then goes through the process of hashing. The resulting hash is compared with the hash of the public key, which is found in scriptPubKey. All this is done to ensure that it is valid.  

If so, the script continues and we move to opchecksig, where the signature is verified with the public key.

As you can see, everything that occurs in the script is safe and planned.

Advantages and disadvantages

  • Bitcoin Script is simple and does not require complicated actions.
  • With limited functionality, it is more secure.
  • It is a Turning Incomplete language, so it has no loops.
  • Minimizes the occurrence of errors and malicious codes.
  • It can be implemented virtually anywhere.
  • All the information necessary to run the script must be included in it.
  • It contains only 256 instructions.

Summary

Bitcoin Script is the simplest programming language. It offers very many advantages. Especially important is its high level of security.