icondev

> hyperconnect the world _

ICON is a scalable smart contract enabled blockchain platform with a long-term goal of interoperability between enterprise and public blockchains. Our goal is to Hyperconnect the World, and by combining groundbreaking technology, a strong community, and relentless growth strategies we believe this goal is reachable.

Get Started    

Configuration

Configuration Files

tbears_server_config.json

When starting T-Bears (tbears start), "tbears_server_config.json" is used to configure the parameters and initial settings.

{
    "hostAddress": "0.0.0.0",
    "port": 9000,
    "scoreRootPath": "./.score",
    "stateDbRootPath": "./.statedb",
    "log": {
        "logger": "tbears",
        "level": "info",
        "filePath": "./tbears.log",
        "colorLog": true,
        "outputType": "console|file",
        "rotate": {
            "type": "bytes",
            "maxBytes": 10485760,
            "backupCount": 10
        }
    },
    "service": {
        "fee": false,
        "audit": false,
        "deployerWhiteList": false
    },
    "genesis": {
        "nid": "0x3",
        "accounts": [
            {
                "name": "genesis",
                "address": "hx0000000000000000000000000000000000000000",
                "balance": "0x2961fff8ca4a62327800000"
            },
            {
                "name": "fee_treasury",
                "address": "hx1000000000000000000000000000000000000000",
                "balance": "0x0"
            },
            {
                "name": "test1",
                "address": "hxe7af5fcfd8dfc67530a01a0e403882687528dfcb",
                "balance": "0x2961fff8ca4a62327800000"
            }
        ]
    },
    "channel": "loopchain_default",
    "amqpKey": "7100",
    "amqpTarget": "127.0.0.1",
    "blockConfirmInterval": 10,
    "blockConfirmEmpty": true
}
Field Data type Description
hostAddress string IP address that T-Bears service will listen on.
port int Port number that T-Bears service will listen on.
scoreRootPath string Root directory where SCORE will be installed.
stateDbRootPath string Root directory where state DB file will be created.
log dict T-Bears log setting
log.logger string Main logger in process
log.level string log level. <br/>"debug", "info", "warning", "error"
log.filePath string Log file path.
log.colorLog boolean Log display option (color or black)
log.outputType string “console”: log outputs to the console that T-Bears is running.<br/>“file”: log outputs to the file path.<br/>“console|file”: log outputs to both console and file.
log.rotate dict Log rotate setting
log.rotate.type string "peroid": rotate by period.<br/>"bytes": rotate by maxBytes.<br/>"period|bytes": log rotate to both period and bytes.
log.rotate.period string use logging.TimedRotatingFileHandler 'when'<br/> ex) daily, weekly, hourly or minutely
log.rotate.interval string use logging.TimedRotatingFileHandler 'interval'<br/> ex) (period: hourly, interval: 24) == (period: daily, interval: 1)
log.rotate.maxBytes integer use logging.RotatingFileHandler 'maxBytes'<br/> ex) 10mb == 10 1024 1024
log.rotate.backupCount integer limit log file count
service didct T-Bears service setting
service.fee boolean true | false. Charge a fee per transaction when enabled
service.audit boolean true | false. Audit deploy transactions when enabled
service.deployerWhiteList boolean true | false. Limit SCORE deploy permission when enabled
genesis dict Genesis information of T-Bears node.
genesis.nid string Network ID.
genesis.accounts list List of accounts that holds initial coins.
(index 0) genesis: account that holds initial coins.
(index 1) fee_treasury: account that collects transaction fees.
(index 2~): test accounts that you can add.
channel string channel name interact with iconrpcserver and iconservice
amqpKey string amqp key name interact with iconrpcserver and iconservice
amqpTarget string amqp target name interact with iconrpcserver and iconservice
blockConfirmInterval integer Confirm block every N seconds
blockConfirmEmpty boolean true | false. Confirm empty block when enabled

tbears_cli_config.json

For every T-Bears CLI commands except start, stop, clear, init and keystore, this file is used to configure the default parameters and initial settings.

In this configuration file, you can define default options values for some CLI commnds. For example, SCORE's on_install() or on_update() method is called on deployment. In this config file, you can set the deploy "mode" and the parameters ("scoreParams") of on_install() or on_update() as shown in the following example.

{
    "uri": "http://127.0.0.1:9000/api/v3",
    "nid": "0x3",
    "keyStore": null,
    "from": "hxe7af5fcfd8dfc67530a01a0e403882687528dfcb",
    "to": "cx0000000000000000000000000000000000000000",
    "stepLimit": "0x3000000",
    "deploy": {
        "mode": "install",
        "scoreParams": {}
    },
    "txresult": {},
    "transfer": {}
}
Field Data type Description
uri string URI to send the request.
nid string Network ID. 0x3 is reserved for T-Bears.
keyStore string Keystore file path.
from string From address. It is ignored if 'keyStore' is set.
to string To address.
stepLimit string (optional) stepLimit value. Default is 0x3000000.
deploy dict Options for deploy command.
deploy.mode string Deploy mode.
install: new SCORE deployment.
update: update the SCORE that was previously deployed.
deploy.scoreParams dict Parameters to be passed to on_install() or on_update()
deploy.from string Address of the SCORE deployer
Optional. This value will override "from" value. If not given, "from" value will be used.
deploy.to string Used when update SCORE (The address of the SCORE being updated).<br/>In the case of "install" mode, the address should be 'cx0000~'.
Optional. This value will override "to" value. If not given, "to" value will be used.
txresult dict Options for txresult command.
You can define command options in a dict.
transfer dict Options for transfer command.
You can define command options in a dict.

Following CLI commands and options can be defined in the configuration file.

Command Options
deploy uri, nid, keyStore, from, to, mode, scoreParams, stepLimit
transfer uri, nid, keyStore, from, stepLimit
txresult
balance
totalsupply
scoreapi
txbyhash
lastblock
blockbyhash
blockbyheight
sendtx
call
uri

keystore_test1

Keystore file for test account. Password of this keystore file is 'test1_Account'.

You can find the test account 'test1' in tbears_server_config.json and test account has enough balance to test.

Do not transfer ICX or any token to 'test1' account.

{
    "address": "hxe7af5fcfd8dfc67530a01a0e403882687528dfcb",
    "crypto": {
        "cipher": "aes-128-ctr",
        "cipherparams": {
            "iv": "dc0762c56ca56cd06038df5051c9e23e"
        },
        "ciphertext": "7cc40efac0b14eaf56f951c9c9620f9f34bac548175e85052aa9f753423dc984",
        "kdf": "scrypt",
        "kdfparams": {
            "dklen": 32,
            "n": 16384,
            "r": 1,
            "p": 8,
            "salt": "380c00457be5fd1c244f5745c322b21f"
        },
        "mac": "157dda6fb7092df62ff93411bed54e5a64dbf06c1aae3b375d356061a9c3dfd1"
    },
    "id": "e2ca66c6-b8de-4413-82cb-52c2a2200b8d",
    "version": 3,
    "coinType": "icx"
}

Reference

License

This project follows the Apache 2.0 License. Please refer to LICENSE for details.