15 things you should know about CNEO and CGAS

Neo
The Neo Pulse
Published in
5 min readSep 29, 2018

1. What is CNEO and CGAS

CNEO and CGAS are NEP-5-compliant contract assets issued by NGD (NEO Global Development), which can be exchanged one to one by the global asset NEO / GAS. The purpose of the contract is to map to the global assets, so that the global asset NEO / GAS can be easily transferred inside the contract, allowing the transfer of funds from the smart contract.

2. Why release CNEO and CGAS

Because there is a demand for many DApps project on NEO for a digital asset with strong liquidity and relatively stable price to be used within the contract. However, due to the limitations and security considerations of NEO smart contracts, it is not possible to transfer global assets (such as NEO or GAS) into smart contracts. Also, whenever any project issues a NEP-5 token for that contract, the community might not recognize its token or exchanges are not willing to list it for circulation. As such, it is costly for the project. The community then recommended to the NGD team to issue a NEP-5 asset pegged to NEO /GAS. As such, for the unified use for the community, CNEO and CGAS were born.

3. How does CNEO and CGAS map global assets?

In CNEO and CGAS, the global assets are exchanged and returned through “mintTokens” and “ refund” function. The “mintTokens” function is similar to the Token Sale code for many projects, with a 1:1 conversion of global and contract assets within the function. In the “return” function, a user who has previously marked a UTXO as a designated user can retrieve it, and then the user can initiate a transfer to transfer the asset to its own address. More details can be found in GitHub. This design concept was proposed by the NEL team and implemented in open source code.

4. Is the contract logic of CNEO and CGAS the same?

The internal logic and external interfaces are identical. The only difference is the contract name and the mapped asset ID.

5. What does C in CGAS mean?

Contract.

6. What is the relationship between CGAS and SGAS?

SGAS is the mapping of GAS developed by the NEL team in contract assets. It is the predecessor of CGAS. Based on SGAS, CGAS has carried out code refactoring, bug fixes and interface modification, and then renamed to CGAS. Another reason for the change of name is that the English pronunciation of SGAS is misleading. Currently deployed on the main network, SGAS is deployed by BlaCat as a temporary use before the release of CGAS. After the deployment of CGAS, they will deprecate the original SGAS and use CGAS.

7. There are contract assets that map global assets which have been developed by community projects. Why does NGD develop CGAS and CNEO?

It is understood that the community’s mapping of global assets is not open source and may PERHAPS not be trustable. The CGAS and CNEO developed by NGD are open source, decentralized, and have no usage restrictions, and can be used by any project.

8. What is the script Hash of CNEO and CGAS, where is the source code?

CGAS 1.0.3

Script Hash:

0x74f2dc36a68fdc4682034178eb2220729231db76

CGAS Contract Address:

AScKxyXmNtEnTLTvbVhNQyTJmgytxhwSnM

CNEO 1.0.3

Script Hash:

0xc074a05e9dcf0141cbe6b4b3475dd67baf4dcb60

CNEO Contract Address:

AQbg4gk1Q6FaGCtfEKu2ETSMP6U25YDVR3

GitHub address:

CNEO: https://github.com/neo-ngd/CNEO-Contract

CGAS: https://github.com/neo-ngd/CGAS-Contract

Instructions and more technical information can be found by clicking on the GitHub link above.

9. Which projects are using CNEO and CGAS

There are currently NEL’s NNS, BlaCat’s crazy gladiator games, Alchemint , and nOS that are already using or planning to use CNEO or CGAS.

10. Is there a wallet that supports CNEO and CGAS?

According to Apisit, one of the founders of the O3 team, has said that O3 is developing support for CNEO and CGAS and is expected to be FULLY available soon. In addition to community wallet support, project owners using CNEO and CGAS will also facilitate the redemption and return of CNEO and CGAS functions for their projects.

11. Why are there multiple versions of CGAS

In the first version of CGAS (1.0.1), there was a problem with the transferAPP function (a transfer function called by another contract) that was not standardized. The English speaking community developers thought it should be named transferApp. We studied and decided to merge the transfer function and the transferAPP function, remove the transferAPP interface, and make logical decisions inside the method, thus reducing the number of script lines.

In the second version of CGAS (1.0.2), there is a code in the transfer method that prevents the springboard call, which makes it impossible to call the transfer function through the contract. This bug does not result in a loss of user assets. After the release of this version, we realized this problem and fixed it, so we released version 1.0.3.

The current 1.0.3 version is running steadily and no bugs have been found so far. If the community finds a security hole in the future, we will fix and notify the projects to do a version update as soon as possible.

12. Can the old CGAS still be used?

Currently there are 3 versions of CGAS, 1.0.1, 1.0.2 and 1.0.3, and the latest version is 1.0.3. We recommend that the community use the latest version of CGAS. If you have used the old version of CGAS, don’t worry, you can use the refund command. Converting CGAS to GAS and then migrating the CGAS version will not result in asset loss.

13. How many versions does CNEO have?

CNEO currently has one version — version number 1.0.3, because CNEO is released after CGAS runs stably.

14. Will CNEO get GAS or CGAS?

No, because the amount of GAS generated by the global asset NEO cannot be calculated within the contract. Decentralized implementation has many unsolvable difficulties, and centralized implementation will greatly increase the complexity of the contract. It makes the contract become bloated, the storage amount becomes huge, and the administrator rights is too large, as such there is also the risk of abuse of power. Hence, GAS cannot be extracted. Since holding CNEO will not get GAS or CGAS, if a project needs this feature, they can Fork CNEO’s code to implement a centralized solution on its own.

15. What should developers pay attention to when using CGAS/CNEO

1. Fees. When you use mintTokens, please note that the Inputs and Outputs of InvocationTransaction should not exceed 60. Otherwise, the fee required for execution will exceed the free 10 GAS. If a large number of NEO / GAS UTXOs needs to be replaced by CNEO or CGAS, it is recommended to make a normal transfer, merge UTXO, and then perform mintTokens.

2. The problem of transaction verification failure. In CNEO and CGAS, the contract logic is more complicated. A slight negligence in constructing a transaction will lead to the failure of transaction verification. It is recommended that developers first study the logic of the contract and then construct the transaction. In the CGAS project, we provide code for unit testing for developers’ reference. The CNEO and CGAS logics are identical and can be used in CNEO with a few changes.

--

--

The Neo Pulse
The Neo Pulse

Published in The Neo Pulse

Neo Pulse is the number one way to stay informed on Neo’s developments and keep up to date on the most cutting-edge developments across the Web3 ecosystem. Join our collaborative platform for the Neo community and create the path forward for the future of the Smart Economy.

Neo
Neo

Written by Neo

An Open Network for the Smart Economy. https://neo.org/