From 4a8240a99a3af12bd50e6dc6d1b9754f8428985d Mon Sep 17 00:00:00 2001 From: Eason Gao Date: Wed, 22 Sep 2021 00:14:08 +0800 Subject: [PATCH] docs: update README (#241) --- README.md | 58 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index cc968ee1e..9907a3582 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ There are two config files corresponding to mainnet and testnet located in `./de | center_id | The data center id. | null | | machine_id | The machine id. | null | | indexer_mode | Use indexer mode or not. | null | -| need_sync | Need synchronization parallelly or not. | True | +| need_sync | Need synchronization parallelly or not. | true | | rpc_thread_number | The number of threads allocated to rpc. | 2 | | flush_tx_pool_cache_interval | Flush transaction pool cache interval. | 300 | | | | | @@ -43,29 +43,29 @@ There are two config files corresponding to mainnet and testnet located in `./de | db_type | Database type. | null | | db_host | The database host. | null | | db_port | The database port. | null | -| Db_name | The database name. | null | +| db_name | The database name. | null | | db_user | The database user. | null | -| Password | The database password. | null | +| password | The database password. | null | | db_path | The RocksDB path. | null | | db_log_level | The database log level. | null | | cellbase_maturity | The epoch required for cellbase maturity. | 4 | | cheque_timeout | The epoch that reciever should claim cheque cell. | 6 | | | | | -| Network_config | | | +| network_config | | | | network_type | The Ckb type that mercury connected. | "ckb" | | ckb_uri | The Ckb node uri. | "http://127.0.0.1:8114" | | listen_uri | The mercury listening uri. | "127.0.0.1:8116" | | | | | -| Sync_config | | | -| sync_block_batch_size | The block batch size in synchronization. | Null | -| Max_task_count | The maximum task count in thread pool. | Null | +| sync_config | | | +| sync_block_batch_size | The block batch size in synchronization. | null | +| max_task_count | The maximum task count in thread pool. | null | | | | | -| Log_config | | | +| log_config | | | | log_level | The mercury log level. | "INFO" | | log_path | The path where the log file is stored. | "console" | -| use_split_file | Split log file or not. | False | +| use_split_file | Split log file or not. | false | | | | | -| Builtin_scripts | The builtin script information. | null | +| builtin_scripts | The builtin script information. | null | ### Run Mercury @@ -83,25 +83,51 @@ Edit the database config in config file. If you want to run via Docker, you shou - connect a ckb mainnet node ```shell -mercury -c devtools/config/mainnet_config.toml run +$ mercury -c devtools/config/mainnet_config.toml run ``` - connect a ckb testnet node ```shell -mercury -c devtools/config/testnet_config.toml run +$ mercury -c devtools/config/testnet_config.toml run ``` ##### Run via Docker +###### Running mercury development environment -```shell -docker-compose up -d +- step1 +Modify mercury to synchronize the execution environment of ckb. + +- step2 +Modify the runtime environment of ckb like this: + +```yml +environment: + CKB_NETWORK: mainnet ``` or +```yml +environment: + CKB_NETWORK: testnet +``` + +- step3 +```shell +$ docker-compose up -d +``` + +###### Run a mercury application via docker + +- step1 +```shell +$ docker build -t mercury . +``` + +- step2 ```shell -docker run -d -p 8116:8116 -v {user_config_path}:/app/devtools/config mercury:latest +$ docker run -d -p 8116:8116 -v {user_config_path}:/app/devtools/config mercury:latest ``` -#### 3. Call mercury rpc via ckb-sdk ([java](https://github.com/nervosnetwork/ckb-sdk-java) ,[go](https://github.com/nervosnetwork/ckb-sdk-go) ) +#### 3. Call mercury rpc via ckb-sdk ([java](https://github.com/nervosnetwork/ckb-sdk-java) , [go](https://github.com/nervosnetwork/ckb-sdk-go))