<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Degtyaruk Andrey on Medium]]></title>
        <description><![CDATA[Stories by Degtyaruk Andrey on Medium]]></description>
        <link>https://medium.com/@Hlogeon?source=rss-db3d55d3f4fe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*KYN5RcJ8GS_mQLxM.jpg</url>
            <title>Stories by Degtyaruk Andrey on Medium</title>
            <link>https://medium.com/@Hlogeon?source=rss-db3d55d3f4fe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:13:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Hlogeon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The complete guide on technical implementation of ICO using Opens Source technologies. Part 3]]></title>
            <link>https://medium.com/@Hlogeon/the-complete-guide-on-technical-implementation-of-ico-using-opens-source-technologies-part-3-9d487e7c8ecc?source=rss-db3d55d3f4fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d487e7c8ecc</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Degtyaruk Andrey]]></dc:creator>
            <pubDate>Thu, 15 Nov 2018 18:40:15 GMT</pubDate>
            <atom:updated>2018-11-15T18:40:15.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>Backend</h3><p>Hello, World! In this tutorials we are doing full technical implementation of ICO using open source software like <a href="https://icodashboard.space/">https://icodashboard.space</a> . In previous articles <a href="https://medium.com/p/472ac616980c?source=your_stories_page---------------------------">we had an architecture overview</a>, <a href="https://medium.com/p/f5beef46495a?source=your_stories_page---------------------------">deployed, verified and tested smart contracts</a> to ropsten test network. In this part we are going to configure and run backend application locally.</p><p>OK, now we can move on configuring backend application. And of course the first thing we need to do is to clone the repo to our local machine. I will clone it to my ~/Work/demo-ico/backend folder by running the following command: `git clone <a href="https://github.com/secret-tech/backend-ico-dashboard.git">https://github.com/secret-tech/backend-ico-dashboard.git</a> backend` from ~/Work/demo-ico directory in the terminal. Next, go to the backend directory and open project in your favourite text editor. Let’s take a look at the files in the project root: you can see multiple docker-compose.yml files(docker-compose.stage.yml, docker-compose.prod.yml and docker-compose yml) and the same with .env(.env.test, ,env.stage) files. We use this approach in order to specify configuration for the exact environment.</p><h3>.env</h3><p>.env files are used for configuration of the project. Backend app will look for the file called .env in the root directory and load configurations from there. As you can see, now we don’t have the file with exactly the same name so we need to create it. To save some time let’s just create a copy of .env.test and call it .env by running `cp .env.test .env` from the project root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YV0DL-v3z_57e9Nz" /></figure><p>Open this file in the text editor and take a look at the contents. I recommend you to spend some time here to understand what options can be configured from this file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dZEc_YpsLLfVLGvB" /></figure><p>Basically we have the following sections there:</p><ul><li>Application — the basic application settings like domain name, company name, environment, token price, ICO end date, HTTPS and so on</li><li>ORM — used to configure TypeORM. In most of the cases you’d never want to change anything here</li><li>Database(DB) — database access configuration like host, port, login/password</li><li>Auth &amp; Verify — hosts, ports and access tokens for Auth &amp; Verify services</li><li>Smart contracts — smart contract addresses, private key of whitelist owner account and the folder which contains an ABI of the contracts</li><li>RPC settings — here we configure how we want our backend to communicate with Ethereum network by providing required rpc settings(host, port, type of connection)</li><li>Throttler settings — allows you to protect an API of the backend by blocking IP addresses which call an API too frequent</li><li>Coinpayments settings</li><li>Email — path to the folder with email templates, email service provider configuration(mailgun, mailjet)</li><li>KYC settings — configure KYC provider, default KYC status, enable\disable KYC</li><li>Logging</li></ul><p>If you don’t understand what some of this options are used for and what you can set — don’t worry, I’ll explain it one by one in this tutorial.</p><h3>docker-compose</h3><p>Compose is a tool for defining and running multi-container Docker applications. To get more details please refer to <a href="https://docs.docker.com/compose/">official documentation</a>.</p><p>We use docker-compose.yml for the local environment. Another environments usually require another configuration. You can check out some examples in the repo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QZefv6zUTxlYCNLz" /></figure><p>Docker-compose file contains description of all the services we will use in this environment, some important settings of the services like shared volumes, port binding, environment variables and much more. Go through this file and make sure you understand every setting and it fits your needs. Make any changes you think will help you.</p><p>When you are satisfied with your docker-compose settings, try to run</p><p>`docker-compose build — no-cache` it will run the build process. It may take some time just wait until it’s finished.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YWCiuOpRSN2uveDr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f9i3wjY3Aqr_ykF2" /></figure><p>To install all the dependencies required by our NodeJS application we need to run `yarn install` inside the `ico` container. To do this, let’s run the following command in your terminal:</p><p>docker-compose run -u 0 — no-deps — rm ico sh -c “yarn install”</p><p>Wait, it will take some time and if everything is OK you will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OjG9ynqVyJGOMZou" /></figure><p>Now it’s time to try to run the containers for the first time:</p><p>`docker-compose up -d`</p><p>This command will bring up all the required services in the correct order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L1zUWh88edpwJscd" /></figure><p>Let’s check if all required services up and running `docker-compose ps`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_gwLApaHQQg3swPG" /></figure><p>As you can see all services are OK. You can also find some useful information about the services like networking info and command.</p><h3>Auth and Verify</h3><p>As I already said previously, our backend app uses auth and verify microservices to delegate authentication and verification processes. You can find more information about this service in their repositories and API docs</p><p><a href="https://github.com/secret-tech/backend-auth">Auth repo</a> | <a href="https://secret-tech.github.io/backend-auth/">Auth API</a><br><a href="https://github.com/secret-tech/backend-verify">Verify repo</a> | <a href="https://secret-tech.github.io/backend-verify/">Verify API</a></p><p>Our backend performs requests to auth every time we need to validate JWT token of the user to make sure this token was issued and signed by our service. This happens every request initiated by logged in user. Also we make requests to auth service when we register new user, change password or email. This service stores only data required to login to account but has no profile information. Ico backend service — vice versa knows everything about user profiles but it doesn’t have any login information.</p><p>In order to protect an API of auth and verify services we also use JWT tokens. If you want to make requests to Auth and Verify services you must provide special JWT key for the user with `tenant` role. In terms of our services `tenant` also isolates databases. One tenant don’t have an access to the data of another tenant. It technically allows us to run multiple dashboard connected to one Auth and Verify service and don’t violate privacy.</p><p>In order to register a tenant user we need to perform POST request to our auth instance. In this tutorial I will do it using `curl` from our ico container.</p><p>Let’s enter our container command line `docker-compose exec ico /bin/sh` — it will bring you to work directory of our container. In our case it is: `/usr/src/app`.</p><p>Now in this container call</p><blockquote>curl — include \<br> — request POST \<br> — header “Content-Type: application/json” \<br> — header “Accept: application/json” \<br> — data-binary “{<br> \”email\”: \”test@test.com\”,<br> \”password\”: \”Password1\”<br>}” \<br>‘http://auth:3000/tenant&#39;</blockquote><p>It will make request to the auth service and create tenant user with the following credentials:</p><p>email: <a href="/service/mailto:test@test.com">test@test.com</a></p><p>password: Password1</p><p>Of course you need to change this default credentials to increase protection. After you create your tenant user we need to login to get it’s JWT token:</p><blockquote>curl — include \<br> — request POST \<br> — header “Content-Type: application/json” \<br> — header “Accept: application/json” \<br> — data-binary “{<br> \”email\”: \”test@test.com\”,<br> \”password\”: \”Password1\”<br>}” \<br>‘http://auth:3000/tenant/login&#39;</blockquote><p>Use the same credentials you provided on registration.</p><p>You will see something like this in case of successful login</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H6ULUx3qkiQp7uUc" /></figure><p>Copy access token string and go to .env file in the project root.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mw8VR2fbFZmL_jmv" /></figure><p>Find auth JWT and replace AUTH_JWT value with your new token like on the screenshot and save.</p><p>Finally lets run some unit tests of our ico service to make sure you’ve got working copy.</p><p>Run `yarn test` inside ICO container(I guess you didn’t exit container after making those curl requests). Wait a few minutes and you will see test report. In my case tests successfully passed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J7Lri8F7wSpobz0Q" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*grObmRWvD-ouBpjM" /></figure><p>Cool, it looks like it works! Now you can try to make some API requests to your dashboard.</p><p>To be continued</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d487e7c8ecc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The complete guide on Technical implementation of ICO using Open Source technologies. Part 2]]></title>
            <link>https://medium.com/@Hlogeon/the-complete-guide-on-technical-implementation-of-ico-using-open-source-technologies-part-2-f5beef46495a?source=rss-db3d55d3f4fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5beef46495a</guid>
            <category><![CDATA[ico]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[secret-tech]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Degtyaruk Andrey]]></dc:creator>
            <pubDate>Wed, 10 Oct 2018 21:11:43 GMT</pubDate>
            <atom:updated>2018-10-10T21:20:46.736Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fVH-EnjQhkpvWIeXRFlvdg.png" /></figure><h3>Smart-contracts</h3><p>Today we are going to continue to more practical part of our tutorial and we will deploy all the smart contracts we will need to run our own ICO using <a href="https://icodashboard.space/">space ICO dashboard</a>.</p><p>I hope that you already know what is Ethereum, smart-contract and you have at least general understanding of Solidity programming language. I highly recommend you to spend a couple of hours reading <a href="http://ethereum.org/">Ethereum</a> and <a href="https://solidity.readthedocs.io/en/v0.4.25/">Solidity docs </a>and trying it out.</p><p>If you are not developer and not familiar with programming, <a href="http://secrettech.io/">hire us </a>or any other professional development team to handle everything for you. Remember that smart-contracts are working with real money of real people and in most of the cases — not your own money.</p><p>I also recommend you to take a look at <a href="https://openzeppelin.org/">OpenZeppelin</a>, read their docs and source code of the contracts. They have high quality and secure implementation of all the basic functionality you may require during smart-contract development starting from token contracts to access management and vesting time-locks. So if you want to implement something using Solidity, first check out if ready to use implementations already exist in OpenZeppelin and/or other projects.</p><p>In this tutorial I will use smart contracts we used in one of ICOs we were helping with, you can find <a href="https://github.com/secret-tech/demo-ico-contractshttps://github.com/secret-tech/demo-ico-contracts">this contracts here</a>. I used modifications of this contracts multiple times and they show pretty nice result. Another reason I choose this contracts is that before ICO we order independent security audit of this contracts and we made all the changes offered by auditors to fit security requirements. This contracts have a good test coverage, every function is covered by multiple tests making you sure that they work correctly. Also this contracts had some attention from the community which help us to improve the quality of this contracts. For this tutorial I updated master branch with updated versions of dependencies and Solidity compiler version but you’d better check for updates yourself.</p><p>First of all create directory for your ICO where you will clone all the repositories which belongs to your ICO. I will create folder `~/Work/demo-ico` for this tutorial. Than clone <a href="https://github.com/secret-tech/demo-ico-contracts">this repo</a> to the contracts subdirectory by running `git clone <a href="https://github.com/secret-tech/demo-ico-contracts.git">https://github.com/secret-tech/demo-ico-contracts.git</a> contracts` from the folder you just created for your ICO.</p><p>There is ERC20 burnable token with limited supply, EthPriceProvider which is used to update eth/usd rate(used to set the token price in USD instead of ETH and keep USD price the same despite of ETH volatility) in pre sale smart contract using oraclize, InvestorWhitelist contract which is used to protect our pre sale smart contract from the contributors which didn’t passed KYC/AML as well as to track referrals for partner program. And of course you can find PreSale smart-contract there. All contracts are covered with tests which you can find in the ./test folder. Tests are the good starting point if you want to understand how to interact with this contracts, how contracts are supposed to be deployed and what are their use-cases.</p><p>I highly recommend to spend a couple of hours going through source code and understanding this repo. It will help you to create almost any ICO structure you want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/0*oHkK9zCNZpeijfYw" /></figure><p>Go to the demo-ico/contracts folder and build docker images required for this repo by running `docker-compose build --no-cache`</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/0*y20KVb6kqdkkKWjb" /></figure><p>It will take some time and when finished successfully you will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/0*Jmh1xgakMWgOHsWi" /></figure><p>Now, let’s try to run the tests of our contracts. To do this we need to run our docker containers and execute `truffle` test in our workspace container. You need to do this steps:</p><ol><li>Run docker-compose up -d</li><li>You should wait a bit until Oraclize ethereum-bridge initialize. Wait for Please add this line to your contract constructor: OAR = OraclizeAddrResolverI(0x6f485C8BF6fc43eA212E93BBF8ce046C7f1cb475); message to appear. To check for it run docker logs ico_oracle_1</li><li>Install dependencies: docker-compose exec workspace yarn</li><li>To run tests: docker-compose exec workspace truffle test</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qNym62LVwws4jPeb" /></figure><p>If all tests passed correctly — all functionality works as expected. It means that we are ready to deploy our contracts. You can see what have been tested in nice messages in console output.</p><p>Usually to deploy your contracts you will use truffle migrations which allow you to automate deployment process what means less human factor impact. But in this tutorial I will use <a href="https://remix.ethereum.org/">remix IDE</a> + <a href="https://metamask.io/">MetaMask</a> to do the trick. If you don’t know what are Remix and MetaMask, please spend some time in google reading basic info what is it all about.</p><p>Before deploying our contracts we need to merge them. Merging contracts means replacing `import X` statement with the imported file contents. So as the result we will get a few large source files which doesn’t contain any imports. We need to do it this way if we want to verify our contracts on <a href="https://etherscan.io/">Etherscan</a> later because Etherscan verification doesn’t support imports.</p><p>To merge your contracts via sol-merger run: docker-compose exec workspace yarn merge. Merged contracts will appear in `./merge` directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M6nk5RAFqdO1sFmg" /></figure><p>Before we start to deploy the contracts, let’s take a look how deployment works in tests. We can find it in test/DemoPreSale.js <strong>lines 31–47</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZLw_wAaQFUVtvcZL" /><figcaption>Deployment code highlighted</figcaption></figure><p>According to this file we need to do the following steps:</p><ol><li>Deploy DemoToken</li><li>Deploy InvestorWhitelist contract</li><li>Deploy DemoPreSale</li><li>Deploy EthPriceProvider(if needed)</li><li>Set EthPriceReceiver in EthPriceProvider contract</li><li>Set token transfer agents: your address, PreSale address</li><li>Set EthPriceProvider in DemoPreSale contract</li><li>Transfer tokens we are going to sell to DemoPreSale</li></ol><p>Open your favourite text editor, copy the contents of ./merge/DemoToken.sol file. Go to <a href="https://remix.ethereum.org/">https://remix.ethereum.org</a> , login to your MetaMask account and select Ropsten test network in network menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/0*IY8AK80vfnt97zqu" /><figcaption>Ropsten testnet selected in MetaMask</figcaption></figure><p>Remix will ask if you want to reload the page. Press “Yes”.</p><p>Create new file in Remix, call it DemoToken.sol and paste the contents of ./merge/DemoToken.sol in this file.</p><p>On the right pane find “Run” section and open it. Ensure that Environment is Ropsten testnet, selected account belongs to you and you have enough ropsten ETH to deploy contracts and test functionality(Something like 0.5 ETH will enough). If you don’t have ropsten ETH you can use <a href="https://faucet.metamask.io/">one of free ropsten faucets </a>to get some free ether for your tests.</p><p>Select DemoToken in the dropdown menu in “Run” section as shown on the picture and press “Deploy” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PEFEZDfTYNleWk4S" /><figcaption>Deploying DemoToken using Remix IDE</figcaption></figure><p>If everything is OK, you will see MetaMask window asking you to confirm contract creation transaction. You can increase gas price if you want your transactions to get mined faster or decrease it if you can wait but want to save some money on deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/0*B7Op6EYGB4e51I3f" /><figcaption>Confirming contract creation in MetaMask</figcaption></figure><p>Press submit and wait for transaction confirmation. When transaction confirmed you can check it out at Etherscan and find your new smart contract address.</p><p>In my case it was this transaction: <a href="https://ropsten.etherscan.io/tx/0xb32c83f8a2337574f06a7c020591a59f398525f88cef6c0d443b67d919e5313c">https://ropsten.etherscan.io/tx/0xb32c83f8a2337574f06a7c020591a59f398525f88cef6c0d443b67d919e5313c</a></p><p>and this contract: <a href="https://ropsten.etherscan.io/address/0x5c50387b85c8e48315ad403d408ea9c67f036088">https://ropsten.etherscan.io/address/0x5c50387b85c8e48315ad403d408ea9c67f036088</a></p><p>I’ve got my contract address in the tx info on Etherscan. There are also some more interesting info like the fact of token transfer and actual tx cost.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pzXM6TWJRBEgciiV" /><figcaption>Etherscan.io info about transaction</figcaption></figure><p>OK, we just deployed our first contract and issued tokens to our own address. Now, let’s validate our contract source code on Etherscan so everyone can trust that the source code of the contract we publish belongs to the deployed bytecode. To do this, open contract address on Etherscan, and go to the “Code” tab. You will see “Verify and publish” link. Open it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RV0flzLBZgNaMqGV" /><figcaption>Code tab of the smart-contract at Etherscan</figcaption></figure><p>Open remix IDE, copy the source code of DemoToken.sol file and paste it in the text area on Etherscan smart contract validator. Enter the name of the contract “DemoToken” in the corresponding field. Go back to Remix IDE open “Compile” tab on the right pane and find current compiler version. In my case it is <em>0.4.25+commit.59dbf8f1</em>. Find the same compiler version in Etherscan contract validator dropdown menu and select it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-udANhVKIMy-Corb" /><figcaption>Etherscan contract verification</figcaption></figure><p>Scroll down, fill captcha and hit “Verify and publish” button. If everything is OK you will see the window saying that the contract source code and ABI verified and published.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wHFyoNt-_LkUnnU-" /></figure><p>If you update smart contract page on Etherscan you will notice some changes like green label on the Code tab and 2 new tabs called “Read contract” and “Write contract”. Only verified contracts on etherscan have this 2 tabs. Verification doesn’t make any sense in terms of functionality, it’s just an additional point for the trust to your contracts. So if you don’t care about the trust you can just skip this step. I will do verifications of all the contracts I deploy in this tutorial to make it easier for you to review and read the source code of the contracts as well as to check their current state.</p><p>Create the new file in Remix IDE and call it InvestorWhitelist.sol. Copy the content from the corresponding file in the ./merge folder on your local machine and deploy InvestorWhitelist contract using Remix IDE and MetaMask.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qz-lLlEy0X26L9wi" /></figure><p>When contract deployed, verify the source code on Etherscan like we did with DemoToken contract.</p><p>My deployment transaction: <a href="https://ropsten.etherscan.io/tx/0xfaaba7f611323050a05621139fc3335ef9530483b796433f95492c6764e1cbb4">https://ropsten.etherscan.io/tx/0xfaaba7f611323050a05621139fc3335ef9530483b796433f95492c6764e1cbb4</a></p><p>My contract address: <a href="https://ropsten.etherscan.io/address/0x3a7cc340d7c2c6a1f0b92886edfd935b8559be7f">https://ropsten.etherscan.io/address/0x3a7cc340d7c2c6a1f0b92886edfd935b8559be7f</a></p><p>Now, let’s take a look at our DemoPreSale contract. It would be more tricky to deploy because now we will need to use constructor arguments in order to configure this contract to our needs.</p><p>To see what constructor arguments we have there and how we need to pass them we can take a look at DemoPreSale contract constructor and test/DemoPreSale.js test, especially it’s “beforeEach” hook.</p><p>We will need to pass the following arguments:</p><p><strong>hard cap </strong>in tokens(ether, not wei), <strong>soft cap</strong> in tokens(ether, not wei), <strong>token address</strong>, <strong>beneficiary</strong>(who will receive the money when presale is finished), <strong>whitelist contract address</strong>, <strong>eth/usd rate</strong>, <strong>start timestamp</strong>, <strong>end timestamp</strong>. I would like to sell maximum 1M SPACE tokens during this presale. With no soft cap. I would like to be beneficiary of this contract and use whitelist we deployed before. Current eth/usd rate is 225.62$ for 1 ETH and I want my presale start at 10th October 2018 20:00 GMT +3 and end at 10th October 2019 20:00 GMT +3.</p><p>Open Remix IDE create file called DemoPreSale.sol and copy contents of the merge/DemoPreSale.sol file. Select DemoPreSale contract in the dropdown menu at Run tab on the right pane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iW0hc2r0PLVs8JI1" /></figure><p>Now, on the right side near “Deploy” button you can see text input field. We will pass our constructor arguments using this input field. In my case I will input the following:</p><p>1000000, 0, “0x5c50387b85c8e48315ad403d408ea9c67f036088”, “0x11EbB8665FcB1Ad9743566fDd2Dc76D234E9b7CA”, “0x3a7cc340d7c2c6a1f0b92886edfd935b8559be7f”, 22562, 1539190800, 1570726800</p><p>Pay attention at numbers. We pass eth/usd rate in cents so if rate is 225.62$ . we need to pass 22562. The last two numbers are unix timestamps. 1539190800 stay for 10th October 2018 20:00 GMT +3 and 1570726800 is for 10th October 2019 20:00 GMT +3. You can convert human readable time to unix timestamps easily using <a href="https://www.unixtimestamp.com/">timestamp convertor</a>.</p><p>Press “Deploy”.</p><p>My deployment transaction: <a href="https://ropsten.etherscan.io/tx/0x7e3d875e2d8c4d30c83d854001fac5458d5c7021880973ded5215c30a0fad165">https://ropsten.etherscan.io/tx/0x7e3d875e2d8c4d30c83d854001fac5458d5c7021880973ded5215c30a0fad165</a></p><p>My deployed contract: <a href="https://ropsten.etherscan.io/address/0xc470597fa47c589997f9d1c24d1f5ece9d18bd6a">https://ropsten.etherscan.io/address/0xc470597fa47c589997f9d1c24d1f5ece9d18bd6a</a></p><p>As usual I will verify contract source code on Etherscan. Please note that this time we will need to pass ABI-encoded constructor arguments in Etherscan contract verifier. In my case it will be</p><blockquote>00000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005c50387b85c8e48315ad403d408ea9c67f03608800000000000000000000000011ebb8665fcb1ad9743566fdd2dc76d234e9b7ca0000000000000000000000003a7cc340d7c2c6a1f0b92886edfd935b8559be7f0000000000000000000000000000000000000000000000000000000000005822000000000000000000000000000000000000000000000000000000005bbe3010000000000000000000000000000000000000000000000000000000005d9f6390</blockquote><p>After that deploy EthPriceProvider and do all like we did it before. When done you need to set watcher on this contract — our previously deployed DemoPreSale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AYT2wUUYjKb2GziV" /><figcaption>Setting watcher</figcaption></figure><p>After that let’s tell this price provider to update the price by calling startUpdate function and pass starting price parameter in cents. In my case it’s 25563.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VLqhAPv2bwB49zcS" /><figcaption>Starting price updates</figcaption></figure><p>It’s time to set EthPriceProvider address in our DemoPreSale contract so it can receive updates from provider contract. You can do this in Remix IDE on the right pane in Run section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QZQilVljLYZg5HBU" /><figcaption>Set ETH price provider in presale contract</figcaption></figure><p>We are almost done with our contracts. All we need to do now is to allow us and presale contract to transfer tokens by setting this addresses as transfer agents in DemoToken contract.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RVchUEfO4ayocs2n" /><figcaption>Setting transfer agents</figcaption></figure><p>To be able to sell tokens from presale smart contract we need to send the tokens we want to sell to the contract address. To do this find `transfer` field in DemoToken and pass “0x34240b44ff61c4c3542578636a12ff13e439ff2f” as the first argument and 1000000000000000000000000 as the second. It will send 1 million tokens(hard cap).</p><p>When transaction is mined you can see tokens on smart contract at Etherscan</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EnhMMLFxZeoRTSXH" /><figcaption>1 million SPACE tokens on contract balance</figcaption></figure><p>Yay! We have successfully deployed our contracts. It’s time to test and if everything is fine we will continue to the backend configuration stage. I will show you how to test the basic functionality - contract must send . corresponding amount of tokens for received ETH according to current ETH/USD rate and token price in USD. Note that our contract checks if investor was added to the whitelist and don’t allow to invest if address is not there. So if you want to buy tokens from your wallet <strong>you need to add this address to the whitelist</strong>. To do this just find InvestorWhitelist contract in the “Run” section at the right pane. Pass your address in double quotes as an argument and send transaction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QtGD2m5n6vk_uC5t" /><figcaption>Adding address to whitelist</figcaption></figure><p>Now, let’s go to MetaMask and send 4 ETH to our contract.</p><p>My transaction: <a href="https://ropsten.etherscan.io/tx/0xc0b3a03d979989fd43240ac5f1c35c22a3f4beffb463101fcbbd86842145b755">https://ropsten.etherscan.io/tx/0xc0b3a03d979989fd43240ac5f1c35c22a3f4beffb463101fcbbd86842145b755</a></p><p>As you can see it’s completed successfully and I received back 12,810 SPACE tokens from the contract.</p><p>In the next parts we will configure <a href="https://github.com/secret-tech/backend-ico-dashboard">backend</a> and <a href="https://github.com/secret-tech/frontend-ico-dashboard">frontend</a> applications to run locally and work with our ropsten smart contracts.</p><h3>Need your own custom ICO dashboard or other software?</h3><p>Contact us by email: info@secrettech.io or Telegram <a href="https://t.me/secret_tech1">https://t.me/secret_tech1</a></p><h3>Have any troubles making it work?</h3><p>Join our Telegram group and discuss with developers! <a href="https://t.me/spaceicodashboard">https://t.me/spaceicodashboard</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5beef46495a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The complete guide on Technical implementation of ICO using Open Source technologies. Part 1 of 4]]></title>
            <link>https://medium.com/@Hlogeon/the-complete-guide-on-technical-implementation-of-ico-using-open-source-technologies-part-1-of-4-472ac616980c?source=rss-db3d55d3f4fe------2</link>
            <guid isPermaLink="false">https://medium.com/p/472ac616980c</guid>
            <category><![CDATA[secret-tech]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ico]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Degtyaruk Andrey]]></dc:creator>
            <pubDate>Tue, 09 Oct 2018 10:13:11 GMT</pubDate>
            <atom:updated>2018-10-10T13:39:15.010Z</atom:updated>
            <content:encoded><![CDATA[<h3>The complete guide on Technical implementation of ICO using Open Source technologies. Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gr394va1dstcddFxxW9MZw.png" /></figure><h3>Contents</h3><p><em>[Part 1] Intro</em></p><p><em>[Part 1] Features</em></p><p><em>[Part 1] Installation steps</em></p><p><em>[Part 1] General overview</em></p><p>[Part 2] Smart-contracts</p><p>[Part 2] Backend</p><p>[Part 2] Frontend</p><p>[Part 2] Testing</p><p>[Part 3] Deploying to production</p><p>[Part 3] What can be done better?</p><p>[Part 3] Customisation and adding features</p><p>[Part 4] Reporting bugs</p><p>[Part 4] Contribute!</p><h3>Introduction</h3><p>Hi! I’m one of developers and tech lead of the team which built free Open Source ICO dashboard software <a href="https://icodashboard.space/">https://icodashboard.space</a> . First of all this dashboard is complicated custom software and not an ICO builder so you will need some technical knowledge to run an ICO using space ICO dashboard.</p><p>Space ICO dashboard(https://icodashboard.space) is a free software under MIT license available at GitHub(<a href="https://github.com/secret-tech/frontend-ico-dashboard">https://github.com/secret-tech/frontend-ico-dashboard</a> and <a href="https://github.com/secret-tech/backend-ico-dashboard">https://github.com/secret-tech/backend-ico-dashboard</a>). This project was created in order to provide turn-key technical solution for ICO organisers. <strong>This project was created by developers for developers</strong> <strong>so</strong> <strong>if you are not developer we suggest to hire us or any other dev team to configure and deploy dashboard because the risks are too high when you work with money</strong>. In this tutorial I will show you the basic setup process step by step so you can follow this instructions to run your own copy of <a href="https://demo.icodashboard.space/auth/sign-in">https://demo.icodashboard.space</a>. Please note that this setup is built for learning and I highly recommend you not to use this setup “as it is”. Another important thing to keep in mind is that we continuously improve our software and some modules/configurations can be changed during development.</p><p>I’m sorry this tutorial is so long but I think I would better create a complete guide I can refer to in case of any problems than answering a lot of the same questions again and again.</p><h3>Environment &amp; Prerequisites</h3><p>Our team is using OS X and Debian-based Linux distributions for development and production. Since all the required services are packaged into docker containers it may work on Windows machines as well but honestly we didn’t test it and don’t have this in our plans.</p><p>To run the dashboard you need to have the following skills:</p><ul><li>JavaScript</li><li>ReactJS + Redux</li><li>NodeJS(express framework)</li><li>MongoDB, Redis</li><li>docker &amp; docker-compose</li><li>Basic Linux knowledge and server administration skills</li><li>Ethereum &amp; Solidity</li></ul><p><strong>If you don’t have an idea what is it all about, you’d better hire someone to help you or find more simple solution.</strong></p><p>I personally will use OS X Mojave in this tutorial with git, Docker and NodeJS installed locally.</p><h3>Features</h3><p>Space ICO dashboard provides the following features:</p><ul><li>User registration &amp; login</li><li>2FA (email, Google Authenticator)</li><li>User profile settings</li><li>KYC/AML (currently we support 2 service providers for KYC/AML — Shuftipro and Jumio Netverify)</li><li>Referral/partner program</li><li>Live currency updates (ETH/USD, USD/Your token, etc) using Oraclize and Kraken API</li><li>Native Ethereum support</li><li>150+ alt coins &amp; Bitcoin support using <a href="https://coinpayements.net/">https://coinpayements.net</a></li><li>Cold wallets but NO MetaMask required</li><li>Transaction tracking(outgoing and incoming)</li><li>ICO status tracking</li><li>Custom emails</li><li>Investor whitelisting</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CP7trYdHwE0fskXh0VJwvw.png" /><figcaption><a href="https://demo.icodashboard.space/">https://demo.icodashboard.space</a> Sign In screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B7kIzVi7RAtUhsrMz45uSQ.png" /><figcaption><a href="https://demo.icodashboard.space/">https://demo.icodashboard.space</a> main screen</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EtyhLIC67JsET_8d5Pal3w.png" /><figcaption><a href="https://icodashboard.space/">https://icodashboard.space</a> User settings page</figcaption></figure><h3>Installation steps</h3><p>OK, all introduction words said so far and now we can go through overview of all the installation steps we will need to do in order to run our own copy of icodashboard.space. There are 4 the most important parts of setting up the dashboard. It’s pretty important to do the things one by one in the correct order to save the time and be able to test all the parts separately and than all together.</p><ol><li>Configure 3rd-parties</li><li>Setup Infrastructure</li><li>Setup Backend</li><li>Setup Frontend</li></ol><p>We use some 3rd party services to delegate all the boring tasks like sending emails and handling KYC/AML to professionals. In this tutorial by 3rd-parties I mean:</p><ul><li><a href="https://ethereum.org/">Ethereum blockchain</a> via <a href="https://infura.io/">infura.io</a></li><li><a href="http://mailjet.com/">Mailjet</a></li><li><a href="https://cloudflare.com/">Cloudflare</a></li><li><a href="https://www.linode.com/">Linode</a></li><li><a href="http://shuftipro.com/">Shuftipro</a></li></ul><p>3rd party services required for backend to operate correctly. There are some ways to not to rely on other services but it will take much more time to explain it here and for this tutorial we will just ignore this part. We will configure all the third-parties by the way as soon as our backend module configuration requires it.</p><p>Backend and frontend modules are built on top of infrastructure — it’s all about where do you run this apps and how requests arrive to application. In this tutorial we will run our app in 2 environments: local and production on 5$ Linode. You will need to prepare your infrastructure before setting up backend and frontend modules.</p><p>Backend module takes care about all the business logic of our ICO dashboard. Backend module is designed to provide an API to frontend application being a single entry point for the frontend app. Frontend application is a user-friendly interface to access backend API this means that we will configure frontend at the latest stage.</p><h3>General overview</h3><p>Before we go to setting it up let me explain how it works in general. Let’s start from explanation of overall architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*9zDucHOzBtDjf52P" /><figcaption>Architecture overview. Communication between frontend and backend</figcaption></figure><p>As you can see, user interacts only with frontend app, frontend interacts only with user and backend which takes care of all the rest. Here I showed backend as a monolithic thing but in reality it consists of multiple services. And to be able to fix problems when they appear you should at least know what services are included in our backend and what do they do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*C8JGQLanTmyO-941" /><figcaption>Architecture overview. Backend modules</figcaption></figure><p>The minimum backend configuration we will build in this tutorial will look like one on the picture and will work like our demo app at <a href="https://demo.icodashboard.space/">https://demo.icodashboard.space</a> . We are using docker-compose files to describe which services we want to run for our app. An example docker-compose.yml file can be found in the repo: <a href="https://github.com/secret-tech/backend-ico-dashboard/blob/develop/docker-compose.stage.yml">https://github.com/secret-tech/backend-ico-dashboard/blob/develop/docker-compose.stage.yml</a></p><p>In this file,<strong> lines 52–64</strong> you can find service called ‘rpc’ which I didn’t add to the picture above. You would like to add this service in case you want to run your own full Ethereum node with rpc interface to interact with blockchain instead of using <a href="http://infura.io/">Infura.io</a> API. In this tutorial we will not cover setting up own node and will use great free service — <a href="http://infura.io/">infura.io</a> which provides all rpc methods we need for our dashboard by very simple API.</p><p>Now let’s back to services from the picture and cover what they are used for. <strong>Redis</strong> and <strong>MongoDB</strong> are just databases. We use redis to store the data requested frequently and some data we don’t want to store for a long time. MongoDB is used for domain-specific things(in our case it’s ICO specific things).</p><p><a href="https://github.com/JincorTech/backend-auth"><strong>Auth </strong>service</a> registers users with their username(login/email), and tenant ID(for multi tenancy support). When user makes attempt to login with his or her credentials, Auth service is trying to match credentials. If success it generates unique random session key which is used as part of the JWT secret and stores this session to database. This means that no one can validate token without making a call to Auth service because the JWT signature created using specific Auth’s secret key and random session id known only by Auth service. This session mechanism is also used to invalidate tokens. Removing session key from the database will do the trick. Auth provides an HTTP API for the ICO dashboard service for user management purpose. In order to isolate environments from each other(for instance you would like to use auth service in the other app and you don’t want it to have an access to the users of another app) we’ve implemented <strong>tenant authorization </strong>mechanism: in case you want to read and/or write data to this service as well as validate user’s JWT tokens, you have to pass tenant JWT token in the request Authorization header. We’ll take a closer look on it during our backend configuration. <a href="https://jincortech.github.io/backend-auth/index.html">Get more info in API docs.</a></p><p><a href="https://github.com/JincorTech/backend-verify"><strong>Verify</strong></a><strong> </strong>is a service to verify user’s email, phone or other contact information as well as verification of actions in the application(2FA, approve action by code from email/sms, etc). The main responsibilities are:</p><ol><li>Interact with a service provider(email, phone, Google Authenticator)</li><li>Validation of a received code</li></ol><p>We use this service during the registration step in order to verify that email provided by user belongs to user by emailing 6-digit code and asking users to enter this code. The same service is used for 2FA(Google Authenticator) and transaction approval by user. <a href="https://jincortech.github.io/backend-verify/">To get more info check out API docs.</a></p><p><a href="https://github.com/secret-tech/backend-ico-dashboard"><strong>ICO dashboard</strong></a><strong> </strong>is the service which provides an API(read docs here: <a href="https://secret-tech.github.io/backend-ico-dashboard/">https://secret-tech.github.io/backend-ico-dashboard/</a> ) to the frontend application and do all the business logic. Some parts of business logic delegated to the other services but ICO dashboard still manages all the processes.</p><p>In the next part we will deploy smart-contracts to the test Ethereum network, and deploy frontend and backend locally to be able to test everything before deploying to the server. We will register accounts on some 3rd-party services to be able functionality like email.</p><h3>Need your own custom ICO dashboard?</h3><p>Contact us by email: info@secrettech.io or Telegram <a href="https://t.me/secret_tech1">https://t.me/secret_tech1</a></p><h3>Having troubles setting up?</h3><p>Join our Telegram group and discuss with developers! <a href="https://t.me/spaceicodashboard">https://t.me/spaceicodashboard</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=472ac616980c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>