How To Build Your Own Ethereum Based ERC20 Token and Launch An ICO in Next 20 Minutes - Hashnode
How To Build Your Own Ethereum Based ERC20 Token and Launch An ICO in Next 20 Minutes - Hashnode
Start a personal dev blog on your domain for free with Hashnode
and grow your readership.
Get Started
Sandeep Panda
1 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
If you are looking for advanced stuff such as Presale, Public Sale,
Discounts, goal, hard cap etc.. check out my latest article.
This article aims to give you an overview of how smart contracts work
in Ethereum by launching a simple demo ICO.
Make Hashnode your discussion hub for all things crypto. Check out
our crypto communities and join the blockchain-related discussions.
Basics
Here are a few basic terms we are going to use in this article. If you are
familiar with the following concepts, feel free to skip to the next
section.
2 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
standards.
Now that you are aware of the basic terminologies used in this article
let's get started.
Step 1� Code
Open your favourite text editor and paste the following code:
COPY
contract Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
1
function balanceOf(address _owner) constant returns (uint256 balance)
3 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
/// @notice send `_value` token to `_to` from `_from` on the condition it i
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value)
4 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
5 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include
They allow one to customise the token contract & in no way influences the c
Some wallets/interfaces might not even bother to look at this information.
*/
string public name; // Token Name
uint8 public decimals; // How many decimals to show. To be s
string public symbol; // An identifier: eg SBX, XPR etc..
string public version = 'H1.0';
uint256 public unitsOneEthCanBuy; // How many units of your coin can be
uint256 public totalEthInWei; // WEI is the smallest unit of ETH (t
address public fundsWallet; // Where should the raised ETH go?
6 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
fundsWallet = msg.sender;
}
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
1
The above code uses Solidity language to build a simple ERC20 token.
7 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
The code is well commented and is very easy to understand. Once you
paste the code into your text editor, find the text: "CHANGE THIS". This
is what you need to change based on the characteristics of your token.
In the example above, I have named my token HashnodeTestCoin
�HTCN�. The total supply is capped at 1000, but people can possess as
little as 0.000000000000000001 because of 18 decimal places.
Additionally, the owner of the contract (one who executes it) gets all
the initial tokens. I have set the ICO price as following:
1 ETH � 10 HTCN
This means, if someone sends 1 ETH to this smart contract, they will
get 10 HTCN units.
Step 2
Once you download the extension, go ahead and create a new account
protected by a password. Then choose "Ropsten TestNet" from the top
left corner. Before we deploy the contract to Main Ethereum
blockchain, we'll test it against TestNet and make sure everything
works as expected. It looks something like this:
8 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Now head over to Remix IDE (an online solidity compiler and debugger)
and paste the code you just modified. Ignore any warnings you see.
Next go to settings and uncheck "Enable Optimizations" if it's checked.
Now go to "Run" tab and click on create under <your token name>.
1
Once you hit create, MetaMask will prompt you to buy some test ether
9 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Just make sure you are on Ropsten TestNet and not on the MainNet 1
and then hit Submit. Now open up MetaMask again and click on the
10 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
and then hit Submit. Now open up MetaMask again and click on the
first transaction. It'll take you to Etherscan where you can observe the
ongoing transaction. It may take up to 30s to confirm the transaction.
Once it's confirmed it looks like the following:
Viola!! You just deployed your contract. Note the to address in the
above transaction page. That's your contract address.
Step 3
Ideally if you've set up everything correctly you should receive all the
initial tokens �1000 in my case) when you add it to your wallet. So, copy
the contract address, go to MetaMask � Add Token and paste the
address. It looks like the following: 1
11 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Hit Add and refresh MetaMask. You should now see all the initial supply
(in my case it was 1000 HTCN�. :)
Step 4
Now that everything works perfectly we just have to verify our smart
contract so that everyone on the blockchain can read and understand
it. It's always a good practice to verify since it helps establish trust.
12 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Now click on "verify and publish" link. Once you are taken to the new
page, fill up the details such as compiler version, Enable Optimizations
etc and paste the solidity source we compiled in the first step.
Make sure the compiler version you choose matches the one you
compiled your code against in the first step. Now hit "verify and
1
publish". If successful, it'll generate bytecode and ABI as following:
13 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Congrats! Now anyone can visit your contract address and read the
source.
Step 5
14 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
As a part of the ICO, your users will buy tokens from you by paying
ETH. Remember we set the price as 1 ETH � 10 HTCN while deploying
the contract? So, if a user wants to buy 10 HTCNs through your ICO,
they have to pay 1 ETH. Let's test this out.
Next, send 2 ETH to the contract address and wait for the transaction
to be confirmed. Refresh MetaMask and check your tokens after a few
seconds. The new test account should have got 20 HTCNs (or
something different depending on your config) and the contract owner
(you) should have 980 (or something similar) tokens.
15 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Head over to Hashnode Test Coin ICO and check out the code in the
last <script> tag. It's fairly simple and just uses Web3.js and ABI
obtained from your contract.
16 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Congrats if you have made this far! Do keep in mind that real
production grade contracts and ICOs take significant efforts and are
supported by thorough tests. While this tutorial gives you an overview
of writing contracts for ICOs, it's never meant for production level
deployment. Don't deploy this on MainNet without proper testing!
Thanks for reading this article. If you have any questions, please feel
free to comment below.
37
17 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
READ NEXT �
�
Sandeep Panda
Sandeep Panda
18 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Sandeep Panda
19 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Comments �102�
Reply 3
Like
Reply
20 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Thanks!
Reply 3
Sorry about the late response. You can try Ethers-js and fetch the
balance. In fact, I should have used that in the article instead of
relying on web3. Thanks for pointing out.
Like
Reply
21 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply 3
Show �6 replies
I have the same problem, all ok but if i send 0.05 eth yo contract,
this contract dont send me mys tokens... Any solution?
Like
Reply
Like
Reply
1
22 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply 2
Make sure the value of the coin is 0 in the run tab of the Remix IDE.
Like
Reply
hi. Great article. I have question. On your final ICO webpage, there
is starting and ending date, plus bonus for the first week buyer, do
you have code example for that? Great thanks!
Like 1
Reply
23 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Gautam Lakum
Intrapreneur. Project Coordinator in the mobile apps development agency. Love …
Reply 1
Like
Reply
Great tutorial, thank you very much, I was able to deploy my first
ERC20 yey! Would you also do a tutorial on how to build ERC23
Tokens? Apparently they are the next evolutional step in this
technology. Best!
1
Reply 1
24 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply
Reply 1
contract Token {
1
25 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
/*
NOTE:
The following variables are OPTIONAL vanities. One does not have to include
They allow one to customise the token contract & in no way influences the co
1
Some wallets/interfaces might not even bother to look at this information.
26 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
*/
string public name = 'JIMI'; // Token Name
uint8 public decimals = 0; // How many decimals to show. To b
string public symbol = 'JIMI'; // An identifier: eg SBX, XPR
string public version = 'J1.0';
uint256 public unitsOneEthCanBuy; // How many units of your coin can be
uint256 public totalEthInWei; // WEI is the smallest unit of ETH (th
address fundsWallet = 0xb6F6d01aAf700C83819cE0707C6B69607AfF36a9
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
if (balances[fundsWallet] < amount) {
return;
}
1
//Transfer ether to fundsWallet
fundsWallet.transfer(msg.value);
27 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
fundsWallet.transfer(msg.value);
}
Reply 1
Same here
Reply
Same
Like
Reply
Really love this tutorial, it's clear and beautiful. Already bought
the book. Please do keep writing. We need more people to
understand Solidity. Once you've done, I hope I can translate your
book to Chinese and bring it to Chinese language world. :)) 1
28 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply 1
Reply
Help is appreciated.
Reply 1
Quick question: what if you create 100 tokens, but you only want 1
to give 50% away in the ico, how could you do it? I mean you
29 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Thank you!
Reply 1
Like
Reply
Hello, could you help me? I was able to create the contract but
when I send ETH to the contract address, I do not receive
MYCOIN. I compared the contract I created with the contract
published by the article, and it's the same. What can it be?
Reply 1
Hey there! Did you Add the specific token to MetaMask? By default
30 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Hey there! Did you Add the specific token to MetaMask? By default
it doesn't show all the available tokens.
Like
Reply
Sandeep please help, the contract is not sending token when eth is
sent to it.
Reply
Hello, I didnt see where to put cap limit token user can buy..
Where is it?
For example Total supply 21mil. People can only buy 10mil of
it..Where to put that 10mil? 1
31 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply 1
Like
Reply
I'm having a strange issue, when I send Ether into the contract
address nothing happens, the contract just holds the Ether and
does not send my token out.
Reply 1
Same problem.
Like
Reply
1
same problem.
32 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply
Reply 1
Reply 1
Same 1
33 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Like
Reply
Reply 1
Reply 1
Sounds good. Here I would like to suggest one more article which 1
34 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply 1
Reply Like
1
That is true � STOs are the ICOs of the next generation. More
35 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
secured. And by the way if you are the one who is planning to
launch your own ICO/STO � i strongly recommend flexe.io/413
These guys were really good and DO understand how fund
raising works.
Reply Like
It’s good that technology is developing fast. Already now you can
create your Ethereum token and run own ICO with just a few
clicks immediately without using code at all. Go to the link
mywish.io
Reply Like
Reply Like
36 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
hi
Reply Like
Reply Like
reliable. It's simple and easy. I will leave a link for those who want
37 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
reliable. It's simple and easy. I will leave a link for those who want
to try it too bcex.hk/trade/frecnx_eth
Reply Like
Reply Like
38 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
I tried to find some tutorials to fix it but i did not was enable to
find something useful and that i can understand.
return c;
}
1
/**
39 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256)
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256)
// Gas optimization: this is cheaper than requiring 'a' not being zero,
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b; 1
40 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256)
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned i
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements: 1
* - The divisor cannot be zero.
41 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256)
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
contract Token {
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) public view returns (uint256 balance)
/// @notice send `_value` token to `_to` from `_from` on the condition it is
42 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
// solhint-disable-next-line no-simple-event-func-name
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _va
43 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
44 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
function MyToken() {
balances[msg.sender] = 1000000000000000; // Give the creat
totalSupply = 1000000000000000 ; // Update total
name = "MyToken"; // Set the name for
decimals = 8;
symbol = "MYT";
unitsOneEthCanBuy = 1000;
fundsWallet = msg.sender;
}
1
function() payable{
45 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
require(balances[fundsWallet] >= amount);
require (!_spender.call(bytes4(bytes32(keccak256("receiveApproval(addres
return true;
}
46 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
balances[_to] += _value;
balances[_from] -= _value;
if (allowance < MAX_UINT256) {
allowed[_from][msg.sender] -= _value;
}
emit Transfer(_from, _to, _value); //solhint-disable-line indent, no-unu
return true;
}
Reply Like
47 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
so what is the difference between this and the tokens you can
create on Mintme ?
Reply Like
Reply Like
Reply Like
48 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
So how would you start sending tokens from one account to the
other?
Reply Like
Reply Like
Like
Reply
Like 1
Reply
49 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply
Reply Like
Really amazing info, thank you! How do you add an image to the
coin / token?
Reply Like
remix.ethereum.org/#optimize=false&vers..
1
50 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Reply Like
Show �1 replies
Note: I sent 1 ETH from "my account 2" to Contract address - didn't
work (as specified in tutorial)
I sent 1 ETH from "my account 2" to "My Account 1" - didn't work
rinkeby.etherscan.io/token/0xc705e325395b7c..
works well.
51 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Like
Reply
I have the same problem. Manually through MEW works you say?
How does that work? Access MEW with a test net and then send
through MEW instead of Metamask?
Like
Reply
Hi Sandeep,
Reply Like
52 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Thank you for the great post! I have copied the code but I simply
cant click on create because the <your token name> tab is red
and I cant modify it. Please help thank you!
Reply Like
Thanks for the write up. I followed the steps but for some reason,
at step 3 i don't receive my tokens. Please help!
Reply Like
Hello Sandeep,
53 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
use.
Reply Like
Reply Like
Reply Like 1
54 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Reply Like
Hey!
1. how does
55 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Reply Like
Mine says URI is too long when I run it in remix. What does that
mean? Thanks
Reply Like
56 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Reply Like
57 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Hi Jason
Thanks for reporting this. We just need to change the following line
in payable function:
to
I have updated the code samples above. This will ensure that if
there are not sufficient tokens, the ETH will be refunded.
Like
Reply
58 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Like
Reply
Reply Like
Regards
Reply Like
59 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Hey Sandeep, thanks for this tutorial! I got stuck just before Step
3. I don't get taken to the Etherscan, I just keep getting a
MetaMask ether faucet page which is confusing me. I'm not sure
which key is mine for my new token. However, I managed to
create two tokens but neither of them are showing the name I
wanted or have provided me with the amount of tokens I set up in
my wallet. Not sure what I've done wrong. :(
Reply Like
https://ethereum.stackexchange.com/questions/37469/how-to-
add-a-function-in-contract
unitsOneEthCanBuy = 10;
fundsWallet = msg.sender;
}
function() payable{
totalEthInWei = totalEthInWei + msg.value;
uint256 amount = msg.value * unitsOneEthCanBuy;
1
if (balances[fundsWallet] < amount) {
return;
60 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
return;
}
Reply Like
How to access funds that are sent to the smart contract address
?
Reply Like
Like
Reply
61 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Like
Reply
Reply Like
Yet, your code return false on 0 and do not call Transfer event.
1
I guess, it is not fully ERC20 compatible then.
62 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Reply Like
Reply Like
Like
63 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Hi Sandeep,
Reply Like
64 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
Thanks for the article good tools to know and process for testing.
But as some says here, it seem there is a problem with the code.
Tokens are not created at step 3 and the wallet stay to 0 tokens
so the part 5 dont work too. It will very cool to fix this (and to
know why this dont work).
Reply Like
Sir, why is the total supply of tokens zero? Is the supply not
directly listed on a smart contract? Please help me.
Reply Like
65 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
how to make , if someone sends 0 eth send them 100 token, not
if they send 1 eth send them 100
Reply Like
Hi, why do i get this error, when i'm sending ether/s to contract
address
Reply Like
66 de 67 11/03/2022 11:26 a. m.
How to build your own Ethereum based ERC20 Token and launch an IC... https://hashnode.com/post/how-to-build-your-own-ethereum-based-erc20...
Reply Like
67 de 67 11/03/2022 11:26 a. m.