Deploying a NEP-5 smart contract (part 2)
Last week, we installed neo-boa and fixed up a NEP-5 smart-contract to make it our own! Finally, lets compile and deploy!
Step 1: compile the contract code
Open up a command prompt type ubuntu
, then sudo -i
. Continue on ~
cd neo-boa/
source venv/bin/activatecd ../smart-contract
python3.6 compile.py
**upon completion you will see ico_template.avm
Step 2: Import the contract — Using the same Ubuntu prompt:
cd ../neo-python
source venv/bin/activatenp-prompt -p <server IP>
Now that you are in the NEO prompt, open your admin wallet: open wallet testWallet1
import contract ../smart-contract/ico_template.avm "" 0710 05 True False# Fill out the contract details
[Contract Name] > nodis
[Contract Version] > 1
[Contract Author] > nodis
[Contract Email] > nodis
[Contract Description] > nodis
Your contract is now on the block-chain!
Step 3: Deployment time!
Currently, the tokens are all locked up in the contract. Ultimately, we need to call deploy()
(a function on the contract) to transfer all the tokens to the admin wallet! Our first task is to find the hash of the contract.
contract search <NODIS>
in our case, the script hash is 0x3ffb8a621f461559a90943986bc813b8fcf6ac0a
. now type:
testinvoke <contract hash> deploy []
Input your password when prompted to invoke on the network.
Done! Check out your newfound wealth by typing wallet
!
BONUS command: testinvoke <contract hash> name []
!
Awesome! The value is in hex, we can use an online tool to decipher it. Ours says ‘Nodis Token’.
Online tool: https://codebeautify.org/hex-string-converter
Nodis.io is a marketing platform for local business, generating engagement through small activities and rewarding users with cryptocurrency they can later spend on stores. Check us out and give us your feedback on Instagram, Facebook and Telegram!
Follow me Instagram and Facebook as well!
Next week’s guide: Simulate the ICO Crowd-Sale on NEO!