아래 내용은 GOB 개발자의 개발자가 이더리움의 ETHERS.JS를 사용하여 토큰을 보내는 방법을 개발자 언어로 표시한 것이다.
SEND TOKEN USING ETHERS.JS(5.0)
In This Tutorial You'll Learn How To
- Import ethers.js
- Transfer token
- Set gas price according to the network traffic situation
To-Get-Started
To get started, we must first import the ethers.js library into our javascript Include ethers.js(5.0)
Installing
ES6 in the Browser
ES3(UMD) in the Browser
Parameters
- contract_address: Token contract address (contract address is needed when the token you want to transfer is not ether)
- send_token_amount: The amount you want to send to the receiver
- to_address: The receiver's address
- send_account: The sender's address
- private_key: Private key of the sender to sign the transaction and actually transfer the tokens
NOTICE
signTransaction(tx) is removed because sendTransaction() does it internally.
SENDING PROCEDURES
1. Connect to network (testnet)
Set Provider (Infura)
Connect to Ropsten testnet
2. Create wallet
3. Connect Wallet to net
4. Get current gas price
5. Define Transaction
These variables defined below are dependent on send_token()
Transaction parameters
- send_account: address of the token sender
- to_address: address of the token receiver
- send_token_amount: the amount of tokens to send
- gas_limit: gas limit
- gas_price: gas price
6. Transfer
HOW TO USE IT
Success!
SEND_TOKEN()
Home | ethereum.org
Ethereum is a global, decentralized platform for money and new kinds of applications. On Ethereum, you can write code that controls money, and build applications accessible anywhere in the world.
ethereum.org
'글로벌 이더리움 커뮤니티 활동' 카테고리의 다른 글
로열티 분배 시스템을 사용한 지분 소유 가능한 NFT (974) | 2021.06.08 |
---|