2. Introduction
● ICO (Initial Coin Offering) means a company uses blockchain technology
to issue new coin, token, and sells it to investors in exchange for
cryptocurrencies to raise money
● Currently, most ICOs utilize ERC20 on Ethereum to issue token
● ERC20 is a standard interface for the implementation of a standard API
for tokens within smart contracts on Ethereum, which provides basic
functionality to query and transfer tokens
3. ERC20 Interface
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
13. Monitor Event: Transfer
curl
-X POST
-H 'Content-Type: application/json'
-d
'{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock":"0x2B3300","address":["0x410972
9e35500c4aa11729af0965bf2c8cdfcf94"],"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f1
63c4a11628f55a4df523b3ef"]}],"id":1}'
http://127.0.0.1:8545/
curl
-X POST
-H 'Content-Type: application/json'
-d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x03"],"id":1}'
http://127.0.0.1:8545/
● Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.
14. Monitor Event: Approval
curl
-X POST
-H 'Content-Type: application/json'
-d
'{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock":"0x2B3300","address":["0x410972
9e35500c4aa11729af0965bf2c8cdfcf94"],"topics":["0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c
0f7b2291e5b200ac8c7c3b925"]}],"id":1}'
http://127.0.0.1:8545/
curl
-X POST
-H 'Content-Type: application/json'
-d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x04"],"id":1}'
http://127.0.0.1:8545/
● Filters timeout when they aren’t requested with eth_getFilterChanges for a period of time.