download source code
git clone https://github.com/EOSIO/eos --recursive
view version
git tag
Switch to the latest version branch
git checkout v1.2.1
execute script
cd /www/eos-env/eos/
sudo ./eosio_build.sh
When it starts executing, it will download a lot of things, including boost, mongodb, secp256k1, LLVM, etc.
sudo ./eosio_install.sh
Modify the configuration file
cd ~/.local/share/eosio/nodeos/config
vim config. ini
http-server-address = 0.0.0.0:8888
contracts-console = true
enable-stale-production = true
producer-name = eosio
private-key = ["EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV","5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3"]
plugin = eosio::chain_api_plugin
plugin = eosio::history_api_plugin
plugin = eosio::chain_plugin
plugin = eosio::history_plugin
plugin = eosio::net_plugin
plugin = eosio::net_api_plugin
Start EOS
cd /www/eos-env/eos
vim start.sh
nohup nodeos -e -p eosio --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --contracts-console &
chmod 777 start.sh
-e: enable-stale-production, refer to the relevant instructions in config.ini above. Equivalent to true after setting.
-p: producer-name, a name "eosio" is given for the block producer name.
--plugin: It is the last configuration field of ~/.local/share/eosio/nodeos/config/config.ini.
--contracts-console print logs to console
Because the plugin is configured in config.ini, it can only be started with nodeos
nohup nodeos &
The node is functioning normally. . . .
Create a smart contract
Create a smart contract
eosiocpp -n helloworld
compile wast
eosiocpp -o helloworld/helloworld.wast helloworld/helloworld.cpp
compile abi
eosiocpp -g helloworld/helloworld.abi helloworld/helloworld.cpp
Deploy smart contracts
create wallet
cleos wallet create -n fish1208 --to-console
Creating wallet: fish1208
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5KiK9GU2TVo2TpA9Ragpzygj8s54AiCxBi2gDVzgUzWZCxbHZsS"
Import the master key of the initial account eosio to the wallet
cleos wallet import -n fish1208 --private-key 5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3
imported private key for: EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV
All new blockchains are initiated by the master key, the only initial account: eosio. To interact with the blockchain, the private key of this initial account needs to be imported into your wallet.
view wallet
cleos wallet list
With * means the wallet is unlocked; without * means the wallet is locked
create key
cleos create key --to-console
Private key: 5JZEmy65HqCu1iobB98hA7ca1NYzRtK28gqWyonC25cUA54EmJS
Public key: EOS8jdARRTMt1gFkKJwccdCPnkXJDi2b3sJSQuY3Db7whEBhFaF2X
Import the private key into the wallet
cleos wallet import -n fish1208 --private-key 5JZEmy65HqCu1iobB98hA7ca1NYzRtK28gqWyonC25cUA54EmJS
imported private key for: EOS8jdARRTMt1gFkKJwccdCPnkXJDi2b3sJSQuY3Db7whEBhFaF2X
Check the private key import status
cleos wallet keys
create user account
cleos create account eosio fish EOS8jdARRTMt1gFkKJwccdCPnkXJDi2b3sJSQuY3Db7whEBhFaF2X EOS8jdARRTMt1gFkKJwccdCPnkXJDi2b3sJSQuY3Db7whEBhFaF2X
Bind the smart contract to the account
cleos set contract fish hello -p fish
The hello folder contains all the files of the contract. cpp .abi .wast
hello -p fish specifies the path and specifies the encrypted account
Execute smart contract functions
cleos push action fish hi '["1234"]' -p fish
Call the hi function in the hello contract
wallet unlock
cleos wallet unlock -n fish1208 --password PW5KiK9GU2TVo2TpA9Ragpzygj8s54AiCxBi2gDVzgUzWZCxbHZsS
wallet lock
cleos wallet lock -n fish1208