🔗Technical Architecture
Last updated
Last updated
A smart contract is a computer transaction protocol without intermediary, self-verification and automatic execution of contract terms. In recent years, it has attracted much attention with the increasing popularity of blockchain technology.
The smart contract on the blockchain has the characteristics of decentralization, non-trust, programmability, and immutable. It can flexibly embed various data and assets to help achieve safe and efficient information exchange, value transfer, and asset management. Finally, it is expected to deeply change the traditional business model and social production relations and lay the foundation for the construction of programmable assets, systems, and communities. TROY selects a smart contract to execute the rules in the game. The code is automatically executed, decentralized, and non-trust.
Smart contracts generally have two attributes: value and status. If then and what if statements are used in the code to preset the corresponding trigger scenarios and response rules of contract terms. Smart contracts are submitted with user-initiated transactions (Transaction Txn) after mutual agreement and signing by multiple parties and stored in specific blocks of the blockchain after P2P network propagation and miner verification, After getting the returned contract address, contract interface, and other information, the user can call the contract by initiating a transaction. The miners are motivated by the preset incentive mechanism of the system and will contribute their own computing power to verify the transaction. After receiving the contract creation or call transaction, the miners create the contract or execute the contract code in the local sandbox execution environment (such as Ethereum virtual machine), The contract code automatically judges whether the current scenario meets the contract trigger conditions according to the inspection information of trusted external data sources (also known as Oracle) and world state, to strictly implement the response rules and update the world state. After the transaction is verified to be valid, it is packaged into a new data block. After the new block is authenticated by the consensus algorithm, it is linked to the main chain of the blockchain, and all updates are effective.
TROY uses web assembly virtual machines (WASM), which is an increasingly popular technology in encryption technology and the wider technology world. Most cryptocurrency fields are developing in this direction. More projects such as ETH2.0 and Polkadot, BSC, etc. have decided to use WASM. Since most Ethereum tools rely on web3.js, we have implemented a custom Web3 provider, which allows users to use Web3 familiar interfaces in the library to communicate directly with BSC contracts.
TROY's smart contracts include a variety of smart contracts, which are linked and work together.
TROY uses web assembly virtual machines (WASM), which is an increasingly popular technology in encryption technology and the wider technology world. Most cryptocurrency fields are developing in this direction. More projects such as ETH2.0 and Polkadot, BSC, etc. have decided to use WASM. Since most Ethereum tools rely on web3.js, we have implemented a custom Web3 provider, which allows users to use Web3 familiar interfaces in the library to communicate directly with BSC contracts.
TROY's smart contracts include a variety of smart contracts, which are linked and work together.
The startup contract occurs when the game links the wallet. A protocol will pop up at this time, which is also the conversion contract between BSC and the game pass. As a proxy protocol, the task is to convert the BNB entered by the user into Troy for further operation.
As the entrance to all contracts, we must carefully deal with relevant information. The team considers the security of the contract to be very important, so it will only call the relevant methods in the startup contract, and look for the entrance of the invocation when developing. Even if the subsequent TROY game is upgraded, the entry contract will remain unchanged.
As a contract with a higher authority, the management contract is responsible for supervising and managing the main business logic contracts. Contracts can be used to package many cumbersome tasks to make them easy to use and understand. For example, carry out a series of related operations, incorporating new transaction contracts, docking external contracts, managing contract permissions, etc. Much complex business logic in the DeFi ecosystem is abstracted, to protect users effectively and users can directly perform DeFi operations on the platform.
Each contract will be subject to separate audits and verification to ensure its security. Each contract is bound with an independent transaction contract and is managed by the management contract. This is a transparent process. Only necessary metadata information is stored in each contract, and more basic logic can be implemented in smart contracts.
Implementing the contract will approve the operation function after authorization. It includes a series of contents, such as incentive token distribution, a query of DeFi records, authorization operations, etc. Due to the decentralized, transparent and open nature of blockchain, the vast majority of users' operation content will be queried in this contract content.