lecle / aloxide

Aloxide is a pragmatic abstraction layer for various blockchain softwares.
Apache License 2.0
10 stars 5 forks source link

Research ICON Network #2

Closed quocle108 closed 4 years ago

quocle108 commented 4 years ago

Acceptance criteria

manh-vv commented 4 years ago

make document for #3

quocle108 commented 4 years ago

State Database:

In general, the state database is a key-value database, and can be accessed using VarDB, DictDB and ArrayDB classes.

VarDB can be used to store simple key-value state, and DictDB behaves more like Python dict. DictDB does not maintain order, whereas ArrayDB, which supports length and iterator, maintains order.

I’ve make some several tests on my computer and the result:

Read/Query Data:

ICON transaction:

ICON Smart Contract:

The difference compare with EOS:

quocle108 commented 4 years ago

@flowersinthesand @manh-vv Pls review this.

flowersinthesand commented 4 years ago

@quocle108 Thanks for your research. I have some questions.

In general, the state database is a key-value database, and can be accessed using VarDB, DictDB and ArrayDB classes.

What does mean we can access the state database through various databases? Is it similar that EOS' history-tools provide various database bridges?

There is no way for other smart contract can access state data directly from the database.

What database? smart contract tables that belong to other contract owner?

The state database can process data (read/write) better than EOS (20’000 indices per transaction). With EOS we read/write about 200 indices per transaction. (The test with my computer).

Is the index you mentioned the same a key-value pair or a column of some table?

To design an abstraction that works on both ICON and EOS, I think we need to drop sophisticated features of EOS like fine-grained access control and inline transactions which aren't supported in ICON and maybe others too so guess the final result would be a kind of ORM for blockchain which allows to read and push transactions with data to various blockchain softwares.

BTW can you write a table that lists supported data types by EOS and ICON with notes like maximum, minimum, exceptions, etc.? so that we can extract its common area to design the abstraction.

Data type EOS ICON
string foo bar
number foo bar
boolean foo bar
null foo bar
array foo bar
key-value pairs (hash, dictionary, etc.) foo bar
other type1 foo bar
other type2 foo bar
quocle108 commented 4 years ago

What does mean we can access the state database through various databases? Is it similar that EOS' history-tools provide various database bridges?

VarDB, DictDB, and ArrayDB are the kind of data structure you can store to easily insert/remove/update your data.

What database? smart contract tables that belong to other contract owner?

Each blockchain has its database. Smart contract like a backend to insert/update/remove state data from the database.

Example: I have 2 contracts A, B

Is the index you mentioned the same a key-value pair or a column of some table?

It's table's row in EOS

To design an abstraction that works on both ICON and EOS, I think we need to drop sophisticated features of EOS like fine-grained access control and inline transactions which aren't supported in ICON and maybe others too so guess the final result would be a kind of ORM for blockchain which allows to read and push transactions with data to various blockchain softwares.

It should be inline actions. and ICON also supports the inline action. Transaction can include multiples actions

flowersinthesand commented 4 years ago

BTW can you write a table that lists supported data types by EOS and ICON with notes like maximum, minimum, exceptions, etc.?

I've just separated it to https://github.com/lecle/aloxide/issues/8

flowersinthesand commented 4 years ago

Closing as researched and applied to our project