arrayio / array-io-solidity

Docs for Array.IO Solidity implementation
0 stars 0 forks source link

Introduction to Smart Contracts - all differences #1

Open ghost opened 6 years ago

ghost commented 6 years ago

Storage https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#storage

  1. (up to, but not including, version 0.5.0). A: The source code is written for Solidity version 0.4.21 and lower - for ArrayIO

  2. It is possible to store UTF-8 encoded data in string variables. A:

Subcurrency Example https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#subcurrency-example

  1. event Sent(address from, address to, uint amount); A:

  2. The address type is a 160-bit value that does not allow any arithmetic operations.

  3. The keyword public automatically generates a function that allows you to access the current value of the state variable from outside of the contract.

  4. The line event Sent(address from, address to, uint amount); declares a so-called “event” which is emitted in the last line of the function send. User interfaces (as well as server applications of course) can listen for those events being emitted on the blockchain without much cost. As soon as it is emitted, the listener will also receive the arguments from, to and amount, which makes it easy to track transactions. In order to listen for this event, you would use Coin.Sent().watch({}, '', function(error, result) { if (!error) { console.log("Coin transfer: " + result.args.amount + " coins were sent from " + result.args.from + " to " + result.args.to + "."); console.log("Balances now:\n" + "Sender: " + Coin.balances.call(result.args.from) + "Receiver: " + Coin.balances.call(result.args.to)); } })

Note how the automatically generated function balances is called from the user interface. A: We have no 'events'.

Accounts https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#accounts

  1. Regardless of whether or not the account stores code, the two types are treated equally by the EVM. A:

  2. Furthermore, every account has a balance in Ether (in “Wei” to be exact) which can be modified by sending transactions that include Ether. A:

Transactions https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#transactions-1

  1. It can include binary data (its payload) and Ether. A:

Storage, Memory and the Stack https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#storage-memory-and-the-stack

  1. (Memory) .... can be addressed at byte level, A:

  2. Memory is more costly the larger it grows (it scales quadratically). A:

  3. It has a maximum size of 1024 elements and contains words of 256 bits. Access to the stack is limited to the top end in the following way: It is possible to copy one of the topmost 16 elements to the top of the stack or swap the topmost element with one of the 16 elements below it. A:

Instruction Set https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#instruction-set

  1. The instruction set of the EVM is kept minimal in order to avoid incorrect implementations which could cause consensus problems. All instructions operate on the basic data type, 256-bit words. A:

  2. Calls are limited to a depth of 1024, A:

Delegatecall / Callcode and Libraries https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#delegatecall--callcode-and-libraries A: We don't have it

Logs https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#logs

  1. It is possible to store data in a specially indexed data structure that maps all the way up to the block level. This feature called logs is used by Solidity in order to implement events. A:

  2. Since some part of the log data is stored in bloom filters, A:

Self-destruct https://github.com/arrayio/array-io-solidity/blob/master/introduction-to-smart-contracts.rst#self-destruct A: Don't have this operation