├── .env.example ├── .gitignore ├── README.md ├── data-dir ├── config.ini └── genesis.json ├── docker-compose.yml └── initial.sh /.env.example: -------------------------------------------------------------------------------- 1 | EOSIO_VERSION=20180525 2 | 3 | BLOCK_DATA_PATH=./block-data 4 | WALLET_PATH=./wallet 5 | 6 | HTTP_PORT=8888 7 | P2P_PORT=9876 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | block-data/ 3 | data-dir/contracts/ 4 | wallet/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 史上最简单EOS docker配置 2 | 3 | ## 环境变量 4 | 复制`.env.example`到`.env`,配置环境变量 5 | - **EOSIO_VERSION** `eosio/eos`镜像版本,完整列表查看[镜像仓库](https://hub.docker.com/r/eosio/eos/tags/) 6 | - **BLOCK_DATA_PATH** 块数据本地挂载路径 7 | - **HTTP_PORT** 本地HTTP映射端口 8 | - **P2P_PORT** 本地P2P映射端口 9 | 10 | ## 配置 11 | - 修改`config/`文件夹中的配置 12 | 13 | ## 启动 14 | ```shell 15 | $ docker-compose up -d 16 | ``` 17 | 18 | ## 运行cleos命令 19 | 通过设置一个别名来运行`cleos`命令 20 | ```shell 21 | $ alias cleos='docker-compose exec keosd cleos -u http://nodeosd:8888 --wallet-url http://localhost:8888' 22 | $ cleos get info 23 | ``` 24 | 25 | ## 部署HELLO合约 26 | > 确保在此之前已经部署系统合约并创建`hello`账号 27 | 28 | ```shell 29 | $ cleos set contract hello data-dir/contracts/hello -p hello 30 | ``` 31 | 32 | ## 部署自定义合约 33 | 复制自定义合约到`data-dir/contracts`中 34 | ```shell 35 | $ cleos set contract custom data-dir/contracts/CUSTOM_CONTRACT -p custom 36 | ``` -------------------------------------------------------------------------------- /data-dir/config.ini: -------------------------------------------------------------------------------- 1 | # Track only transactions whose scopes involve the listed accounts. Default is to track all transactions. 2 | # filter_on_accounts = 3 | 4 | # Limits the maximum time (in milliseconds) processing a single get_transactions call. 5 | get-transactions-time-limit = 3 6 | 7 | # File to read Genesis State from 8 | genesis-json = /opt/eosio/bin/data-dir/genesis.json 9 | 10 | # override the initial timestamp in the Genesis State file 11 | # genesis-timestamp = 12 | 13 | # the location of the block log (absolute path or relative to application data dir) 14 | block-log-dir = "blocks" 15 | 16 | # Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. 17 | # checkpoint = 18 | 19 | # the location of the chain shared memory files (absolute path or relative to application data dir) 20 | shared-file-dir = "blockchain" 21 | 22 | # Minimum size MB of database shared memory file 23 | shared-file-size = 8192 24 | 25 | # The local IP and port to listen for incoming http connections. 26 | http-server-address = 0.0.0.0:8888 27 | 28 | # Specify the Access-Control-Allow-Origin to be returned on each request. 29 | # access-control-allow-origin = 30 | 31 | # Specify the Access-Control-Allow-Headers to be returned on each request. 32 | # access-control-allow-headers = 33 | 34 | # Specify if Access-Control-Allow-Credentials: true should be returned on each request. 35 | access-control-allow-credentials = false 36 | 37 | # The actual host:port used to listen for incoming p2p connections. 38 | p2p-listen-endpoint = 0.0.0.0:9876 39 | 40 | # An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint. 41 | # p2p-server-address = 42 | 43 | # The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network. 44 | # p2p-peer-address = 45 | 46 | # The name supplied to identify this node amongst the peers. 47 | agent-name = "EOS Test Agent" 48 | 49 | # True to always send full blocks, false to send block summaries 50 | send-whole-blocks = 1 51 | 52 | # Can be 'any' or 'producers' or 'specified' or 'none'. If 'specified', peer-key must be specified at least once. If only 'producers', peer-key is not required. 'producers' and 'specified' may be combined. 53 | allowed-connection = any 54 | 55 | # Optional public key of peer allowed to connect. May be used multiple times. 56 | # peer-key = 57 | 58 | # Tuple of [PublicKey, WIF private key] (may specify multiple times) 59 | # peer-private-key = 60 | # Log level: one of 'all', 'debug', 'info', 'warn', 'error', or 'off' 61 | log-level-net-plugin = info 62 | 63 | # Maximum number of clients from which connections are accepted, use 0 for no limit 64 | max-clients = 25 65 | 66 | # number of seconds to wait before cleaning up dead connections 67 | connection-cleanup-period = 30 68 | 69 | # True to require exact match of peer network version. 70 | network-version-match = 0 71 | 72 | # Enable block production, even if the chain is stale. 73 | enable-stale-production = true 74 | 75 | # Percent of producers (0-100) that must be participating in order to produce blocks 76 | required-participation = 33 77 | 78 | # ID of producer controlled by this node (e.g. inita; may specify multiple times) 79 | # producer-name = 80 | 81 | # Tuple of [public key, WIF private key] (may specify multiple times) 82 | private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"] 83 | 84 | # Plugin(s) to enable, may be specified multiple times 85 | # plugin = 86 | # Plugin(s) to enable, may be specified multiple times 87 | plugin = eosio::producer_plugin 88 | plugin = eosio::chain_api_plugin 89 | plugin = eosio::wallet_api_plugin 90 | plugin = eosio::history_api_plugin 91 | plugin = eosio::http_plugin 92 | # plugin = eosio::mongo_db_plugin 93 | 94 | # Enable block production with the testnet producers 95 | producer-name = eosio 96 | -------------------------------------------------------------------------------- /data-dir/genesis.json: -------------------------------------------------------------------------------- 1 | { 2 | "initial_timestamp": "2018-03-02T12:00:00.000", 3 | "initial_key": "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV", 4 | "initial_configuration": { 5 | "max_block_net_usage": 1048576, 6 | "target_block_net_usage_pct": 1000, 7 | "max_transaction_net_usage": 524288, 8 | "base_per_transaction_net_usage": 12, 9 | "net_usage_leeway": 500, 10 | "context_free_discount_net_usage_num": 20, 11 | "context_free_discount_net_usage_den": 100, 12 | "max_block_cpu_usage": 200000, 13 | "target_block_cpu_usage_pct": 100, 14 | "max_transaction_cpu_usage": 150000, 15 | "min_transaction_cpu_usage": 100, 16 | "max_transaction_lifetime": 3600, 17 | "deferred_trx_expiration_window": 600, 18 | "max_transaction_delay": 3888000, 19 | "max_inline_action_size": 4096, 20 | "max_inline_action_depth": 4, 21 | "max_authority_depth": 6 22 | }, 23 | "initial_chain_id": "0000000000000000000000000000000000000000000000000000000000000000" 24 | } -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | 3 | services: 4 | nodeosd: 5 | image: eosio/eos:${EOSIO_VERSION} 6 | command: /opt/eosio/bin/nodeosd.sh 7 | working_dir: 8 | /opt/eosio/bin/ 9 | ports: 10 | - ${HTTP_PORT}:8888 11 | - ${P2P_PORT}:9876 12 | expose: 13 | - "8888" 14 | volumes: 15 | - ./data-dir:/opt/eosio/bin/data-dir 16 | - ${BLOCK_DATA_PATH}:/root/.local/share/eosio/nodeos/data 17 | networks: 18 | - frontend 19 | - backend 20 | keosd: 21 | image: eosio/eos:${EOSIO_VERSION} 22 | command: /opt/eosio/bin/keosd --wallet-dir /opt/eosio/bin/wallet-dir 23 | working_dir: 24 | /opt/eosio/bin/ 25 | volumes: 26 | - ./data-dir:/opt/eosio/bin/data-dir 27 | - ${WALLET_PATH}:/opt/eosio/bin/wallet-dir 28 | networks: 29 | - backend 30 | networks: 31 | frontend: 32 | driver: "bridge" 33 | backend: 34 | driver: "bridge" -------------------------------------------------------------------------------- /initial.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | alias cleos='docker-compose exec keosd cleos -u http://nodeosd:8888 --wallet-url http://localhost:8888' 3 | cleos wallet create > wallet.info 4 | cleos create account eosio eosio.bios EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV 5 | cleos set contract eosio.bios data-dir/contracts/eosio.bios -p eosio.bios 6 | cleos create account eosio eosio.msig EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV 7 | cleos set contract eosio.msig data-dir/contracts/eosio.msig -p eosio.msig 8 | cleos create account eosio eosio.token EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV 9 | cleos set contract eosio.token data-dir/contracts/eosio.token -p eosio.token 10 | cleos push action eosio.token create '{"issuer":"eosio", "maximum_supply":"1000000000.0000 SYS", "can_freeze":0, "can_recall":0, "can_whitelist":0}' -p eosio.token 11 | cleos push action eosio.token issue '["eosio","1000000000.0000 SYS","deposit started"]' -p eosio 12 | cleos set contract eosio data-dir/contracts/eosio.system -p eosio 13 | --------------------------------------------------------------------------------