Smart Contract - The nervous system of the blockchain by marcosdk

View this thread on steempeak.com
· @marcosdk ·
$5.39
Smart Contract - The nervous system of the blockchain
We can define, very briefly, that a blockchain is a digital chain of blocks linked to each other that contain transactions between accounts as if it were a logbook. When two people reach an agreement they usually leave the agreement and conditions reflected in some kind of medium commonly known as a "contract". The contract defines the terms of the agreement as to what affects each party and under what conditions the agreement will be completed. The completion of that agreement is what we will call a "transaction".


![cytonn-photography-n95VMLxqM2I-unsplash.jpg](https://cdn.steemitimages.com/DQmRSyttkaSVcAS3fkdrVWB4sxpxEfJ15Z3uutwV9wknA2X/cytonn-photography-n95VMLxqM2I-unsplash.jpg)
<sub>Photo by <a href="https://unsplash.com/@cytonn_photography?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Cytonn Photography</a> on <a href="https://unsplash.com/@marcosdk/likes?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></sub>

As I said, the blockchain is made up of blocks containing transactions and those transactions contain the execution of "agreements" or "contracts".

Smart Contracts are computer programs that are stored in the blockchain nodes and will be used to carry out these agreements between parties; between accounts. 

# The contracts seen by the users
#
From a user's point of view, a contract can be designed to perform one or several actions following the "if this happens... do this..." paradigm. In order to do this, the contract needs to receive certain input information and what the action or actions to be performed will be.

It would be ideal if contracts had some kind of trigger, or trigger, that would launch the action by itself when certain conditions are met, but this is something that is still under study and development. For now, it is the particular applications that must take control of the conditions or simply wait to be called.

Let's imagine the case of a contract between the members of a music group. Every time someone buys one of your songs and pays with cryptomoney into the account associated with the sales contract, it would be ideal if the contract distributed the dividends among the members of the band as stipulated in the conditions of the contract and without any mediation by other parties. This is what would really give security and reliability to the blockchains and their contracts. Unfortunately, the intervention of one party is still necessary for the action of the contract to be executed. For example, a program that would call for profit sharing action once every 7 days or once a month. This is not a bad solution, but it implies the need to trust the third party.


![viktor-talashuk-1qprurcABtI-unsplash.jpg](https://cdn.steemitimages.com/DQmdny1B6hAbzAeztN1bhJp3VvhhKGgScyxRk1mSJP5E5Lh/viktor-talashuk-1qprurcABtI-unsplash.jpg)
<sub>Photo by <a href="https://unsplash.com/@viktortalashuk?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Viktor Talashuk</a> on <a href="https://unsplash.com/@marcosdk/likes?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></sub>

# The contracts seen by the developers
#
WAX contracts and their actions are defined within a class that inherits directly from the eosio::contract class. 

The contract usually contains the actions, the permissions, the data you need to perform, which may be persistent or not, and the "dispatchers" who will register the actions so that they can be called.


![Ashampoo_Snap_lunes, 6 de julio de 2020_18h04m09s_002_.png](https://cdn.steemitimages.com/DQmULbShNscq7X1oT2HQnmkQgo9wTomr6CMrNfGvA42cdrz/Ashampoo_Snap_lunes,%206%20de%20julio%20de%202020_18h04m09s_002_.png)


When we register a contract in the blockchain, it is associated with the account with which it has been registered and its public elements can be seen and used from some blockchain browsers.

This is the aspect that shows the list of "actions" of the Simple Assets contract for the management of its FT, NFT and NTT tokens.


![Ashampoo_Snap_lunes, 6 de julio de 2020_18h45m29s_004_.png](https://cdn.steemitimages.com/DQmbeL8jPjn6UybDDn6tr3Rswdqh3nTx4fyDEAJayTQfsMy/Ashampoo_Snap_lunes,%206%20de%20julio%20de%202020_18h45m29s_004_.png)


Throughout this series of publications we will be analyzing many of these actions and we will see how we can implement them within the code of our programs. At the time of preparing these tutorials the new NFT has been released by Atomic Assets, so I will try to include their contract in the next tutorials as well.

## You may also be interested in
#
- [Qué es WAX, para qué se utiliza y cómo crear una cuenta](https://steemit.com/wax/@marcosdk/que-es-wax-para-que-se-utiliza-y-como-crear-una-cuenta-con-wax-cloud-wallet)
- [Tokens: Introducción a los valores digitales de moda (FT/NFT/NTT)](https://steemit.com/hive-185836/@marcosdk/tokens-breve-introduccion-a-los-valores-digitales-de-moda-ft-nft-nnt)
- [InterPlanetary File System (PPFS)](https://steemit.com/steem/@marcosdk/interplanetary-file-system-ipfs)

> If you like my work please, consider using one of your votes to support me as a witness:
[![image.png](https://cdn.steemitimages.com/DQmWXvFt7HdJLEKhVGr2LnKU7PvUEBRMPeBszRDxWNgEjgc/image.png)](https://steemlogin.com/sign/account-witness-vote?witness=marcosdk&approve=1)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
👎  
properties (23)
post_id86,600,820
authormarcosdk
permlinksmart-contract-the-nervous-system-of-the-blockchain
categoryblockchain
json_metadata{"tags":["blockchain","wax","eos","steem","contract","gamedev"],"image":["https:\/\/cdn.steemitimages.com\/DQmRSyttkaSVcAS3fkdrVWB4sxpxEfJ15Z3uutwV9wknA2X\/cytonn-photography-n95VMLxqM2I-unsplash.jpg","https:\/\/cdn.steemitimages.com\/DQmdny1B6hAbzAeztN1bhJp3VvhhKGgScyxRk1mSJP5E5Lh\/viktor-talashuk-1qprurcABtI-unsplash.jpg","https:\/\/cdn.steemitimages.com\/DQmULbShNscq7X1oT2HQnmkQgo9wTomr6CMrNfGvA42cdrz\/Ashampoo_Snap_lunes,%206%20de%20julio%20de%202020_18h04m09s_002_.png","https:\/\/cdn.steemitimages.com\/DQmbeL8jPjn6UybDDn6tr3Rswdqh3nTx4fyDEAJayTQfsMy\/Ashampoo_Snap_lunes,%206%20de%20julio%20de%202020_18h45m29s_004_.png","https:\/\/cdn.steemitimages.com\/DQmWXvFt7HdJLEKhVGr2LnKU7PvUEBRMPeBszRDxWNgEjgc\/image.png"],"links":["https:\/\/unsplash.com\/@cytonn_photography?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText","https:\/\/unsplash.com\/@marcosdk\/likes?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText","https:\/\/unsplash.com\/@viktortalashuk?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText","https:\/\/steemit.com\/wax\/@marcosdk\/que-es-wax-para-que-se-utiliza-y-como-crear-una-cuenta-con-wax-cloud-wallet","https:\/\/steemit.com\/hive-185836\/@marcosdk\/tokens-breve-introduccion-a-los-valores-digitales-de-moda-ft-nft-nnt","https:\/\/steemit.com\/steem\/@marcosdk\/interplanetary-file-system-ipfs","https:\/\/steemlogin.com\/sign\/account-witness-vote?witness=marcosdk&approve=1"],"app":"steemit\/0.2","format":"markdown"}
created2020-07-06 17:59:51
last_update2020-07-06 17:59:51
depth0
children6
net_rshares8,835,422,950,002
last_payout2020-07-13 17:59:51
cashout_time1969-12-31 23:59:59
total_payout_value2.725 SBD
curator_payout_value2.669 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length5,374
author_reputation104,445,296,927,556
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (60)
@billyuzi ·
One of the coolest articles I read thanks
properties (22)
post_id86,602,767
authorbillyuzi
permlinkqd2ge6
categoryblockchain
json_metadata{"app":"steemit\/0.2"}
created2020-07-06 22:14:33
last_update2020-07-06 22:14:33
depth1
children1
net_rshares0
last_payout2020-07-13 22:14:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length41
author_reputation3,122,082,999,467
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@marcosdk ·
Thank you!
👍  
properties (23)
post_id86,611,463
authormarcosdk
permlinkqd3sun
categoryblockchain
json_metadata{"app":"steemit\/0.2"}
created2020-07-07 14:42:24
last_update2020-07-07 14:42:24
depth2
children0
net_rshares1,354,540,712
last_payout2020-07-14 14:42:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length10
author_reputation104,445,296,927,556
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@nieuscarin ·
Excelente post amigo
properties (22)
post_id86,606,545
authornieuscarin
permlinkqd34p6
categoryblockchain
json_metadata{"app":"steemit\/0.2"}
created2020-07-07 06:03:48
last_update2020-07-07 06:03:48
depth1
children1
net_rshares0
last_payout2020-07-14 06:03:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length20
author_reputation96,976,535,910,824
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@marcosdk ·
Muchas tracias!
properties (22)
post_id86,611,469
authormarcosdk
permlinkqd3sv3
categoryblockchain
json_metadata{"app":"steemit\/0.2"}
created2020-07-07 14:42:42
last_update2020-07-07 14:42:42
depth2
children0
net_rshares0
last_payout2020-07-14 14:42:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length15
author_reputation104,445,296,927,556
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@issymarie ·
Hola @marcosdk necesito hacerle una consulta a modo urgente, no se si sea posible contactarlo por discord..
Tenga buenas noches..
properties (22)
post_id86,629,543
authorissymarie
permlinkqd6jyl
categoryblockchain
json_metadata{"users":["marcosdk"],"app":"steemit\/0.2"}
created2020-07-09 02:23:12
last_update2020-07-09 02:23:12
depth1
children1
net_rshares0
last_payout2020-07-16 02:23:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length129
author_reputation31,785,000,472,481
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@marcosdk ·
Por supuesto. Puedes encontrarme en https://discord.gg/d9JH87
properties (22)
post_id86,631,438
authormarcosdk
permlinkqd6up4
categoryblockchain
json_metadata{"links":["https:\/\/discord.gg\/d9JH87"],"app":"steemit\/0.2"}
created2020-07-09 06:15:15
last_update2020-07-09 06:15:15
depth2
children0
net_rshares0
last_payout2020-07-16 06:15:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length61
author_reputation104,445,296,927,556
root_title"Smart Contract - The nervous system of the blockchain"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000