Cybermiles

Cybermiles

Travis TestNet Guide

The ‘Travis’ TestNet is fully backward compatible with Ethereum — but 100 times faster, and with protocol-level optimizations for e-commerce applications. Read more about it here.

The best way to get started with CyberMiles’ Travis TestNet is to run your own full node. A full node can securely provide you access to all functions of the blockchain, including a local wallet to manage your test CMT, as well as staking and governance functions of the blockchain.

Prerequisite

You must have GO language version 1.9+ installed in order to build and run a Travis node. The easiest way to get GO 1.9 is through the GVM. Below are the commands on a Linux server.

bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
source $HOME/.gvm/scripts/gvm
gvm install go1.9.2 -B
gvm use go1.9.2 --default

You should include the last command gvm use go1.9.2 --default in your startup script (e.g. .bash_profile) so that it runs every time you log in.

Building and installing Travis

$ go get github.com/CyberMiles/travis
$ cd $GOPATH/src/github.com/CyberMiles/travis
$ git checkout master
$ make all

If the system cannot find glide at the last step, make sure that you have $GOPATH/bin under the $PATH variable.

Getting Travis TestNet Config

You can checkout the Travis TestNet config from our Github repo. Place the config files in the $HOME/.travis directory.

$ cd 
$ rm -rf .travis
$ git clone https://github.com/CyberMiles/testnet.git
$ cp -r testnet/travis/init .travis

Now you are ready to start your own node on the Travis TestNet.

Start your node

Do this from your home directory.

$ cd
$ travis node start --home=./.travis

Watch the output on the console, and wait until it catches up to the latest block. The latest blocks are generated once every 10 seconds.

Access the network

In a separate terminal console, you can access the Travis blockchain network through your local node.

travis attach http://localhost:8545

From there, you can use web3-cmt commands to create new accounts, transact between accounts, create and upload smart contracts, and execute smart contracts.

Welcome to the TravisJavaScript console! > personal.newAccount() ...

Get some test CMT

Now you have created two accounts 0x1234FROM and 0x1234DEST on the Travis TestNet. It is time to get some test CMT. Please go visit the website below, and ask for 1000 testnet CMT for account 0x1234FROM. We also will send 1000 TEST tokens, issued by the TEST smart contract, to the account.

http://travis-faucet.cybermiles.io

You can test transactions between your two accounts.

> personal.unlockAccount("0x1234FROM","password") true ...
> cmt.sendTransaction({from:"0x1234FROM", to:"0x1234DEST",value:1000}) ...
> cmt.getBalance("0x1234DEST") ...

You also can test smart contract transactions for the TEST token as below.

> abi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"INITIAL_SUPPLY","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_subtractedValue","type":"uint256"}],"name":"decreaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_addedValue","type":"uint256"}],"name":"increaseApproval","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
> tokenContract = web3.cmt.contract(abi)
> tokenInstance = tokenContract.at("0xb6b29ef90120bec597939e0eda6b8a9164f75deb")
> tokenInstance.transfer.sendTransaction("0x1234DEST", 1000, {from: "0x1234FROM"})

After 10 seconds, you can check the balance of the receiving account as follows.

> tokenInstance.balanceOf.call("0x1234DEST")

Fee free transactions

On CyberMiles’ blockchain, we have made most transactions (except for heavy users or spammers) fee-free. You can try it like this in Travis console.

> cmt.sendTransaction({from:"0x1234FROM", to:"0x1234DEST",value:1000,gasPrice:0}) ...

To try a fee-free smart contract-based token transaction, use the following in the Travis console.

> tokenInstance.transfer.sendTransaction("0x1234DEST", 1000, {from: "0x1234FROM", gasPrice: 0})

Prevent address errors

Details coming soon!

Stress testing

We stress test the blockchain performance using our benchmark tool. The tool is a Node.js JavaScript application that first loads up a batch of transactions sends over to Travis, waits until all of the transactions are recorded on the blockchain, and then computes the transactions per second (TPS) for the session. Here are the prerequisites:

  1. Install node.js (8.0 and above).
  2. Download https://www.dropbox.com/s/gzb2zqxcjgchv36/enduser.zip?dl=0 and unzip into a folder enduser.
  3. Change into that folder: cd enduser
  4. Edit the config/default.json file: change the fromto, and passwordto the accounts you just created.
  5. Now make sure that you run the following scripts in a data center environment (e.g. from an adequately configured AWS VM in a US data center). If you run them from your laptop, you will not be able to fully saturate the Travis TestNet from a single network node.

The sendTx.js script sends a batch of CMT transactions to the Travis TestNet.

node sendTx.js

The sendTokenTx.js script sends a batch of TEST smart contract transactions to the Travis TestNet.

node sendTokenTx.js

Please report back your configurations, including data center environments, and the CMT / TEST transactions per second you are able to reach. Email your results to travis@cybermiles.io.

Recent Posts