Before we can start building our first Crypti dapp, we must first setup our development environment.
Please ensure the below requirements are met before continuing.
-
Download and install the Xcode developer tools from the App Store.
-
Open a command prompt and proceed with the following:
-
Install the Homebrew package manager.
```
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
```
- Install nodejs (package also includes npm).
```
brew install homebrew/versions/node012
```
- Install sqlite, git and wget.
```
brew install sqlite git wget
brew link sqlite --force
```
One important note: Crypti's VM (Virtual Machine) is only sandboxed on Linux operating systems. Mac OS X can be used for development purposes, but in production you will need to use Linux based master nodes.
Open a command prompt and proceed with the following:
- Install sqlite and git plus some build essentials.
sudo apt-get install sqlite3 git build-essential curl wget unzip
- Add the NodeSource package repository to your system.
curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -
- Install nodejs (package also includes npm).
sudo apt-get install -y nodejs
Currently we only support development on Mac OS X and Linux operating systems. If you don't have either, see below for instructions on installing a Ubuntu based virtual machine using Vagrant.
- Download and install the latest versions of the following applications:
- Open a command prompt. Then make a directory to store your environment.
mkdir crypti
cd crypti
- Initialize a new Ubuntu based virtual machine using vagrant:
vagrant init ubuntu/trusty64
- Open and edit the file named
Vagrantfile
as follows:
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "forwarded_port", guest: 7040, host: 7040
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
end
- Boot up the virtual machine and let it install:
vagrant up
Once the virtual machine has finished installing, you should have a fully functioning environment running Ubuntu 14.04 LTS 64-bit.
- Verify the status of the virtual machine using the following command:
vagrant status
Vagrant should state the VM is running, and give instructions on how to shutdown or suspend it.
- Login to your newly created VM using the following credentials:
- IP address: 127.0.0.1
- Port: 2222
- Username: vagrant
- Password: vagrant
To login, enter the command vagrant ssh
or open and use PuTTY.
-
Upon successfully logging into your VM. Proceed with the following steps:
-
Install sqlite and git plus some build essentials.
```
sudo apt-get install sqlite3 git build-essential curl wget unzip
```
- Add the NodeSource package repository to your system.
```
curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -
```
- Install nodejs (package also includes npm).
```
sudo apt-get install -y nodejs
```
- Your virtual machine environment should now be ready.
By default, Vagrant synchronizes your project directory between the local machine and client VM. For example, the contents of C:\Users\User\crypti
are accessible as /vagrant
on the client VM and vice versa.
For further information about using vagrant, please read the official vagrant documentation.
If you don't have a GitHub account already, then we would recommend signing up for one, before proceeding any further.
Please also ensure, you have a public / private SSH keypair installed within the operating system you are developing on, and that the public key has been added to your GitHub account.
To verify you have them installed, or generate a new keypair. Please read the appropriate GitHub help page:
To start work on our dapp, we first need to install a testnet version of Crypti. This can be done by running the following commands:
On Mac OS X/Linux operating systems:
git clone git@github.com:crypti/crypti.git
cd crypti
git fetch origin 0.5.4-testnet:0.5.4-testnet
git checkout 0.5.4-testnet
git submodule init
git submodule update
cd public
git fetch origin dapps:dapps
git checkout dapps
npm install
bower install
grunt release
cd ../
npm install
For Linux users:
wget http://downloads.crypti.me/crypti-node/VM/linux-nodejs.zip
unzip linux-nodejs.zip
For MacOS users:
wget http://downloads.crypti.me/crypti-node/VM/macos-nodejs.zip
unzip macos-nodejs.zip
Then launch Crypti and verify our base testnet is working correctly:
node app.js
If successful, Crypti will launch and connect to the base testnet network.
Now let's install crypti-cli and finally start work on our first dapp:
sudo npm install -g crypti-cli
After installation completes, check that crypti-cli is installed correctly:
crypti-cli -h
If successful crypti-cli should yield the following output:
Usage: crypti-cli [options] [command]
Commands:
dapps [options] manage your dapps
contract [options] contract operations
crypto [options] crypto operations
Options:
-h, --help output usage information
-V, --version output the version number
Congratulations! We are now ready to create our first dapp! Let's continue with the next tutorial.