The ownership of Bytom's assets is established on addresses and digital signatures. Every transaction requires a valid signature to be stored on the blockchain, and only a valid digital key can produce a valid digital signature. Therefore, possessing the digital key is equivalent to possessing the asset control right of the account. The private keys come in pairs and consist of a public key and a private key. Simply put, the public key can be used as the address of the transaction output, and the private key can generate a digital signature for the transaction. Generally, they are stored in wallet files and managed by wallet software.
When an asset is issued, the asset will be issued to the designated address. When an asset is spent, it will be consumed from an existing address and transferred to a new address. When an asset is destroyed, it is also consumed from an existing address but transferred to an address that can never be consumed.
In addition, not all addresses are public keys, they can also represent other payment objects, such as scripts. We call the payment script a control program, and each control program contains a series of predicates that need to be satisfied in order to spend the output.
# Account control program
Among them, the basic control program belongs to the account control program, which defines multiple keys and the number of signatures required when spending asset units. When depositing an asset to a specified account, the wallet client will derive a series of new sub-public keys from the root private key and create a unique control program that is used only once. The control program uses the previous number of signatures defined. According to the number of private keys in the account, it can be divided into single-signature accounts and multi-signature accounts. Single-signature accounts adopt P2PKH when creating control programs. It mainly verifies whether the Public Key can be converted into the correct address and whether the signature is correct, which is to prove whether you are the owner of this Public Key. The multi-signature account uses the P2SH method when creating the control program. For example, for a 3-2 multi-signature account, it needs to verify at least two valid signatures. Although the sub-public keys used by all control programs of the same account are derived from the same root key, it is impossible for other participants on the blockchain to identify the connection between them. This technique is called hierarchical deterministic key derivation, and it ensures that only participants on the blockchain with which you are trading will know that the control program belongs to you. For others, it is impossible to know the creator of the control program.
# Destroy Control program
Destroy Control program is a very simple control program, it has only a simple predicate: FAIL. That is, it ensures that the asset unit on it can never be consumed, so it is equivalent to that the asset is removed from the blockchain.
# Customized control program
Bytom’s contract virtual machine supports customized control program. We have developed a high-level language that allows developers to write smart contract programs on Bytom. Check the smart contract documentation for details.