Skip to content

Instantly share code, notes, and snippets.

@VictorTaelin
Created July 6, 2022 22:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VictorTaelin/bb0f8fb30b61bf0c216675791b72500c to your computer and use it in GitHub Desktop.
Save VictorTaelin/bb0f8fb30b61bf0c216675791b72500c to your computer and use it in GitHub Desktop.
Inc contract comparison, Ethereum vs Kindelia

Ethereum

Deploy contract:

Code:

pragma solidity >=0.4.22 <=0.9.0;

contract Foo {
  uint256 public x = 0;

  function inc() public {
    x += 1;
  }

  function get() public view returns (uint256) {
    return x;
  }
}

Raw transaction:

02f90222040184b2d05e0084b2d05e008302ac618080b901c9608060405260008
05534801561001457600080fd5b506101a5806100246000396000f3fe60806040
5234801561001057600080fd5b50600436106100415760003560e01c80630c556
99c14610046578063371303c0146100645780636d4ce63c1461006e575b600080
fd5b61004e61008c565b60405161005b91906100c5565b60405180910390f35b6
1006c610092565b005b6100766100ad565b60405161008391906100c5565b6040
5180910390f35b60005481565b60016000808282546100a491906100e0565b925
05081905550565b60008054905090565b6100bf81610136565b82525050565b60
006020820190506100da60008301846100b6565b92915050565b60006100eb826
10136565b91506100f683610136565b9250827fffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffff0382111561012b5761012a61014
0565b5b828201905092915050565b6000819050919050565b7f4e487b71000000
00000000000000000000000000000000000000000000000000600052601160045
260246000fdfea26469706673582212204305736d3c73c6285e4429b868b4c502
b1c69195269e1bef510ab6694808587164736f6c63430008070033c001a02d70d
076c8896cd3fef5e9afded1b3562001d5a73f2d39eb20e5782fbc18d365a02c7d
b0a039bdae99977be6ebec3ff47ddc6d6972aed531652af329ecb13e2137

Call inc() method:

Code:

Foo.inc()

Raw transaction:

02f86e040284b2d05e0084b2d05e0082f87094e7450016f336d362f9827a92d38
300a8b66204248084371303c0c080a02c515713220ba364ed644c8bdeb4641fe2
cc254212323dc6a2f69ba54c061725a01c5acb9a5ae6f6923383bc4650079aa87
63f907dcdb10ccba46d074f2b3bcffa

https://rinkeby.etherscan.io/address/0xe7450016f336d362f9827a92d38300a8b6620424

Kindelia

Deploy contract:

Code:

fun (Foo f) {
  (Foo {Inc}) =
    !take x
    !save (+ x #1)
    !done #0
  (Foo {Get}) =
    !load x
    !done x
} with { #0 }

Raw transaction:

073e7095535cf9c24bcd3e40be6ae97bfe6e4a4f17c83d377
fcdc9e013cf69fffff17c8d9ae7fcdc961ae7ce1251f2e215
174f387ff9ed5278be46cd73fe6e484f060

Call inc() method:

Code:

run {
  !call ~ 'Foo' [{Inc}]
  !done #0
}

Raw transaction:

42b56ba6cff9b92fab679865432c3979ef25e69f214fffff8
be46cd73fe6e4b0
@VictorTaelin
Copy link
Author

I don't get it. What do you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment