Cocos-BCX Smart Contract Snippets
Cocos-BCX: The platform for the next generation of digital game economy.
API
cjson for json
chainhelper for cocosbcx contract lua api
bcx for usefull snippets
Lua api from https://dev.cocosbcx.io/docs/notice-for-use
contract operation
new contract.
contract_name.lua bcx contract file. Example:
```lua
function hello()
chainhelper:log('Hello World! 2018 8888')
end
```
contract_name_t.json bcx contract configuration file. Example:
```json
{
"title": "demo",
"name": "contract.helloname",
"api": "hello",
"account": "test1",
"password": "12345678",
"authority": "COCOS7d7RLEJc4tVYCskhKQLJHnJhhZQb4DWcTGqsWqFwC1mkxXvTY2",
"testnet": {
"ws_node_list": [
{
"url": "ws://39.97.110.222:8040",
"name": "Cocos - China - Beijing"
},
{
"url": "ws://47.93.62.96:8049",
"name": "Cocos - China - Xiamen"
}
],
"networks": [
{
"core_asset": "COCOS",
"chain_id": "7d89b84f22af0b150780a2b121aa6c715b19261c8b7fe0fda3a564574ed7d3e9"
}
],
"faucet_url": "http://47.93.62.96:3000",
"auto_reconnect": false,
"check_cached_nodes_data": false
}
}
```
publish/update contract
- read account, password, network configuration from
contract_name_t.json to login and publish contract.
test your contract
- read account, password, network configuration from
contract_name_t.json to login and test contract
TODO
- check if the contract name is legal
| |