NEO blockchain, programming tutorials, Javascript — 2
Get Native Token(NEO/GAS) and NEP5 Token from NEO blockchain
This is a series of how you can start to build a decentralized app on the top of NEO. Before moving forward, I will guide you the fundamental aspect before we get started.
I am a full-stack javascript developer and one of the contributors for NEO blockchain project.
How To Get Started
NEO blockchain, programming tutorials, Javascript — 1
Get Native Token (NEO/GAS)
const Neon = require('@cityofzion/neon-js')On Main Net
------------------------------------------
Neon
.default
.get
.balance('MainNet', 'Your Address')
.then(response => {
response.assets.GAS.balance
response.assets.NEO.balance
})On Test Net
------------------------------------------
Neon
.default
.get
.balance('TestNet', 'Your Address')
.then(response => {
response.assets.GAS.balance
response.assets.NEO.balance
})
Get NEP5 Token from Binance
Fetch Binance NEP5 Token Balance(ONT)1. Get ONT's script hash
(Link to checkout all NEP5 script hash on Main Net)
ONT -> ceab719b8baa2310f232ee0d277c061704541cfb2. Select the best RPC
(RPC monitor)
RPC endpoint -> https://pyrpc3.narrative.network:4433. Binance Address
(Neon Scan)
Address -> AJzoeKrj7RHMwSrPQDPdv61ciVEYpmhkjk
Start to code
-----------------------------------------------
const Neon = require('@cityofzion/neon-js')
const rpcEndpoint = 'https://pyrpc3.narrative.network:443'
const address = 'AJzoeKrj7RHMwSrPQDPdv61ciVEYpmhkjk'Neon
.api
.nep5
.getTokenInfo(rpcEndpoint, scriptHash)
.then(response => {
response.name
response.symbol
response.totalSupply
response.decimals
})Neon
.api
.nep5
.getTokenBalance(rpcEndpoint, scriptHash, address)
.then(balance => {
balance
})
Tip of the day
NEP5
is a smart contract standard if you want to do a ICO on the top of NEO.
Stay Tune
I will show you how to transfer native token(NEO/GAS) for my next tutorial.
I make one post on every Monday UTC+0 time zone, but if I have more than 500 claps, I make another post immediately.
Feel free to drop message to me if you want to suggest a topic for me.
Useful Link
「Blockchain Programing」
1.「NEO blockchain, programming tutorials, Javascript — 1」
2.「NEO blockchain, programming tutorials, Javascript — 2」
3.「NEO blockchain, programming tutorials, Javascript — 3」
4.「NEO blockchain, programming tutorials, Javascript — 4」
5.「NEO blockchain, programming tutorials, Javascript — 5」
Smart contract of Initial Coin Offering Comparison
NEP5 VS ERC20
Smart contract of Initial Coin Offering on NEO blockchain
NEP5 Standard
Github
My Github
Neon-JS
NEON-JS-SDK
Blockchain Link List
Blockchain Posts List
About me
I am a full-stack javascript developer and one of the contributors for NEO blockchain project.
Build Decentralized Application with Javascript on the top of NEO?
NEO blockchain, programming tutorials, Javascript
If you consider yourself a talent?
Cobinhood Careers