• Stars
    star
    1,295
  • Rank 36,331 (Top 0.8 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 5 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cocos-BCX: The platform for the next generation of digital game economy

Cocos mainnet

Click here to see the Chinese document.

Build Status:

master develop

Cocos-BCX is the next generation gaming digital economy platform. The project aims to provide game developers with an easy-to-use, comprehensive blockchain gaming infrastructure. Provide gamers with a transparent, fair, and open game environment. The underlying chain system is based on graphene for the optimization of consensus mechanisms and the addition of intelligent contract systems. And provide a lot of game features, such as random number, contract session mechanism, timer, and heartbeat.

Getting Started

Preparation

We recommend building on Ubuntu 16.04 LTS (64-bit)

sudo apt-get update
sudo apt-get install autoconf cmake git vim libbz2-dev libdb++-dev libdb-dev
libssl-dev openssl libreadline-dev libtool libcurl4-openssl-dev libboost-all-dev

Building the source

cmake -DBUILD_PROCESS_ENCRYPTION=NO .  
make  

After Building, the witness_node can be launched with:

./programs/witness_node/witness_node  

The node will automatically create a data directory including a config file. It may take several hours to fully synchronize the blockchain. After syncing, you can exit the node using Ctrl+C and setup the command-line wallet by editing witness_node_data_dir/config.ini as follows:

rpc-endpoint = 127.0.0.1:8090  

notice:Please note that currently(2019-11-19) a full node will need more than 16GB of RAM to operate and required memory is growing fast. Consider the following table as minimal requirements before running a node:

Default Full Minimal ElasticSearch
100G HDD, 16G RAM 640G SSD, 64G RAM * 80G HDD, 4G RAM 500G SSD, 32G RAM

After starting the witness node again, in a separate terminal you can run:

./programs/cli_wallet/cli_wallet  

Set your inital password:

>>> set_password <PASSWORD>  
>>> unlock <PASSWORD>  

To import your initial balance:

>>> import_balance <ACCOUNT NAME> [<WIF_KEY>] true  

If you send private keys over this connection, rpc-endpoint should be bound to localhost for security.
Use help to see all available wallet commands. Source definition and listing of all commands is available here

Using the API

We provide several different API's. Each API has its own ID. When running witness_node, initially two API's are available: API 0 provides read-only access to the database, while API 1 is used to login and gain access to additional, restricted API's.

Here is an example using wscat package from npm for websockets:

$ npm install -g wscat
$ wscat -c ws://127.0.0.1:8090
> {"id":1, "method":"call", "params":[0,"get_accounts",[["1.2.0"]]]}
< {"id":1,"result":[{"id":"1.2.0","annotations":[],"membership_expiration_date":"1969-12-31T23:59:59","registrar":"1.2.0","referrer":"1.2.0","lifetime_referrer":"1.2.0","network_fee_percentage":2000,"lifetime_referrer_fee_percentage":8000,"referrer_rewards_percentage":0,"name":"committee-account","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[],"address_auths":[]},"active":{"weight_threshold":6,"account_auths":[["1.2.5",1],["1.2.6",1],["1.2.7",1],["1.2.8",1],["1.2.9",1],["1.2.10",1],["1.2.11",1],["1.2.12",1],["1.2.13",1],["1.2.14",1]],"key_auths":[],"address_auths":[]},"options":{"memo_key":"GPH1111111111111111111111111111111114T1Anm","voting_account":"1.2.0","num_witness":0,"num_committee":0,"votes":[],"extensions":[]},"statistics":"2.7.0","whitelisting_accounts":[],"blacklisting_accounts":[]}]}

We can do the same thing using an HTTP client such as curl for API's which do not require login or other session state:

$ curl --data '{"jsonrpc": "2.0", "method": "call", "params": [0, "get_accounts", [["1.2.0"]]], "id": 1}' http://127.0.0.1:8090/rpc
{"id":1,"result":[{"id":"1.2.0","annotations":[],"membership_expiration_date":"1969-12-31T23:59:59","registrar":"1.2.0","referrer":"1.2.0","lifetime_referrer":"1.2.0","network_fee_percentage":2000,"lifetime_referrer_fee_percentage":8000,"referrer_rewards_percentage":0,"name":"committee-account","owner":{"weight_threshold":1,"account_auths":[],"key_auths":[],"address_auths":[]},"active":{"weight_threshold":6,"account_auths":[["1.2.5",1],["1.2.6",1],["1.2.7",1],["1.2.8",1],["1.2.9",1],["1.2.10",1],["1.2.11",1],["1.2.12",1],["1.2.13",1],["1.2.14",1]],"key_auths":[],"address_auths":[]},"options":{"memo_key":"GPH1111111111111111111111111111111114T1Anm","voting_account":"1.2.0","num_witness":0,"num_committee":0,"votes":[],"extensions":[]},"statistics":"2.7.0","whitelisting_accounts":[],"blacklisting_accounts":[]}]}

API 0 is accessible using regular JSON-RPC:

$ curl --data '{"jsonrpc": "2.0", "method": "get_accounts", "params": [["1.2.0"]], "id": 1}' http://127.0.0.1:8090/rpc  

Contribution

Thank you for considering helping out with the source code! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes! If you'd like to contribute to cocos-mainnet, please fork, fix, commit and send a pull request for the maintainers to review and merge into the main codebase.

Resources

  • Cocos-BCX scan: We can view the corresponding information on the chain in the blockchain browser.
  • SDK: We provide rich api connection support, including various sdk:js-sdk, ios-sdk, android-sdk, python-sdk, crytop API...
  • DAPP Sample: We provide DAPP cases, for example cocos-dice-sample.
  • White Paper

License

Cocos-BCX mainnet is under the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.

More Repositories

1

cocos-bcx-node-bin

Shell
2,409
star
2

ERC-1808

JavaScript
1,472
star
3

JSSDK-Demo

JSSDK Demo
HTML
1,183
star
4

JSSDK

JavaScript
763
star
5

1808

Lua
625
star
6

AndroidWallet

Java
125
star
7

CocosPayDesktop

A Desktop Application for Cocos-BCX
JavaScript
97
star
8

Python-Middleware

Cocos-BCX python middleware
Python
94
star
9

CocosPay

A browser extension for Cocos-BCX.
Vue
92
star
10

vscode-cocos-bcx

Cocos-BCX for VS Code
TypeScript
86
star
11

explorer

Cocos-BCX Block Explorer
Vue
66
star
12

VoteCocosBCX

Vue
62
star
13

Cocos-BCX-website

Official website
CSS
62
star
14

bcx-sdk-creator

JavaScript
60
star
15

AndroidSdk

Java
53
star
16

explorer-backend

Cocos-BCX Block Explorer Backend
JavaScript
53
star
17

iOSSDK

Objective-C
52
star
18

Document

Cocos-BCX document.
52
star
19

Cocos-BCXContract

Solidity
50
star
20

cocosjs-core

Cocos-BCX core sdk for dapp
JavaScript
43
star
21

CocosPay-360

JavaScript
42
star
22

cocos-dice-sample

Dice game, Classic dice with fast random.
Vue
42
star
23

UnitySDK

C#
37
star
24

Contracts-Sample

Cocos-BCX contract sample
Lua
36
star
25

scripts

Cocos-BCX scripts.
Python
33
star
26

EOS-1808

C++
30
star
27

GasMortgage

Vue
30
star
28

cocos-shooting-game

game
JavaScript
30
star
29

wetank

tank game
JavaScript
27
star
30

CocosFactory

Python-based cocos smart-contract development & testing framework
Python
25
star
31

smart-contract-practice

cocos-bcx smart contract practice
Lua
21
star
32

Docker

Cocos-BCX Docker
21
star
33

NH1808-Website

Vue
20
star
34

bcxLibrary-Cpp

Cocos-BCX CPP Library
C++
19
star
35

faucet

faucet
Python
19
star
36

wallet_Invoker

DApp SDK
Java
16
star
37

CocosToken

ERC20 token for Cocos-BCX
JavaScript
15
star
38

data_analysis

block chain data analysis
Python
14
star
39

Python-Middleware-sample

Python Middleware example
Python
13
star
40

NodeJSSDK

JavaScript
12
star
41

CocosGoSDKTool

Go
12
star
42

star-project

JavaScript
11
star
43

Go-SDK

Go
8
star
44

CocosPay-firefox

JavaScript
7
star
45

web3service-Example

TypeScript
1
star