Build with CoinStats’ all-in-one API. Learn more

Deutsch한국어日本語中文EspañolFrançaisՀայերենNederlandsРусскийItalianoPortuguêsTürkçePortfolio TrackerCryptocurrenciesPricingCrypto APIMCPIntegrationsNewsRWA MarketEarnBlogNFTWidgetsDeFi Portfolio TrackerDerivativesETF FlowsCrypto GamingPrediction Markets24h ReportPress KitAPI Docs

I created my first memecoin!

bullish:

0

bearish:

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:

  • The contract is named BaSingSe, because there is no bank in Ba Sing Se.
  • 3 billion tokens were minted on creation which I'm the proud owner of. On the testnet, but still.
  • Includes functions to delegate wallet actions (Air), transfer funds (Water), burn tokens (Fire), and store/retrieve SHA hashes (Earth)

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") CONTRACT_ADDRESS = "0x4903F648ABe73776125d035a5588b5110FefE9CD" 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!

submitted by /u/SiON42X
[link] [comments]
bullish:

0

bearish:

0

Manage all your crypto, NFT and DeFi from one place

Securely connect the portfolio you’re using to start.

Where will Ethereum trade next?

Live Polymarket and Kalshi odds on Ethereum price targets, compared side by side.

See Ethereum price odds