<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Solidity Archives - Bizznerd</title>
	<atom:link href="https://bizznerd.com/tag/solidity/feed/" rel="self" type="application/rss+xml" />
	<link>https://bizznerd.com/tag/solidity/</link>
	<description>Place Where Technology Meets Business</description>
	<lastBuildDate>Sun, 10 Jul 2022 20:13:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://bizznerd.com/wp-content/uploads/2019/01/cropped-favicon-1-32x32.png</url>
	<title>Solidity Archives - Bizznerd</title>
	<link>https://bizznerd.com/tag/solidity/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is an ERC-20 token and how to create one ?</title>
		<link>https://bizznerd.com/what-is-an-erc-20-token-and-how-to-create-one/</link>
		
		<dc:creator><![CDATA[exe]]></dc:creator>
		<pubDate>Mon, 11 Jul 2022 11:45:11 +0000</pubDate>
				<category><![CDATA[Crypto]]></category>
		<category><![CDATA[Digital Marketing]]></category>
		<category><![CDATA[Entertainment]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[ERC-20 token]]></category>
		<category><![CDATA[ethereum]]></category>
		<category><![CDATA[Solidity]]></category>
		<guid isPermaLink="false">https://bizznerd.com/?p=19815</guid>

					<description><![CDATA[<p>In this article, we reviewed how to create an ERC-20 token on the Ethereum platform. As you know, this requires certain steps that you need to be aware of. By reading this article and using this information correctly, you will learn how to create an ERC20 token in an hour. This can be fascinating to &#8230;</p>
<p>The post <a href="https://bizznerd.com/what-is-an-erc-20-token-and-how-to-create-one/">What is an ERC-20 token and how to create one ?</a> appeared first on <a href="https://bizznerd.com">Bizznerd</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, we reviewed how to create an ERC-20 token on the Ethereum platform. As you know, this requires certain steps that you need to be aware of. By reading this article and using this information correctly, you will learn how to create an ERC20 token in an hour. This can be fascinating to many people. If this field interests you, make sure to follow us to the end.</p>
<p>It is also good to know that ERC20 tokens are considered smart contracts. For this reason, these tokens based on the Ethereum blockchain work in a decentralized manner in the blockchain.</p>
<p>This will increase the security of these tokens.</p>
<h4>Solidity (Smart contract programming language)</h4>
<p><a href="https://en.wikipedia.org/wiki/Solidity">Solidity</a> is one of the programming languages ​​for smart contracts, which is used to build Ethereum-based tokens. Investors familiar with JavaScript or C-like programming languages ​​can easily learn solidity as well. Before we get into that, let&#8217;s take a look at ERC20 tokens.</p>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain.jpeg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-19816" src="https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain.jpeg" alt="solidity blockchain" width="800" height="450" srcset="https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain.jpeg 800w, https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain-300x169.jpeg 300w, https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain-768x432.jpeg 768w, https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain-390x220.jpeg 390w, https://bizznerd.com/wp-content/uploads/2022/06/solidity-blockchain-600x338.jpeg 600w" sizes="auto, (max-width: 800px) 100vw, 800px" /></a></p>
<h4>What is an ERC-20 token?</h4>
<p>The ERC-20 standard defines a set of short and basic functions that all ERC-20 tokens must be executed to interact with other contracts, markets, or wallets.</p>
<pre class="enlighter-clipboard" dir="ltr">1. function totalSupply() public view returns (uint256)
2. function balanceOf(address tokenOwner) public view returns (uint);
3. function allowance(address tokenOwner, address spender)
4. public view returns (uint);
5. function transfer(address to, uint tokens) public returns (bool);
6. function approve(address spender, uint tokens)  public returns (bool);
7. function transferFrom(address from, address to, uint tokens) public returns (bool);</pre>
<p>These functions allow external users, such as users of wallet applications, to find their account balances and transfer funds to other users&#8217; accounts. Only two events are defined by smart contracts.</p>
<pre class="enlighter-clipboard" dir="ltr">1. event Approval(address indexed tokenOwner, address indexed spender,
2. uint tokens);
3. event Transfer(address indexed from, address indexed to,
4. uint tokens);
</pre>
<p>When a user can transfer tokens from one account to another and this happens, these events are called or eventually published. Many ERC20 tokens have additional sections, such as:</p>
<pre class="enlighter-clipboard" dir="ltr">1. string public constant name;
2. string public constant symbol;
3. uint8 public constant decimals;
</pre>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn.webp"><img loading="lazy" decoding="async" class="alignnone wp-image-19819 size-full" src="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn.webp" alt="Ethereum Blockchain ERC-20" width="1600" height="900" srcset="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn.webp 1600w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn-300x169.webp 300w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn-1024x576.webp 1024w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn-768x432.webp 768w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn-1536x864.webp 1536w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn-390x220.webp 390w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchaibn-600x338.webp 600w" sizes="auto, (max-width: 1600px) 100vw, 1600px" /></a></p>
<h4>How does the ERC-20 token work?</h4>
<p>If you are not yet familiar with the ERC20 token, we suggest you pay attention to this section. ERC stands for Ethereum Request for Comments, and the number 20 indicates a valid ID. This name makes the ERC20 token different from other tokens and anyone can easily recognize it.</p>
<p>It should also be noted that this token is created in the Ethereum blockchain and for this reason, it must comply with some rules and standards related to this blockchain. Proper use of these rules will make their purchase and sale in this program easy and successful.</p>
<h4>ERC-20 token coding using solidity</h4>
<p>As mentioned earlier, you can easily encode ERC20 tokens using the solidity programming language. Of course, this position requires specialized knowledge in this field. In addition, by knowing this, you can create an ERC20 token with the best features. In the following, we will explain the most important steps required to make an ERC20 token.</p>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token.jpg"><img loading="lazy" decoding="async" class="alignnone wp-image-19821 size-full" src="https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token.jpg" alt="What is an ERC-20 token" width="1200" height="675" srcset="https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token.jpg 1200w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token-300x169.jpg 300w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token-1024x576.jpg 1024w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token-768x432.jpg 768w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token-390x220.jpg 390w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-an-ERC20-token-600x338.jpg 600w" sizes="auto, (max-width: 1200px) 100vw, 1200px" /></a></p>
<h4>1. Find mapping objects</h4>
<p>Given the concept of Solidity for a key/value or associative array, you need to find two mapping objects:</p>
<pre class="enlighter-clipboard" dir="ltr">1. mapping(address =&gt; uint256) balances;
2. mapping(address =&gt; mapping (address =&gt; uint256)) allowed;</pre>
<p><strong>· Mapping (address =&gt; unit 256) &#8211; </strong>It defines an associative array that contains address keys (a number used to indicate the account address) and values ​​of uint256 (a 256-bit integer used to store token balance).</p>
<p><strong>· Balance &#8211;</strong> This is the first mapping object to hold each owner&#8217;s account balance.</p>
<p><strong>· Allowed &#8211;</strong> It is the second mapping object that includes all the accounts that have been approved to withdraw tokens from a given account, as well as the withdrawal sum that has been approved for each account.</p>
<p>The above-mentioned mappings will be stored in the Ethereum blockchain along with the contract sections. They are then used to show changes in all sections of the user. You should always try to keep your blockchain storage to a minimum. This is because the cost of storage space in the blockchain seems relatively high, and it is the responsibility of smart contract users to pay for these costs.</p>
<p>In this section, we&#8217;ll discuss how to write apt functions with ERC20 logic.</p>
<h4>2. Choose the number of ICO tokens</h4>
<p>If you want to know how to make a token on the Ethereum blockchain platform, you must first determine the number of your ICO tokens. There are several methods you can use to maximize your ICO tokens.</p>
<p>In this article, we have tried to use the simplest way to do this. With this method, we determined the total amount of tokens at the time of creating the smart contract and then assigned all of them to the account holder in which we created the contract.</p>
<pre class="enlighter-clipboard" dir="ltr">1. uint256 totalSupply_;
2. constructor(uint256 total) public {
3. totalSupply_ = total;
4. balances[msg.sender] = _totalSupply;
5. }</pre>
<ul>
<li><strong>Constructor:</strong> An Ethereum function used to determine the number of tokens using investor account parameters</li>
<li><strong>Msg:</strong> A global variable declared by Ethereum Blockchain itself that contains all the important data for contract execution.</li>
<li><strong>sender:</strong> The part of the Ethereum account that executes the current contract</li>
</ul>
<h4>3. Get the total token supply</h4>
<pre class="enlighter-clipboard" dir="ltr">1. function totalSupply() public view returns (uint256) {
2. return totalSupply_;
3. }</pre>
<p>In this part of the tutorial on making an ERC20 token on the Ethereum platform, we encounter the received token. This part of the smart contract is responsible for returning all marks specific to this contract regardless of its owner.</p>
<p>To do this, you must obtain the owner&#8217;s balance</p>
<pre class="enlighter-clipboard" dir="ltr">1. function balanceOf(address tokenOwner) public view returns (uint) {
2. return balances[tokenOwner];
3. }</pre>
<p>Do this using the balanceOf option, which is responsible for restoring the account balance.</p>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token.webp"><img loading="lazy" decoding="async" class="alignnone wp-image-19822 size-full" src="https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token.webp" alt="ERC-20 Token" width="1720" height="900" srcset="https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token.webp 1720w, https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token-300x157.webp 300w, https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token-1024x536.webp 1024w, https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token-768x402.webp 768w, https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token-1536x804.webp 1536w, https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token-600x314.webp 600w" sizes="auto, (max-width: 1720px) 100vw, 1720px" /></a></p>
<p>After doing this, you will need to transfer the tokens to another account.</p>
<pre class="enlighter-clipboard" dir="ltr">1. function transfer(address receiver,
2. uint numTokens) public returns (bool) {
3. require(numTokens &lt;= balances[msg.sender]);
4. balances[msg.sender] = balances[msg.sender] — numTokens;
5. balances[receiver] = balances[receiver] + numTokens;
6. emit Transfer(msg.sender, receiver, numTokens);
7. return true;
8. }</pre>
<p>You can do this using the <strong>transfer</strong> and <strong>msg.sender</strong> options. With the <strong>transfer</strong> option, you can transfer tokens from the owner&#8217;s account to the receiver. Note that people use the <strong>msg.sender</strong> option to transfer digital currencies. Of course, do not forget that only the owner of the tokens can transfer the tokens.</p>
<p>In addition, it is good to be familiar with the <strong>require</strong>. People commonly use the term to prove a proposition in solidity coding. If you do not have enough balance to transfer and this event fails, it will be refunded without any change to the blockchain.</p>
<h4>4. Confirm your Delegates to Withdraw Tokens</h4>
<p>People use this option mostly in the marketplaces of tokens and cryptocurrencies.</p>
<pre class="enlighter-clipboard" dir="ltr">1. function approve(address delegate,
2. uint numTokens) public returns (bool) {
3. allowed[msg.sender][delegate] = numTokens;
4. emit Approval(msg.sender, delegate, numTokens);
5. return true;
6. }</pre>
<p>In this step, you will have to face the <strong>approve</strong> option. This option allows <strong>msg.sender</strong> to verify a delegate&#8217;s account for withdrawing and transferring tokens to other accounts.</p>
<p>People generally use this function in scenarios where token owners offer their tokens for sale on a marketplace since it allows the marketplace to finalize the transaction without requiring prior approval from the owner.</p>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain.png"><img loading="lazy" decoding="async" class="alignnone wp-image-19825 size-full" src="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain.png" alt="Ethereum-blockchain-ERC-20" width="1915" height="1002" srcset="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain.png 1915w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain-300x157.png 300w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain-1024x536.png 1024w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain-768x402.png 768w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain-1536x804.png 1536w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-blockchain-600x314.png 600w" sizes="auto, (max-width: 1915px) 100vw, 1915px" /></a></p>
<h4>5.  How to Get the Number of Approved Tokens</h4>
<p>People mostly use this option in tokens and cryptocurrency marketplaces.</p>
<pre class="enlighter-clipboard" dir="ltr">1. function allowance(address owner,
2. address delegate) public view returns (uint) {
3. return allowed[owner][delegate];
4. }</pre>
<p>This function returns the number of commonly approved tokens by an owner to a specific delegate.</p>
<p><strong>transferFrom &#8211; </strong>In this function, the delegate who approved the withdrawal can transfer funds from the owner&#8217;s account to a third-party account.</p>
<pre class="enlighter-clipboard" dir="ltr">1. function transferFrom(address owner, address buyer,
2. uint numTokens) public returns (bool) {
3. require(numTokens &lt;= balances[owner]);
4. require(numTokens &lt;= allowed[owner][msg.sender]);
5. balances[owner] = balances[owner] — numTokens;
6. allowed[owner][msg.sender] =
7. allowed[from][msg.sender] — numTokens;
8. balances[buyer] = balances[buyer] + numTokens;
9. Transfer(owner, buyer, numTokens);
10. return true;
11. }</pre>
<p>By making a token on the Ethereum blockchain platform, we see that we need to fill in two confirmations at the beginning. This confirms whether the transactions are legal or not. If the account holder does not have enough balance to transfer the tokens, they will also need these confirmations.</p>
<h4>6. Add the SafeMath Solidity Library</h4>
<p><strong>SafeMath</strong> is a solidity library that is designed to stop one-way hackers from breaking contracts using integer overflow attacks.</p>
<p>By passing parameters that will take relevant integers past their maximum value, the hacker is forcing the contract to use incorrect numeric values.</p>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/What-is-ERC20-.webp"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-19826" src="https://bizznerd.com/wp-content/uploads/2022/06/What-is-ERC20-.webp" alt="What is ERC20 " width="1000" height="600" srcset="https://bizznerd.com/wp-content/uploads/2022/06/What-is-ERC20-.webp 1000w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-ERC20--300x180.webp 300w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-ERC20--768x461.webp 768w, https://bizznerd.com/wp-content/uploads/2022/06/What-is-ERC20--600x360.webp 600w" sizes="auto, (max-width: 1000px) 100vw, 1000px" /></a></p>
<p>With <strong>SafeMath</strong>, you can protect your smart contract from attacks by any hacker. Before doing so, you must perform the necessary tests. This can greatly reduce the risk of hackers. In addition, in the ERC-20 digital currency build tutorial, we see that the SafeMath library is very small in size. For this reason, there is no penalty or cost for storage. You can add this library to your contract with the following code:</p>
<div class="">
<pre class="enlighter-clipboard">library SafeMath { // Only relevant functions
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b &lt;= a); return a — b; } function add(uint256 a, uint256 b) internal pure returns (uint256)   { uint256 c = a + b; assert(c &gt;= a);
return c;
}
}</pre>
</div>
<div class="">
<div>At this point, you encounter the <strong>assert</strong> option, which is very important. You use it to verify the invoices sent. If the seller doesn&#8217;t confirm this option, the blockchain stops the transaction and all the changes we observed stop.</div>
<div></div>
</div>
<div>To add the library to the Solidity compiler, follow the instructions below:</div>
<div></div>
<div><strong>using SafeMath for uint256;</strong></div>
<div></div>
<div>Replace the previous code using SafeMath:</div>
<div>
<pre class="enlighter-clipboard" dir="ltr">1. balances[msg.sender] = balances[msg.sender].sub(numTokens);
2. balances[receiver] = balances[receiver].add(numTokens);
3. balances[buyer] = balances[buyer].add(numTokens);
4. balances[owner] = balances[owner].sub(numTokens);</pre>
</div>
<div>Solidity contains all smart contract functions and events within a &#8216;contract&#8217;. In the crypto world, people commonly call it a &#8216;blockchain class&#8217;.</div>
<div></div>
<div><a href="https://bizznerd.com/wp-content/uploads/2022/06/ico-cryptocurrency-icons-double-exposure-initial-coin-offering-blue-glowing-symbol-hologram-network-set-chart-rising-graph-211857487.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-19827" src="https://bizznerd.com/wp-content/uploads/2022/06/ico-cryptocurrency-icons-double-exposure-initial-coin-offering-blue-glowing-symbol-hologram-network-set-chart-rising-graph-211857487.jpg" alt="ico cryptocurrency" width="800" height="486" srcset="https://bizznerd.com/wp-content/uploads/2022/06/ico-cryptocurrency-icons-double-exposure-initial-coin-offering-blue-glowing-symbol-hologram-network-set-chart-rising-graph-211857487.jpg 800w, https://bizznerd.com/wp-content/uploads/2022/06/ico-cryptocurrency-icons-double-exposure-initial-coin-offering-blue-glowing-symbol-hologram-network-set-chart-rising-graph-211857487-300x182.jpg 300w, https://bizznerd.com/wp-content/uploads/2022/06/ico-cryptocurrency-icons-double-exposure-initial-coin-offering-blue-glowing-symbol-hologram-network-set-chart-rising-graph-211857487-768x467.jpg 768w, https://bizznerd.com/wp-content/uploads/2022/06/ico-cryptocurrency-icons-double-exposure-initial-coin-offering-blue-glowing-symbol-hologram-network-set-chart-rising-graph-211857487-600x365.jpg 600w" sizes="auto, (max-width: 800px) 100vw, 800px" /></a></div>
<h4>Deployment of Ethereum Contract</h4>
<p>Ethereum developers and investors often use different tools such as Truffle or Remix. To use them, you must install the Meta Mask plugin on your browser. In the meantime, you should have a Rinkeby account, which is an experimental Ethereum network.</p>
<p>Once you have executed these contracts, you can move to all parts of the network. For this reason, if you make any changes to your contract, you also transfer them to participating departments. After installing all the necessary items, you should go to the Remix program and put your code in the <strong>SafeMath</strong> library.</p>
<p>Then, in the tutorial for creating digital currency on the ERC-20 platform, we see that after you have added your code in the online Remix editor, go to the second option and click on the Deploy option. You have successfully executed an ERC-20 token when you selected the option to verify transactions. At this point, you will be ready to buy, pay and transfer across the blockchain.</p>
<p><a href="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images.jpg"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-19828" src="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images.jpg" alt="ethereum ERC20 token" width="1200" height="675" srcset="https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images.jpg 1200w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images-300x169.jpg 300w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images-1024x576.jpg 1024w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images-768x432.jpg 768w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images-390x220.jpg 390w, https://bizznerd.com/wp-content/uploads/2022/06/ethereum-ERC20-token-images-600x338.jpg 600w" sizes="auto, (max-width: 1200px) 100vw, 1200px" /></a></p>
<h4>Conclusion</h4>
<p>Learning how to create an ERC20 token on the Ethereum platform is one of the most important things you should be aware of. In this article, we have explained how to make tokens on the Ethereum blockchain platform for you. Using the above tips, you can create ERC20 tokens with the best features for yourself. Then you can buy and sell them and put them on the marketplace.</p>
<p>The post <a href="https://bizznerd.com/what-is-an-erc-20-token-and-how-to-create-one/">What is an ERC-20 token and how to create one ?</a> appeared first on <a href="https://bizznerd.com">Bizznerd</a>.</p>
]]></content:encoded>
					
		
		
			<media:content url="https://bizznerd.com/wp-content/uploads/2022/06/ERC20-Token-1024x536.webp" medium="image" />
	</item>
	</channel>
</rss>
