where INT is a signed 64-bit integer and string is an array of up to 1024 bytes. The storage capacity is limited to 16384 bytes, counting the integers as eight bytes and the strings as their length. 3.3.2 Origination The origination operation may be used to create a new contract, it specifies the code of the contract and the initial content of the contract’s storage. If the handle is already the handle of an existing contract, the origination is rejected (there is no reason for this to ever happen, unless by mistake or malice). Acontract needs a minimum balance of 1 to remain active. If the balance falls below this number, the contract is destroyed. 3.3.3 Transactions A transaction is a message sent from one contract to another contract, this messages is represented as: type transaction = { amount: amount; (* amount being sent *) parameters: data list; (* parameters passed to the script *) (* counter (invoice id) to avoid repeat attacks *) counter: int; destination: contract hash; } Such a transaction can be sent from a contract if signed using the manager’s key or can be sent programmatically by code executing in the contract. When the transaction is received, the amount is added to the destination contract’s balance and the destination contract’s code is executed. This code can make use of the parameters passed to it, it can read and write the contract’s storage, change the signature key and post transactions to other contracts. The role of the counter is to prevent replay attacks. A transaction is only valid if the contract’s counter is equal to the transaction’s counter. Once a transaction is applied, the counter increases by one, preventing the transaction from being reused. Thetransaction also includes the block hash of a recent block that the client considers valid. If an attacker ever succeeds in forcing a long reorganization with a fork, he will be unable to include such transactions, making the fork obviously fake. This is a last line of defense, TAPOS is a great system to prevent long reorganizations but not a very good system to prevent short term double spending. The pair (account_handle, counter) is roughly the equivalent of an unspent output in Bitcoin. 3.3.4 Storage fees Since storage imposes a cost on the network, a minimum fee of ꜩ 1 is assessed for each byte increase in the storage. For instance, if after the execution of a 15
A Self-Amending Crypto-Ledger White Paper Page 16 Page 18