- Clone EOSIO repo recursively
git clone https://github.com/eosio/eos --recursive
- Go to the eos folder and run the eosio_build.sh script with the following command
sh ./eosio_build.sh darwin
Note: It could take quite some time before all the dependencies are installed and then built.
nodeos -e -p eosio --plugin eosio::wallet_api_plugin --plugin eosio::chain_api_plugin --plugin eosio::history_api_plugin --contracts-console --verbose-http-errors
- Creating a wallet
# cleos wallet create -n {wallet_name}
cleos wallet create -n factory
Note: Don't forget to save your password
- Generating keys
cleos create key
Note: Don't forget to save your generated keys
- Import the generated keys in the wallet
# OwnerKey = private_key_1
# ActiveKey = private_key_2
cleos wallet import --private-key={private_key_1} -n factory
cleos wallet import --private-key={private_key_2} -n factory
- Import the eosio private key in the wallet
cleos wallet import --private-key=5KQwrPbwdL6PhXujxW37FSSQZ1JiwsST4cqQzDeyXtP79zkvFD3 -n factory
- Creating new account
# cleos create account eosio {new_account_name} {public_OwnerKey} {public_ActiveKey}
# "eosio" is the name of the account who will create the new one
cleos create account eosio weyland {public_OwnerKey} {public_ActiveKey}
-
Creating the smart contract
-
Generating the WAST file
eosiocpp -o RobotFactory.wast RobotFactory.cpp
- Generating the ABI file
eosiocpp -g RobotFactory.abi RobotFactory.cpp
- Deploying the smart contract
# cleos set contract {account} {path_to_contract_folder} {path_to_.wast_file} {path_to_.abi_file}
cleos set contract weyland . RobotFactory.wast RobotFactory.abi
- Creating new robot
# cleos push action {account} {action_name} '{data}' -p {account}
cleos push action weyland create '{"account":"weyland","newRobot":{"series_number":14001992,"model":"A330","operating_system":"DX42","profession":"engineer","owner":"","manufactured":0}}' -p weyland
- Get robot by series number
cleos push action weyland getbyid '[14001992]' -p weyland
- Update robot OS
cleos push action weyland update '["weyland",14001995,"X99A"]' -p weyland
- Remove robot
cleos push action weyland remove '["weyland",14001995]' -p weyland
Series Number | Model | OS | Profession |
---|---|---|---|
14001992 | A330 | DX42 | engineer |
14001993 | A720 | DX49 | babysitter |
14001994 | U835 | D33R | farmer |
14001995 | XS33 | DZ4S | neurosurgeon |
14001996 | XS33 | X99A | cashier |