1. 程式人生 > >ubuntu16.04 eos 智慧合約(1)建立使用者,釋出一個hello合約

ubuntu16.04 eos 智慧合約(1)建立使用者,釋出一個hello合約

1.下載eos原始碼, sudo ./eosio_build.sh

2.啟動nodeos,第一次啟動, 指定檔案目錄, 生成config.ini

./nodes -d data --config-dir data -c config.ini

關閉,修改config.ini,

# the endpoint upon which to listen for incoming connections (eosio::bnet_plugin)
bnet-endpoint = 0.0.0.0:4321

# this peer will request only irreversible blocks from other nodes (eosio::bnet_plugin)
bnet-follow-irreversible = 0

# the number of threads to use to process network messages (eosio::bnet_plugin)
# bnet-threads = 

# remote endpoint of other node to connect to; Use multiple bnet-connect options as needed to compose a network (eosio::bnet_plugin)
# bnet-connect = 

# this peer will request no pending transactions from other nodes (eosio::bnet_plugin)
bnet-no-trx = false

# The string used to format peers when logging messages about them.  Variables are escaped with ${<variable name>}.
# Available Variables:
#    _name  	self-reported name
# 
#    _id    	self-reported ID (Public Key)
# 
#    _ip    	remote IP address of peer
# 
#    _port  	remote port number of peer
# 
#    _lip   	local IP address connected to peer
# 
#    _lport 	local port number connected to peer
# 
#  (eosio::bnet_plugin)
bnet-peer-log-format = ["${_name}" ${_ip}:${_port}]

# the location of the blocks directory (absolute path or relative to application data dir) (eosio::chain_plugin)
blocks-dir = "blocks"

# Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints. (eosio::chain_plugin)
# checkpoint = 

# Override default WASM runtime (eosio::chain_plugin)
# wasm-runtime = 

# Override default maximum ABI serialization time allowed in ms (eosio::chain_plugin)
abi-serializer-max-time-ms = 15000

# Maximum size (in MiB) of the chain state database (eosio::chain_plugin)
chain-state-db-size-mb = 1024

# Safely shut down node when free space remaining in the chain state database drops below this size (in MiB). (eosio::chain_plugin)
chain-state-db-guard-size-mb = 128

# Maximum size (in MiB) of the reversible blocks database (eosio::chain_plugin)
reversible-blocks-db-size-mb = 340

# Safely shut down node when free space remaining in the reverseible blocks database drops below this size (in MiB). (eosio::chain_plugin)
reversible-blocks-db-guard-size-mb = 2

# print contract's output to console (eosio::chain_plugin)
contracts-console = false

# Account added to actor whitelist (may specify multiple times) (eosio::chain_plugin)
# actor-whitelist = 

# Account added to actor blacklist (may specify multiple times) (eosio::chain_plugin)
# actor-blacklist = 

# Contract account added to contract whitelist (may specify multiple times) (eosio::chain_plugin)
# contract-whitelist = 

# Contract account added to contract blacklist (may specify multiple times) (eosio::chain_plugin)
# contract-blacklist = 

# Action (in the form code::action) added to action blacklist (may specify multiple times) (eosio::chain_plugin)
# action-blacklist = 

# Public key added to blacklist of keys that should not be included in authorities (may specify multiple times) (eosio::chain_plugin)
# key-blacklist = 

# Database read mode ("speculative", "head", or "read-only").
# In "speculative" mode database contains changes done up to the head block plus changes made by transactions not yet included to the blockchain.
# In "head" mode database contains changes done up to the current head block.
# In "read-only" mode database contains incoming block changes but no speculative transaction processing.
#  (eosio::chain_plugin)
read-mode = speculative

# Chain validation mode ("full" or "light").
# In "full" mode all incoming blocks will be fully validated.
# In "light" mode all incoming blocks headers will be fully validated; transactions in those validated blocks will be trusted 
#  (eosio::chain_plugin)
validation-mode = full

# Track actions which match receiver:action:actor. Actor may be blank to include all. Action and Actor both blank allows all from Recieiver. Receiver may not be blank. (eosio::history_plugin)
# filter-on = 

# Do not track actions which match receiver:action:actor. Action and Actor both blank excludes all from Reciever. Actor blank excludes all from reciever:action. Receiver may not be blank. (eosio::history_plugin)
# filter-out = 

# PEM encoded trusted root certificate (or path to file containing one) used to validate any TLS connections made.  (may specify multiple times)
#  (eosio::http_client_plugin)
# https-client-root-cert = 

# true: validate that the peer certificates are valid and trusted, false: ignore cert errors (eosio::http_client_plugin)
https-client-validate-peers = 1

# The local IP and port to listen for incoming http connections; set blank to disable. (eosio::http_plugin)
http-server-address = 127.0.0.1:8888

# The local IP and port to listen for incoming https connections; leave blank to disable. (eosio::http_plugin)
# https-server-address = 

# Filename with the certificate chain to present on https connections. PEM format. Required for https. (eosio::http_plugin)
# https-certificate-chain-file = 

# Filename with https private key in PEM format. Required for https (eosio::http_plugin)
# https-private-key-file = 

# Specify the Access-Control-Allow-Origin to be returned on each request. (eosio::http_plugin)
# access-control-allow-origin = 

# Specify the Access-Control-Allow-Headers to be returned on each request. (eosio::http_plugin)
# access-control-allow-headers = 

# Specify the Access-Control-Max-Age to be returned on each request. (eosio::http_plugin)
# access-control-max-age = 

# Specify if Access-Control-Allow-Credentials: true should be returned on each request. (eosio::http_plugin)
access-control-allow-credentials = false

# The maximum body size in bytes allowed for incoming RPC requests (eosio::http_plugin)
max-body-size = 1048576

# Append the error log to HTTP responses (eosio::http_plugin)
verbose-http-errors = false

# If set to false, then any incoming "Host" header is considered valid (eosio::http_plugin)
http-validate-host = 1

# Additionaly acceptable values for the "Host" header of incoming HTTP requests, can be specified multiple times.  Includes http/s_server_address by default. (eosio::http_plugin)
# http-alias = 

# The maximum number of pending login requests (eosio::login_plugin)
max-login-requests = 1000000

# The maximum timeout for pending login requests (in seconds) (eosio::login_plugin)
max-login-timeout = 60

# The target queue size between nodeos and MongoDB plugin thread. (eosio::mongo_db_plugin)
mongodb-queue-size = 1024

# The maximum size of the abi cache for serializing data. (eosio::mongo_db_plugin)
mongodb-abi-cache-size = 2048

# Required with --replay-blockchain, --hard-replay-blockchain, or --delete-all-blocks to wipe mongo db.This option required to prevent accidental wipe of mongo db. (eosio::mongo_db_plugin)
mongodb-wipe = false

# If specified then only abi data pushed to mongodb until specified block is reached. (eosio::mongo_db_plugin)
mongodb-block-start = 0

# MongoDB URI connection string, see: https://docs.mongodb.com/master/reference/connection-string/. If not specified then plugin is disabled. Default database 'EOS' is used if not specified in URI. Example: mongodb://127.0.0.1:27017/EOS (eosio::mongo_db_plugin)
# mongodb-uri = 

# Enables storing blocks in mongodb. (eosio::mongo_db_plugin)
mongodb-store-blocks = 1

# Enables storing block state in mongodb. (eosio::mongo_db_plugin)
mongodb-store-block-states = 1

# Enables storing transactions in mongodb. (eosio::mongo_db_plugin)
mongodb-store-transactions = 1

# Enables storing transaction traces in mongodb. (eosio::mongo_db_plugin)
mongodb-store-transaction-traces = 1

# Enables storing action traces in mongodb. (eosio::mongo_db_plugin)
mongodb-store-action-traces = 1

# Mongodb: Track actions which match receiver:action:actor. Actor may be blank to include all. Receiver and Action may not be blank. Default is * include everything. (eosio::mongo_db_plugin)
# mongodb-filter-on = 

# Mongodb: Do not track actions which match receiver:action:actor. Action and Actor both blank excludes all from reciever. Actor blank excludes all from reciever:action. Receiver may not be blank. (eosio::mongo_db_plugin)
# mongodb-filter-out = 

# The actual host:port used to listen for incoming p2p connections. (eosio::net_plugin)
p2p-listen-endpoint = 0.0.0.0:9876

# An externally accessible host:port for identifying this node. Defaults to p2p-listen-endpoint. (eosio::net_plugin)
# p2p-server-address = 

# The public endpoint of a peer node to connect to. Use multiple p2p-peer-address options as needed to compose a network. (eosio::net_plugin)
# p2p-peer-address = 

# Maximum number of client nodes from any single IP address (eosio::net_plugin)
p2p-max-nodes-per-host = 1

# The name supplied to identify this node amongst the peers. (eosio::net_plugin)
agent-name = "EOS Test Agent"

# 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. (eosio::net_plugin)
allowed-connection = any

# Optional public key of peer allowed to connect.  May be used multiple times. (eosio::net_plugin)
# peer-key = 

# Tuple of [PublicKey, WIF private key] (may specify multiple times) (eosio::net_plugin)
# peer-private-key = 

# Maximum number of clients from which connections are accepted, use 0 for no limit (eosio::net_plugin)
max-clients = 25

# number of seconds to wait before cleaning up dead connections (eosio::net_plugin)
connection-cleanup-period = 30

# max connection cleanup time per cleanup call in millisec (eosio::net_plugin)
max-cleanup-time-msec = 10

# True to require exact match of peer network version. (eosio::net_plugin)
network-version-match = 0

# number of blocks to retrieve in a chunk from any individual peer during synchronization (eosio::net_plugin)
sync-fetch-span = 100

# maximum sizes of transaction or block messages that are sent without first sending a notice (eosio::net_plugin)
max-implicit-request = 1500

# Enable expirimental socket read watermark optimization (eosio::net_plugin)
use-socket-read-watermark = 0

# The string used to format peers when logging messages about them.  Variables are escaped with ${<variable name>}.
# Available Variables:
#    _name  	self-reported name
# 
#    _id    	self-reported ID (64 hex characters)
# 
#    _sid   	first 8 characters of _peer.id
# 
#    _ip    	remote IP address of peer
# 
#    _port  	remote port number of peer
# 
#    _lip   	local IP address connected to peer
# 
#    _lport 	local port number connected to peer
# 
#  (eosio::net_plugin)
peer-log-format = ["${_name}" ${_ip}:${_port}]

# Enable block production, even if the chain is stale. (eosio::producer_plugin)
enable-stale-production = true

# Start this node in a state where production is paused (eosio::producer_plugin)
pause-on-startup = false

# Limits the maximum time (in milliseconds) that is allowed a pushed transaction's code to execute before being considered invalid (eosio::producer_plugin)
max-transaction-time = 30

# Limits the maximum age (in seconds) of the DPOS Irreversible Block for a chain this node will produce blocks on (use negative value to indicate unlimited) (eosio::producer_plugin)
max-irreversible-block-age = -1

# ID of producer controlled by this node (e.g. inita; may specify multiple times) (eosio::producer_plugin)
producer-name = eosio

# (DEPRECATED - Use signature-provider instead) Tuple of [public key, WIF private key] (may specify multiple times) (eosio::producer_plugin)
# private-key = 

# Key=Value pairs in the form <public-key>=<provider-spec>
# Where:
#    <public-key>    	is a string form of a vaild EOSIO public key
# 
#    <provider-spec> 	is a string in the form <provider-type>:<data>
# 
#    <provider-type> 	is KEY, or KEOSD
# 
#    KEY:<data>      	is a string form of a valid EOSIO private key which maps to the provided public key
# 
#    KEOSD:<data>    	is the URL where keosd is available and the approptiate wallet(s) are unlocked (eosio::producer_plugin)
signature-provider = EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV=KEY:5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

# Limits the maximum time (in milliseconds) that is allowd for sending blocks to a keosd provider for signing (eosio::producer_plugin)
keosd-provider-timeout = 5

# account that can not access to extended CPU/NET virtual resources (eosio::producer_plugin)
# greylist-account = 

# offset of non last block producing time in micro second. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later (eosio::producer_plugin)
produce-time-offset-us = 0

# offset of last block producing time in micro second. Negative number results in blocks to go out sooner, and positive number results in blocks to go out later (eosio::producer_plugin)
last-block-time-offset-us = 0

# ratio between incoming transations and deferred transactions when both are exhausted (eosio::producer_plugin)
incoming-defer-ratio = 1

# Lag in number of blocks from the head block when selecting the reference block for transactions (-1 means Last Irreversible Block) (eosio::txn_test_gen_plugin)
txn-reference-block-lag = 0

# Plugin(s) to enable, may be specified multiple times
plugin = eosio::chain_api_plugin

主要是修改plugin 和producer, 其他基本可以不變。

4.執行./cleos。 生成私鑰2個

./cleos create key --to-console
Private key: 5JMrxypcK9oiLhxz7kwdQUFWwhaW3zkLUMrNXM7uXRJb9pEER4n
Public key: EOS6AR3uU6mujSdLn3SKatiGRu2nsSxUWNZtZsowfNUxKajjtQQCC

./cleos create key --to-console
Private key: 5Jma8VeQEuGUJcgwZjphd6rARxbgR3RrYUY4caRmn3Z43zeusTg
Public key: EOS6Nnm5uNv6ehD3c4eoTKXDVKJrASTTyXqXs2d3HKnTKkKA1hAxh

5.生成一個錢包, 儲存記錄密碼

./cleos wallet create -n one1 --to-console
Creating wallet: one1
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5Hv4ppVQn87f1zdaWYDm4J2gQfwBhFob3jN2Gdgy8kHfSNL5BQx"

6.匯入私鑰, 第一個為eosio的私鑰。一個官方賬號

./cleos wallet import -n one1 --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3

./cleos wallet import -n one1 --private-key 5JMrxypcK9oiLhxz7kwdQUFWwhaW3zkLUMrNXM7uXRJb9pEER4n

./cleos wallet import -n one1 --private-key 5Jma8VeQEuGUJcgwZjphd6rARxbgR3RrYUY4caRmn3Z43zeusTg

7.建立使用者, 建立者, 建立的使用者名稱, 2個公鑰

./cleos create account eosio friday EOS6AR3uU6mujSdLn3SKatiGRu2nsSxUWNZtZsowfNUxKajjtQQCC EOS6Nnm5uNv6ehD3c4eoTKXDVKJrASTTyXqXs2d3HKnTKkKA1hAxh 

8.找到原始碼自帶的合約,eos/contract/hello 下, 此處更清楚瞭解流程,只複製hello.cpp檔案

9.需要生成hello.abi. hello.wasm  hello.wast 。

//生成wast
./eosiocpp -o contract/hello/hello.wast contract/hello/hello.cpp

//生成abi
./eosiocpp -g contract/hello/hello.abi contract/hello/hello.cpp
2018-08-31T02:46:14.841 thread-0   abi_generator.hpp:68          ricardian_contracts  ] Warning, no ricardian clauses found for hello

2018-08-31T02:46:14.841 thread-0   abi_generator.hpp:75          ricardian_contracts  ] Warning, no ricardian contract found for hi

10.釋出合約到鏈上, 引數說明, 釋出的賬戶, 合約的路徑, wasm檔案路徑, abi檔案的路徑, 具體-h

./cleos set contract friday contract/hello/ hello.wasm  helle.abi
Reading WASM from contract/hello/hello.wasm...
Publishing contract...
executed transaction: 5707f5393f40547ae8372f0d79515cda9c029644b5b3a8890ed0c8d335d7fcc4  1800 bytes  726 us
#         eosio <= eosio::setcode               {"account":"friday","vmtype":0,"vmversion":0,"code":"0061736d01000000013b0c60027f7e006000017e60027e7...
#         eosio <= eosio::setabi                {"account":"friday","abi":"0e656f73696f3a3a6162692f312e30000102686900010475736572046e616d65010000000...

11.執行合約

./cleos push action friday hi '[user]' -p friday
executed transaction: 56e621af875e21f8b4bb96e0a398b6d5fda98242e86904389c6b9e4e9f2c8f12  104 bytes  397 us
#        friday <= friday::hi                   {"user":"user"}
warning: transaction executed locally, but may not be confirmed by the network yet    ]

12.建立使用者,釋出合約,需要往鏈上發資料的, 可以看到資料trsx>0

2018-08-31T03:08:31.500 thread-0   producer_plugin.cpp:1302      produce_block        ] Produced block 000011088eeaef7b... #4360 @ 2018-08-31T03:08:31.500 signed by eosio [trxs: 1, lib: 4359, confirmed: 0]

13.多看看help, 幫助還是很詳細的。

相關推薦

ubuntu16.04 eos 智慧合約(1建立使用者釋出一個hello合約

1.下載eos原始碼, sudo ./eosio_build.sh 2.啟動nodeos,第一次啟動, 指定檔案目錄, 生成config.ini ./nodes -d data --config-dir data -c config.ini 關閉,修改config.in

SmartSql使用教程(1——初探建立一個簡單的CURD介面服務

一、引言 最近SmartSql被正式引入到了NCC,藉著這個契機寫一個使用教程系列   二、SmartSql簡介[摘自官方文件] 1. SmartSql是什麼? SmartSql = MyBatis + Cache(Memory | Redis) + R/W Splitting +Dy

配置YOLO2(ubuntu16.04+cuda8.0+opencv3.1.0

href seconds make fun put ges jre 成功 下載 要求已經安裝好了CUDA 8.0 以及OpenCV3.1.0 YOLO官方網站 配置darknet git clone https://github.com/pjreddie/dark

ubuntu16.04+cuda8.0+cudnn5.1+caffe 安裝(基於獨立主機&整合顯示卡>X1080Ti

最近開始配置自己的深度學習主機,由於之前只在筆記本上和單顯示卡主機上安裝過,所以可以說是zero經驗,以至於很多問題不瞭解都當成了bug,故為了方便以後的自己以及大眾,特在此寫下post一篇。(由於可能會有很多的問題我沒有遇到但各位可能遇到,故在文末貼出其他的安裝連結,請自

ubuntu16.04下gmt5.4.1的安裝

python -i sts .bashrc -1 fig 新版本 linux con 1 參考具神博客http://seisman.info/install-gmt5.2.x-under-linux.html https://github.com/gmt-china/gm

ubuntu16.04搭建docker_1.13.1私有倉庫

ubuntu16.04 docker 私有倉庫 registry 1、配置docker的國內加速器docker版本為1.13.1需要配置一下daemon.json配置阿裏雲的docker加速器:wangpeng@ubuntu:~$ sudo vim /etc/docker/daemon.jso

Ubuntu16.04+CUDA8.0+cuDNN5.1+Python2.7+TensorFlow1.2.0環境搭建

選擇 per orf stop lis option amd64 pan repo 軟件版本說明:我選的Linux系統是Ubuntu16.04,CUDA用的8.0,Ubuntu16.04+CUDA8.0+cuDNN5.1+Python2.7只支持TensorFlow1.3.

ubuntu16.04編譯opencv3.4.1和contrib遇到的錯誤及解決方法

Cmake error at opencv_contrib-master/modules/datasets/CMakeLists.txt:5 (ocv_append_source_files_cxx_compiler_options): Unknown CMake command "ocv_

ubuntu16.04原始碼安裝opencv3.1.0

文章目錄 原始碼準備 安裝依賴 編譯、安裝 測試一下 原始碼準備 下載原始碼,opencv官網,得到 .zip的壓縮檔案(預設在~/Downloads下), 進入Downloads檔案下,解壓

解決Ubuntu16.04 Qt 5.11.1 Creator (enterprise) 無法輸入中文的問題

1.安裝fcitx-frontend-qt5 $ sudo apt-get install fcitx-frontend-qt5 2.找到 libfcitxplatforminputcontextplugin.so $ cd /usr/lib/x8

Ubuntu16.04+CUDA9.0+CUDNNv7.1+opencv3.4.0+anaconda3+Matlab 2017a+caffe安裝

Ubuntu16.04+CUDA9.0+CUDNNv7.1+opencv3.4.0+anaconda3+Matlab 2017a的相關安裝配置參見之前的部落格。 接下來直接進入caffe的安裝配置環節

ubuntu16.04 LNMP搭建 php7.1

sudo apt-get update sudo apt-get install mysql-server mysql-client  sudo apt-add-repository ppa:ondrej/php sudo apt-get update sudo apt-get

轉 :ubuntu16.04+Tensorflow—GPU1.4.1+CUDA8.0+CUDNNv6.0 親測有用

之前按照這篇部落格的內容配置過深度學習的環境,好久沒用忘了,趁現在想起來趕快碼起來,下次就不用找了,再次感謝博主的分享! 牢騷 上來必須牢騷一下這幾天的裝機感受,準確的說是

ubuntu16.04安裝opencv3.4.1

安裝Eigen3 sudo apt-get install libeigen3-dev #拷貝 sudo cp -r /usr/local/include/eigen3/Eigen /usr/local/include 安裝依賴項 sudo apt-get

ubuntu16.04遇到坑筆記1--乙太網連結

裝ubuntu16.04為之後深度學習做準備,剛裝好linux後自己乙太網有線連結總是掉線,每隔10幾秒斷一次,無比心煩。網上很多解決方法都試過,因裝置而異,把找到的可以解決自己的問題的部落格放上(忘記截圖了,只放解決方法): 1,ubuntu下設定靜態ip方法

樹莓派3B+安裝Ubuntu16.04系統(64位

目錄 系統下載 補丁 刷系統 換源 無線 U盤掛載 系統下載 感謝公眾號:樹莓派愛好者基地。更多系資源請關注公眾號。 Ubuntu16.04系統 補丁 解決關機問題,下載好系統後,直接在根目錄替換即可 刷系統 樹莓派安裝系統過程資源豐

ubuntu16.04刪除cuda 9.1

以下為ubuntu16.04中刪除cuda9.1的方法: # --purge選項會將配置檔案、資料庫等刪除 $ sudo apt-get autoremove --purge cuda # 檢視安裝了哪些cuda相關的庫,可以用以下指令 $ sudo dpkg -l |gr

Ubuntu16.04 配置 caffe(GPU詳細步驟

編者語:如果你想深入研究深度學習,強烈建議你有一塊好的顯示卡。caffe支援cpu、gpu兩個版本,強烈建議使用gpu版本訓練模型(因為速度真的非常快)。由於gpu版本需要安裝cuda和cudnn,所以強烈建議使用的顯示卡計算能力大於3.0,顯示卡計算能力請參考https:

ubuntu16.04安裝opencv3.4.1教程

最近opencv3.4.1釋出了,想換個新的試試鮮,於是把配置的過程通過博文的方式記錄下來,方便查閱。 本教程原為3.3.0,但經過博主親測,3.4.0、3.4.1皆適用 1.去官網下載opencv,在本教程中選用的時opencv3.4.1,其他

深度學習環境安裝注意事項01(Ubuntu16.04+caffe+1060(6G

1:顯示卡驅動安裝 1)https://www.geforce.com/drivers 去官網找驅動下載安裝 2)直接在軟體與更新中驅動更新安裝。(最新的版本不一定是最適合的) 2:cuda安裝 1)這個連結https://developer.nvidia.com/cuda