free web page hit counter
Create your own custom ERC-20 token in minutes!

Create your own custom ERC-20 token in minutes!

Etherum Reddit

Reddit / Etherum Reddit 62 Views

Create your own custom ERC-20 token in minutes!

https://i.redd.it/i8v9qhua7iy21.jpg

Blockmason is excited to launch our second blockchain product called Link. Link allows developers to use smart contracts and the power of blockchain in their web or mobile applications with very little to no prior blockchain experience. Link creates classic, conventional, web-based APIs for any smart contract written on a programmable blockchain such as Ethereum.

In this activity, you will use Link to create your own custom ERC-20 token on Ethereum in just minutes! For details on the ERC-20 standard, see https://theethereum.wiki/w/index.php/ERC20_Token_Standard

While this post will walk you through deploying your custom token on the Ethereum testnet called Ropsten
, the same process applies to deploying on the Ethereum mainnet except that you will have to acquire real ether (ETH).

Setup

You will need to setup the following for this activity:

An account on Infura, which provides easy-to-use APIs to interact with the Ethereum network without running your own Ethereum node. Register for an API key at https://infura.io/register and then create a project. You will then be able to access URLs containing your API key for the Ethereum Mainnet and all Testnets.

https://i.redd.it/wq53118c7iy21.png

A MetaMask wallet, which will hold your custom ERC-20 tokens. MetaMask is a Chrome extension which interfaces with the Ethereum network from your browser. You can get the extension here: https://metamask.io/

Setup your Link account – register at https://mason.link/sign-up

Seed your Link account wallet with test ETH from https://faucet.ropsten.be/, which will be used to pay for transactions on the Ropsten testnet. You can find your Link account wallet address from the Ethereum Account menu as shown:

https://i.redd.it/4z840cao8iy21.png

https://i.redd.it/8z7nhdao8iy21.png

https://i.redd.it/lb7zodao8iy21.png

Create a New Project in Link, which starts up the new project wizard.

Create a new contract
Copy the following ERC-20 token Solidity code template (https://github.com/blockmason/smart-contract-templates/blob/master/ANYToken.sol) into the Source Code
space.

https://i.redd.it/zktkhkwp8iy21.png

Replace references of ANY
with your desired 3 or 4 letter token symbol in the following part of the code. For this example, we will call our token BML (for Blockmason Link).

//Change the contract name to your token name contract ANYToken { // Name your custom token string public constant name = "ANY TOKEN"; // Name your custom token symbol string public constant symbol = "ANY"; 

In the contract constructor, paste in the MetaMask wallet address that you want to store all your custom tokens:

constructor() public { // Add your wallet address here which will contain your total token supply treasury = address(<wallet address>); 

Also in the contract constructor, enter in your desired total token supply (the default is 1000).

constructor() public { // Set your total token supply (default 1000) totalSupply = 1000 * 10**uint(decimals); 

Press Save
and Next
, and use your newly created contract
Which Ethereum account would you like to use? Use the Default Account
and press Next
Which network would you like to use? Create a new network called Ropsten
. Keep the default 0 Block Confirmations Needed
. Press Save
and Next
.

https://i.redd.it/yzs1gpnr8iy21.png

https://i.redd.it/gf2ile2t8iy21.png

https://i.redd.it/tkhz1e2t8iy21.png

Where is your contract deployed? This will be a new contract deployment, not one with an existing address. You just need to give the deployment a name. Press

Save 

and

Next 

and

Next 

. Note, don’t forget the

https:// 

at the beginning of the URL!

https://i.redd.it/4me820gu8iy21.png

Are you ready to perform the following deployment? Check that you are deploying the correct contract to the Ropsten network. Then press

Deploy 

. This could take up to 30 seconds. Note – if you get an

insufficient funds 

related error, ensure your Link account wallet has sufficient test ETH.

https://i.redd.it/gwexmdzv8iy21.png

If you now see a screen asking you Which API would you like to use?, you have successfully deployed your contract!

Sidenote: This example goes through the process of just deploying a contract but Link does so much more! In a later post, we will go through the rest of the wizard to generate useful APIs, allowing us to easily incorporate the custom ERC-20 token in any application.

Click on the Contract Deployments
menu icon to see where your contract is deployed. In this example, the address is: 0x0219d37a27778f3344c9ec34fcfa1d767896f519
. Copy this address.

https://i.redd.it/ndz7h9fx8iy21.png

Go to https://ropsten.etherscan.io/ and paste your contract address into the search bar. You should then see the details of your contract (i.e. the contract creation time and token name). Clicking through to the token itself, you will see the total supply amount and your single wallet holding the entire supply.

https://i.redd.it/fd0ktt5z8iy21.png

https://i.redd.it/zq1azpi09iy21.png

Finally, you will add your custom token to your MetaMask wallet. Login to your wallet and to the address that will hold the entire supply. Under the menu item, at the bottom, you should see

Add Token 

:

https://i.redd.it/tesqql919iy21.png

Select

Custom Token 

and copy and paste in your Token Contract Address. The ‘Symbol’ and ‘Decimals of Precision’ should automatically update.

https://i.redd.it/9w0ox7l29iy21.png

Complete the setup and you now have your custom ERC-20 tokens in your wallet that you can share! And feel free to send some of your exclusive tokens to us at

0xaFf485B0dd5D2c2851EDf374D488379F75403662 

https://i.redd.it/f6pzseh89iy21.png

If you want to deploy your custom token to the Ethereum Mainnet, simply go through the Link new project wizard again and use the Mainnet Infura API to deploy the smart contract. Remember – you will need to fund your Link wallet with real ETH to cover the gas costs.

Throughout this example, we touched on Link concepts including contract deployment, creating a custom ERC-20 token contract, and utilizing the Ropsten testnet.

In the next post, you will implement your custom token as part of an app’s payment network.

To learn more about Blockmason Link, check out the official Link website at blockmason.link or our weekly blog posts at blockmason.link/blog.

You can also connect with the Blockmason Link Team on these social channels:

submitted by /u/bolyus21
[link] [comments]

Comments