RICO Tutorial(日本語版)
/icons/hr.icon
このページはRICOを使ったICOを始めるための初期手順を説明しています。
RICOとは何ですか? /icons/github.icon : RICO RICO(Responsible Initial Coin Offering)は、公平性と透明性に着目したICO手法の提案とその実装のフレームワークです。 Ethereum用に最適化されたオープンソースソフトウェアです。(ライセンスはGPL Version 3) RICOには、以下のような特徴があります。
1. 公平性と透明性
ICOの全てのフローをEthereumコントラクトだけで完結することで、資金の流れの透明性を向上させます。 2. シンプル
Solidityの深い知識が必要なくてもICOコントラクトを開発し、開発コストを抑えることができます。 DRIが提供しているRICOコントラクトを用いれば、そのコントラクトがそれぞれのICOのためのコントラクトを自動デプロイするため、トランザクションを送るだけでICOコントラクトを作ることができます。自らコントラクトをデプロイする必要すらありません。 3. 拡張性
Proof of Donation(PoDアーキテクチャ)よって様々なICO手法をモジュール化しているため、簡単に独自のICO手法を拡張してテストできます。 はじめてのRICO
このページでは基本的なICOを実現するための基礎知識とガイドライン、RICOを使った基本的なICOの始め方を説明します。前提知識としてRICOのアーキテクチャ哲学を知っておくと、より理解がしやすいでしょう。 RICOの使い方を学ぶ上で、RICOは必ずしも万能ではないことに注意してください。ICO手法はたくさんありますが、その全ての方法を網羅することはできません。RICOが当てはまらないICOパターンがある場合やより良い手法が出て来た場合は、お気軽にDRIのコミュニティSlackなどでコメントいただけると嬉しいです。 RICOを使うための準備
NOTE: RICOを使ってICOを行うときに、ICOの具体的なスケジュールが詳細に決まっている必要はありません。RICOにはガイドラインAPIが備わっているため、先にRICOコントラクトのデプロイメントが終了し、準備が整ってから、ICOを実施する期間を設定できます。
依存環境
NodeJS@^9.0.0
SolidtyCompiler@0.4.18
Truffle@4.0.1
最初にプロジェクトを展開するためにTruffleを入れましょう。npmでインストールします。 code:sh
$ npm install truffle@4.0.1 -g
また、Ethereumのテストを行うのに最適なRPC-clientであるGanache-CLIを入れましょう。Ganache-CLIはEthereumのトランザクションが実行された時のEVMの状態をデバッグすることができます。 code:bash
$ npm install ganache-cli -g
RICOのインストール
2018/1/13日の時点での最新バージョンは rico-core@0.9.3-commit.f1d96b8'です。
code: bash
$ npm install -g rico-core
プロジェクトの作成
rico newコマンドから新しいプロジェクトを生成しましょう。
code: sh
$ rico new helloico && cd helloico
依存関係のインストール
code: sh
$ npm install truffle-hdwallet-provider
RICOを使ったICOのサンプル
RICOではコントラクトのデプロイをLauncherコントラクトに対するトランザクションで行います。以下のようなコマンドで、トランザクションを生成し、プロジェクトをスタートすることができます。(ropstenテストネット) code:bash
$ export RICO_ADDR=0x9e18e5bdb7f47631cf212b34a42cd54cfd713a6d
$ export LAUNCHER_ADDR=0x40c75eb39c3a06c50b9109d36b1e488d99aadf97
$ truffle exec exec/KickStart/deploy.js --network ropsten
exec/KickStart/deploy.jsが、サンプルプロジェクトのトランザクション生成ファイルです。
トランザクションの生成ファイル
code:js: exec/KickStart/deploy.js
const Launcher = artifacts.require("./Launcher.sol")
const RICO = artifacts.require("./RICO.sol")
const MultiSigWalletWithDailyLimit = artifacts.require("./MultiSigWalletWithDailyLimit.sol")
// Set variables for your Responsible ICO:
const name = "Responsible ICO Token"; // token name
const symbol = "RIT"; // token symbol
const decimals = 18;
const totalTokenSupply = 400000 * 10 ** 18; // set maximum supply to 400,000.
const now = parseInt(new Date() / 1000);
const publicSaleTokenSupply = totalTokenSupply * 90 / 100; // total token amount for the public sale
const publicSaleWeiCap = 100 * 10 ** 18; // Set the cap of the public sale to 100 ether.
const publicSaleStartTime = now + 172800; // Set the start of the Public dat to 2 days from now.
// Owner of the ICO. All ICO funds to be received in a multisig wallet.
const multisigWalletAddress1 = 0x0; // Can be your own address. Defaults to the user who executes this script.
const multisigWalletAddress2 = 0x0; // Must be different from address 1
const multisigWalletDailyLimit = 1 * 10 ** 18; // Allows an owner to withdraw a daily limit without multisig. Set to 1 ether.
/**
* Set variables ONLY for Standard ICO (not used with Simple ICO)
*/
// Take over Bid (TOB)
const TOBFunder; // Defaults to the user who executes this script.
const TOBStartTime = now + 72000; // sec
const TOBTokenSupply = totalTokenSupply * 8 / 100; // 8% of the totalTokenSupply
const TOBPrice = 100 * 10 ** 18; // = 100 ether for the TOB
// A second TOB owner can be set.
const TOBSecondOwner = 0x0; // (Optional) Second owner of the TOB. Can be the same as TOBFunder. Defaults to the user who executes this script.
const secondOwnerAllocation = totalTokenSupply * 2 / 100; // 2% of the totalTokenSupply is given to a second owner at the expense of the TOB funder.
const marketMaker = 0x0; // The first market maker's address
/**
* Set variables ONLY for Simple ICO (not used with RICO Standard ICO)
*/
const separateAllocationTokenAmount = totalTokenSupply * 10 / 100; // Set the separate allocated tokens to 10% of the totalTokenSupply.
const separateAllocationLockTime = publicSaleStartTime + 2592000; // Set lock time of the separate allocation to 1 month.
module.exports = async function (callback) {
const rico = await RICO.at(process.env.RICO_ADDR) // retrieve the deployed RICO instance on the network
const launcher = await Launcher.at(process.env.LAUNCHER_ADDR) // retrieve the deployed Launcher instance on the network
const multisigWalletAddress1 = (!multisigWalletAddress1) ? await getAccount() : multisigWalletAddress1;
const TOBFunder = await getAccount();
const TOBSecondOwner = (!TOBSecondOwner) ? await getAccount() : TOBSecondOwner;
console.log(RICO: ${rico.address} launcher: ${launcher.address})
console.log(MultisigWallet: ${wallet.address})
var newICO;
// launch the simpleICO on the already deployed Launcher.sol
// see Launcher.sol for clarification on the parameters
newICO = await launcher.simpleICO(
name,
symbol,
decimals,
wallet.address,
)
// launch the standardICO on the already deployed Launcher.sol
// see Launcher.sol for clarification on the parameters
/**
*
*
newICO = await launcher.standardICO(
name,
symbol,
decimals,
wallet.address,
)
*/
console.log(tx:${newICO.tx})
}
function getAccount() {
return new Promise((resolve, reject) => {
web3.eth.getAccounts((err, accounts) => {
const currentUser = accounts0 resolve(currentUser)
})
})
}
standardICO ー
simpleICO ー
リファレンス
Q&A
RICOを使ったICOはどのようにはじめたら良いのでしょうか?
RICOを使うことでメリットがどこにあるのか?
RICOを使ったICOのベストプラクティスはどこにあるのでしょうか?
参考