create account

Smart contracts in Nexus by imestin

View this thread on: hive.blogpeakd.comecency.com
· @imestin · (edited)
$0.37
Smart contracts in Nexus
![NexusTritium](https://s33.postimg.cc/flba45hyn/IMG_20180606_130750_119.jpg)

The way smart contracts are implemented in Nexus is different than that of the system of Ethereum or similar smart contract platforms.

Ethereum created it's own Turing-complete language, called Solidity. You can write smart contracts on the Ethereum ecosystem using this language.

Nexus didn't create a similar Turing-complete language. Instead, in the system of Nexus, there is a 7-layer software stack. The lower layers of the software stack are capable of changing the state and object registers of the system, which can store data. Object registers are like objects in an object oriented programming language. They could be medical records coupled together with an ID, ownership data, an organization with the list of it's members, or anything else. 
The manipulation of these registers are done on the Operation Layer, which is the 4th layer of the software stack. Each layer of the software stack serves the layer above it, and it is served by the layer below it. These are the seven layers:

<center><table>
<tr>
<td>7</td><td>Interface Layer</td>
</tr>
<tr>
<td>6</td> <td>Logical Layer</td>
</tr>
<tr>
<td>5</td><td>API Layer</td>
</tr>
<tr>
<td>4</td><td>Operation Layer</td>
</tr>
<tr>
<td>3</td><td>Register Layer</td>
</tr>
<tr>
<td>2</td><td>Ledger Layer</td>
</tr>
<tr>
<td>1</td><td>Network Layer</td>
</tr>
</table></center>


This means, that an end user, for example, who is interacting with the system through the Interface Layer - which is the top layer - doesn't need  to know anything about programming. The lower layers are serving the Interface Layer, on which she or he is interacting with.

Similarly, an application programmers can access the system through the API Layer, which is the 5th layer of the software stack.

<h3>What are APIs?</h3>
<strong>API</strong> stands for <strong>A</strong>pplication <strong>P</strong>rogramming <strong>I</strong>nterface. APIs are sets of clearly defined methods of communication between various software components. With APIs you can do certain tasks on the ledger with predefined functions, so you don't need to think about how to do it on the lower level, instead, you can concentrate on your application, for example the other parts of your software that are not related to blockchain, or the design. You can think of APIs like buttons on a machine, where you don't need to understand the inner workings of the machine, you can interact with it through the buttons. One great thing about it is that, if they change something in the inside of that machine, you don't need to worry about it, from the outside it will be the same, you will still have the same interface to communicate with.

With APIs you can write your code on your preferred language, and interact with the system of Nexus through the <strong>JSON-REST</strong> formatted APIs. JSON is a format that was designed to be similarly easy to read to computers and to humans as well. Here is an example:

{
&ensp;  "firstName": "John",
&ensp;  "lastName": "Smith",
&ensp;  "isAlive": true,
&ensp;  "age": 27,
&ensp; "address": {
&emsp;    "streetAddress": "21 2nd Street",
&emsp;    "city": "New York",
&emsp;    "state": "NY",
&emsp;    "postalCode": "10021-3100"
&ensp;  } 
}

There are multiple types of APIs in Nexus, there can be different APIs that are related to an application that is handling copyright information, another  one for medical information, identity, etc.

The list of APIs will be constantly revised according to the specific needs of different industries. There will be regular conferences where different industry experts can promote the development of a new set of APIs.

Applications will communicate with the system through API gateways, any node can choose to become an API gateway.

There can be situations where you can not achieve your goal through existing APIs as an application developer. In these scenarios, application developers are free to go down to the 4th level of the software stack - the Operation Layer - and interact with the ledger through byte level instructions. With byte level instructions you can do almost anything, but it is much harder to write a software that way. With byte level instructions, you can save any type of data on the ledger, but you have to build up the logic yourself.

So the modular design of Nexus makes it easy to interact with for novice programmers or application developers, but it also makes it ready for bigger projects to build upon it, where predefined functions are not enough to implement the logic of that complex project.
And secondly the modular design is also great for developing the protocols of the software stack independently, so a software update won't conflict with existing applications that are built upon the ecosystem.
👍  , , , , , , , , , , , ,
properties (23)
authorimestin
permlinksmart-contracts-in-nexus
categorycrypto
json_metadata{"tags":["crypto","nexus","smartcontracts"],"app":"steemit/0.1","format":"markdown","image":["https://s33.postimg.cc/flba45hyn/IMG_20180606_130750_119.jpg"]}
created2018-06-05 08:03:39
last_update2018-06-07 06:18:33
depth0
children1
last_payout2018-06-12 08:03:39
cashout_time1969-12-31 23:59:59
total_payout_value0.330 HBD
curator_payout_value0.041 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,837
author_reputation3,394,231,083
root_title"Smart contracts in Nexus"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,336,039
net_rshares113,359,665,463
author_curate_reward""
vote details (13)
@steemitboard ·
Congratulations @imestin! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/votes.png)](http://steemitboard.com/@imestin) Award for the number of upvotes

<sub>_Click on the badge to view your Board of Honor._</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



> Do you like [SteemitBoard's project](https://steemit.com/@steemitboard)? Then **[Vote for its witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1)** and **get one more award**!
👍  
properties (23)
authorsteemitboard
permlinksteemitboard-notify-imestin-20180607t135414000z
categorycrypto
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2018-06-07 13:54:15
last_update2018-06-07 13:54:15
depth1
children0
last_payout2018-06-14 13:54:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length659
author_reputation38,975,615,169,260
root_title"Smart contracts in Nexus"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,694,184
net_rshares0
author_curate_reward""
vote details (1)