# Smart Contract

# Overview

Smart contract is a programmable blockchain account, that is, under an account that stores a piece of code in the blockchain, when this account receives a transaction, it will calculate according to the built-in code and update the calculation results to blockchain database of this account.

# Contract Type

To ensure both security and flexibility, TOP Network provides two types of smart contracts: platform smart contract and application level smart contract.

# Platform Smart Contract

Platform smart contacts are deployed on the main-chain, and are used for scenarios involving asset transfer, elections, and on-chain governance. These contracts are written in a stack-based non-Turing complete scripting language to ensure security and enforceability. Although platform contracts are not Turing complete, they can call built-in Turing complete core functions executed by the Core VM which provides flexibility.

The functions provided by the TOP Network platform contract are node registration, node voting, node access, node election, and chain governance.

Platform Contract Deployment Location Contract Account Address Description Contract Name Triggered By The Clock
Election Related Contract Beacon T2000138JQPo5TcurZsVLFUMd5vHJRBLenLWjLhk6@0
Beacon elect Beacon group contract. beacon_election_contract
T2000138NpRxYCFQxMHvedTxRpgkb8B7oHt235N2W@0 Beacon elect edge group contract. edge_election_contract Y
T2000138NXb36GkofBUMqxCAZqdERi63htDVC8Yzt@0 Beacon elect archive group contract. archive_election_contract Y
"@0"Beacon candidate pool contract, including all candidate nodes and nodes have been elected as edge, archive and Beacon.
The "@2" candidate pool contract stores the credible height of the @0 candidate pool.
T200024uHxGKRST3hk5tKFjVpuQbGNDihMJR6qeeQ@2 Beacon elect auditor/validator group contract. zone_beacon_election_contract Y
T200024uN3e6AujFyvDXY4h5t6or3DgKpu5rTKELD@2 Shard association relationship contract. cluster_shard_contract N
On-chain Governance Contract T2000138Ao4jjYtrXoNwfzb6gdpD2XNBpqUv46p8B@0 On-chain governance contract. government_contract N
Registration Contract T2000138NZjvNJjRNG5iEqVKydpqAqoeNjBuFmNbj@0 Miner registration contract. miner_register_contract N
T200024uAt8Na2U1GUtWSHXJSqaJJBXunUX9WU9kB@0 Process the workload data collected by shard, such as calculating individual node rewards. zone_workload_contract Y
T200024uPV1k6XjTm9No5yB2mxBPK9o2XqJKyhDUn@0 Zone voting aggregates contracts. zone_votes_contract N
T200024uDhihoPJ24LQL4znxrugPM4eWk8rY42ceS@1 Process the slash data collected by shard, such as calculating individual node slash. zone_block_signing_rate_contract Y
Reward Issue Contract T200024uV5yB1ZCnXe7SbViA86ufhouFjpDKNRd3X@0 Issue TOP Token as a reward pool. token_issue_and_reward_contract N
Validator Network T20000MFGB3gFWSsMfEo9LrC7JEaj1gJTXaYfXny Shard workload statistics contract. table_workload_contract Y
T20000ML7oBZbitBCcXhrJwqBhha2MUimd6SM9Z6 Shard slash statistics. table_block_signing_rate_contract Y
T20000MTotTKfAJRxrfvEwEJvtgCqzH9GkpMmAUg Shard reward claiming. table_reward_contract
T20000MVfDLsBKVcy1wMp4CoEHWxUeBEAVBL9ZEa Vote on miner. table_vote_contract N