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.

There are two ways to access the Travis blockchain network.

  • The recommended (and safe) approach is to run your own Travis node.
  • The less desirable approach is to ask and receive a set of username/password credential so that you can access our node at travis-node.cybermiles.io. To do that, please email your request to [email protected] A single line email saying “I needed access” would suffice.

In this article, we will cover the second use case.

Once you have the username/password credentials, you can just use your favorite Ethereum client. For example, you can use GETH to connect to a TestNet node.

geth attach http://username:[email protected]:8545

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

Welcome to the Geth JavaScript console! > personal.newAccount() ...

You can also use tools like Truffle to build and test smart contracts on the Travis TestNet. Just use the http://username:[email protected]:8545 node as if it is a regular Ethereum node.

Get some test CMTs

Now you have created TWO accounts 0x1234FROM and 0x1234DEST on the Travis TestNet. It is time to get some test CMTs. Please go visit the website below, and ask for 1000 testnet CMTs for account 0x1234FROM. We will also 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 ...
> eth.sendTransaction({from:"0x1234FROM", to:"0x1234DEST",value:1000}) ...
>eth.getBalance("0x1234DEST") ...

You can also 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.eth.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 GETH console.

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

To try a fee-free smart contract-based token transaction, use the following in the GETH 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 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 providerfromto, and password to the accounts you just created. The provider field is the GETH RPC URL with username and password prefix.
  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 [email protected]

The web3-cmt.js client library

As you probably have noticed, in the sendTx.js and sendTokenTx.js scripts, we used the web3-cmt.js library to access the cmt modules, as a replacement for the eth module in the Ethereum web3.js library.

The web3-cmt.js client library supports features specific to the CyberMiles blockchain, including staking and governance. Its cmt module is also fully backwards compatible with web3’s eth module.

Recent Posts