0
0

Note: This is not an offering, shilling, or anything else. Just tech talk.
I've dabbled in programming for years but I'm not very good at it... still, I wanted to learn more about tokens and contracts by creating my own token.
I present to you: Avatar AANG
It's only on rinkeby (testnet) because I'm just screwing around. It's also completely horribly written, not making use of any industry-standard libraries like open-zeppelin because what fun is that. Still, I feel pretty accomplished and this was a great step to actually understanding a bit of the tokens and technologies I'm putting my money into, and I only spent a day learning and toying with it. I'd encourage anyone with some coding skills to try it!
More details:
You can see the contract details on etherscan. I used Remix with Solidity 0.7.6.
I was able to add my AANG to MetaMask, and even send some to another test wallet! From there, I wrote some quick Python code to interact with the test wallet and validate the amounts on Rinkeby:
wallet_test % cat test.py import json import hashlib from web3 import Web3 from web3.middleware import geth_poa_middleware from dotenv import load_dotenv load_dotenv() import os INFURA_ACCESS_TOKEN = os.getenv("INFURA_ACCESS_TOKEN") INFURA_PROJECT = os.getenv("INFURA_PROJECT") WALLET_ADDRESS = os.getenv("WALLET_ADDRESS") WALLET_PRIVATE_KEY = os.getenv("WALLET_PRIVATE_KEY") C with open('aang.json') as f: CONTRACT_ABI = json.load(f) testnet = "https://:" + INFURA_ACCESS_TOKEN + "@rinkeby.infura.io/v3/" + INFURA_PROJECT web3 = Web3(Web3.HTTPProvider(testnet)); web3.middleware_onion.inject(geth_poa_middleware, layer=0) if web3.isConnected(): print("You are connected to the Ethereum test network.") balance = web3.eth.getBalance(WALLET_ADDRESS) print() print("Current Balances") print("----------------") print(str(web3.fromWei(balance, "ether")) + " ETH") AANG = web3.eth.contract(address=CONTRACT_ADDRESS, abi=CONTRACT_ABI) print(str(AANG.caller.balanceOf(WALLET_ADDRESS) / 1000000000000000000) + " AANG") print() After running it, I got my results!
wallet_test % pipenv run python test.py Loading .env environment variables… You are connected to the Ethereum test network. Current Balances ---------------- 1.99433569 ETH 1000.0 AANG I know this probably isn't horribly impressive or exciting but it was really awesome to interact with blockchain and crypto at this level. I'm excited to do more!
0
0
Securely connect the portfolio you’re using to start.