- Setup Nodeos,Cleos and Kesod
Follow this tutorial for that
- Create an account with name cryptosurvey using following command
cleos create account eosio cryptosurvey (paste eosio public key here) -p eosio@active
- Setting eosio.token contract
Follow this
- Download the Source code from git
- Go to folder Cryptosurvey in contracts
- Compile the code with following command
eosio-cpp --abigen cryptosurvey.cpp -o cryptosurvey.wasm
- Set cryptosurvey contract
cleos set contract cryptosurvey . -p cryptosurvey@active
- Give cryptosurvey account eosio.code permision.
cleos set account permission cryptosurvey active --add-code
After completing the last step our cryptosurvey contract will get deployed in our local blockchain, Now to push function in our contract we can follow two ways
-
Using normal cleos cli command
To get completely familiar with cleos it is recommanded to follow one of the smart contract course on this site.
-
Using the functionFile.js in JSFiles folder.
Firstly install eosjs using: - npm install eosjs Then open functionFile.js and change the default key written at line no. 6
with the private key of the cryptosurvey account
Completion of last step finishes all the setup and now one can push action in contract.
All you need to do is just run functionFile.js and enter the name of the action you want to push.
To learn more about eosjs use this link