Bitcoin Catcher Box
A box has all you need to get started with our Cocos Creator (BitcoinCatcher) tutorial.
Getting Started
Setting up the development environment
There are a few technical requirements before we start. Please install the following:
This project is not always brought up to date with the most recent version of Cocos Creator. Please make sure you are using Cocos Creator v2.1.
Unboxing the dApp
Install Punica CLI.
Unbox the bitcoin-catcher-box.
Install dependency.
Running Cocos Creator
Run Cocos Creator by double-click the CocosCreator.exe
file in the installation target folder or click Cocos Creator
from Start menu to start Cocos Creator.
For some Windows operating systems, the following error may be encountered:
It means the GPU rendering is not supported by the graphics card driver.
If this happens, it is usually only need to ensure the official driver of the corresponding model of the graphics card has been successfully installed.
Opening Project
You can browse and open the project in the local file system by clicking the Open Other Projects button.
For some MAC operating system, the window can not be displayed when open the project, please Drag the CocosCreator.app from the DMG into the application, and then open it.
After initial building finished, please pay attention to the Assets panel, on which all the resource allocation graphs of the project are shown.
Cocos Creator uses a particularly structured folder as legitimate project marking, but it isn't a construction document. You only need to click the project folder when choosing the project.
Previewing Scene
To see a preview of the game scene, please click the Preview button at the top of the editor window.
What's Cocos Creator
Cocos Creator is a script development, entity-component and data-driven game development tool focused on content creation. An easy-to-follow content production workflow and a powerful suite of developer tools for game logic and high-performance game creation. For the more information, you can click here to read Cocos Creator User Manual.
Learning in Action
We have a smart contract in project contracts
folder. Therefore, we needn't to write a new contract, only need to compile and deploy it.
Compiling the Smart Contract
We need to compile our Python contract to bytecode for the Neo Virtual Machine (NeoVM) to execute. Think of it as translating our human-readable Python into something the NeoVm understands.
In a terminal, make sure you are in the root of the directory that contains the dapp and type:
If you encountering problems running this command, please open a issue in here.
You should see output similar to the following:
Deploying the Smart Contract
Now that we've successfully compiled our contract, it's time to deploy it to the blockchain!
You'll see one JSON file already in the contracts
directory config.json
. In this file, the following information will be used in deploying process.
Read more about migrations in the Punica Python documentation.
Back in our terminal, deploy the contract to the blockchain.
You should see output similar to the following:
Invoking the Smart Contract
Punica is very easy when it comes to smart contract invoking, in that function can be executed with only provide parameters in JSON file.
In contracts/config.json
, the following information will be used in deploying process.
To invoke register()
function, you only need to back in our terminal.
You should see output similar to the following:
To test the register()
function, we can invoke get_user_nane()
function to get the current value store in blockchain.
If test success, it should returns the given user_name
. Therefore, you should see output similar to the following:
Interacting with the Smart Contract
Desktop Browser
ontology-dapi is A lightweight Javascript library for interacting with Chrome Plugin which is integrated provider engine.
We can use it as ES6 module in our game scene's script.
We can also use it as CommonJS/ES6 module in our game scene's script.
After we regist with Provider successful, we can use it in our project.
Mobile Phone
cyano-bridge is library allows your dApp to interface with mobile wallet which is integrated provider engine.
We can use it as ES6 module in our game scene's TypeScript script.
We can also use it as CommonJS/ES6 module in our game scene's script.
After we regist with Provider successful, we can use it in our project.
Last updated
Was this helpful?