Categorygithub.com/Tao-Network/tao2
modulepackage
0.0.0-20210126205931-b4cfd715f5ee
Repository: https://github.com/tao-network/tao2.git
Documentation: pkg.go.dev

# README

Tao

Build Status Join the chat at https://gitter.im/Tao-Network/community

About Tao

Tao is an innovative solution to the scalability problem with the Ethereum blockchain. Our mission is to be a leading force in building the Internet of Value, and its infrastructure. We are working to create an alternative, scalable financial system which is more secure, transparent, efficient, inclusive, and equitable for everyone.

Tao relies on a system of 150 Masternodes with a Proof of Stake Voting consensus that can support near-zero fee, and 2-second transaction confirmation times. Security, stability, and chain finality are guaranteed via novel techniques such as double validation, staking via smart-contracts, and "true" randomization processes.

Tao supports all EVM-compatible smart-contracts, protocols, and atomic cross-chain token transfers. New scaling techniques such as sharding, private-chain generation, and hardware integration will be continuously researched and incorporated into Tao's masternode architecture. This architecture will be an ideal scalable smart-contract public blockchain for decentralized apps, token issuances, and token integrations for small and big businesses.

More details can be found at our technical white paper

Read more about us on:

Building the source

Tao provides a client binary called tao for both running a masternode and running a full-node. Building tao requires both a Go (1.7+) and C compiler; install both of these.

Once the dependencies are installed, just run the below commands:

$ git clone https://github.com/Tao-Network/tao2 tao
$ cd tao
$ make tao

Alternatively, you could quickly download our pre-complied binary from our github release page

Running tao

Running a tao masternode

Please refer to the official documentation on how to run a node if your goal is to run a masternode. The recommanded ways of running a node and applying to become a masternode are explained in detail there.

Attaching to the Tao test network

We published our test network 2.0 with full implementation of PoSV consensus at https://stats.testnet.tao.network. If you'd like to experiment with smart contract creation and DApps, you might be interested to give these a try on our Testnet.

In order to connect to one of the masternodes on the Testnet, just run the command below:

$ tao attach https://testnet.tao.network

This will open the JavaScript console and let you query the blockchain directly via RPC.

Running tao locally

Download genesis block

$GENESIS_PATH : location of genesis file you would like to put

export GENESIS_PATH=path/to/genesis.json
  • Testnet
curl -L https://raw.githubusercontent.com/Tao-Network/tao2/master/genesis/testnet.json -o $GENESIS_PATH
  • Mainnet
curl -L https://raw.githubusercontent.com/Tao-Network/tao2/master/genesis/mainnet.json -o $GENESIS_PATH

Create datadir

  • create a folder to store tao data on your machine
export DATA_DIR=/path/to/your/data/folder 
mkdir -p $DATA_DIR/tao

Initialize the chain from genesis

tao init $GENESIS_PATH --datadir $DATA_DIR

Initialize / Import accounts for the nodes's keystore

If you already had an existing account, import it. Otherwise, please initialize new accounts

export KEYSTORE_DIR=path/to/keystore
Initialize new accounts
tao account new \
  --password [YOUR_PASSWORD_FILE_TO_LOCK_YOUR_ACCOUNT] \
  --keystore $KEYSTORE_DIR
Import accounts
tao  account import [PRIVATE_KEY_FILE_OF_YOUR_ACCOUNT] \
     --keystore $KEYSTORE_DIR \
     --password [YOUR_PASSWORD_FILE_TO_LOCK_YOUR_ACCOUNT]
List all available accounts in keystore folder
tao account list --datadir ./  --keystore $KEYSTORE_DIR

Start a node

Environment variables
  • $IDENTITY: the name of your node
  • $PASSWORD: the password file to unlock your account
  • $YOUR_COINBASE_ADDRESS: address of your account which generated in the previous step
  • $NETWORK_ID: the networkId. Mainnet: 558. Testnet: 559
  • $BOOTNODES: The comma separated list of bootnodes. Find them here
  • $WS_SECRET: The password to send data to the stats website. Find them here
  • $NETSTATS_HOST: The stats website to report to, regarding to your environment. Find them here
  • $NETSTATS_PORT: The port used by the stats website (usually 443)
Let's start a node
tao  --syncmode "full" \    
    --datadir $DATA_DIR --networkid $NETWORK_ID --port 20202 \   
    --keystore $KEYSTORE_DIR --password $PASSWORD \    
    --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 --rpcport 8545 --rpcvhosts "*" \   
    --rpcapi "db,eth,net,web3,personal,debug" \    
    --gcmode "archive" \   
    --ws --wsaddr 0.0.0.0 --wsport 8546 --wsorigins "*" --unlock "$YOUR_COINBASE_ADDRESS" \   
    --identity $IDENTITY \  
    --mine --gasprice 2500 \  
    --bootnodes $BOOTNODES \   
    --ethstats $IDENTITY:$WS_SECRET@$NETSTATS_HOST:$NETSTATS_PORT 
    console
Some explanations on the flags
--verbosity: log level from 1 to 5. Here we're using 4 for debug messages
--datadir: path to your data directory created above.
--keystore: path to your account's keystore created above.
--identity: your full-node's name.
--password: your account's password.
--networkid: our network ID.
--tao-testnet: required when the networkid is testnet(559).
--port: your full-node's listening port (default to 20202)
--rpc, --rpccorsdomain, --rpcaddr, --rpcport, --rpcvhosts: your full-node will accept RPC requests at 8545 TCP.
--ws, --wsaddr, --wsport, --wsorigins: your full-node will accept Websocket requests at 8546 TCP.
--mine: your full-node wants to register to be a candidate for masternode selection.
--gasprice: Minimal gas price to accept for mining a transaction.
--targetgaslimit: Target gas limit sets the artificial target gas floor for the blocks to mine (default: 4712388)
--bootnode: bootnode information to help to discover other nodes in the network
--gcmode: blockchain garbage collection mode ("full", "archive")
--synmode: blockchain sync mode ("fast", "full", or "light". More detail: https://github.com/Tao-Network/tao2/blob/master/eth/downloader/modes.go#L24)           
--ethstats: send data to stats website

To see all flags usage

tao --help

See your node on stats page

Contributing and technical discussion

Thank you for considering to try out our network and/or help out with the source code. We would love to get your help; feel free to lend a hand. Even the smallest bit of code, bug reporting, or just discussing ideas are highly appreciated.

If you would like to contribute to the tao source code, please refer to our Developer Guide for details on configuring development environment, managing dependencies, compiling, testing and submitting your code changes to our repo.

Please also make sure your contributions adhere to the base coding guidelines:

  • Code must adhere to official Go formatting guidelines (i.e uses gofmt).
  • Code comments must adhere to the official Go commentary guidelines.
  • Pull requests need to be based on and opened against the master branch.
  • Any code you are trying to contribute must be well-explained as an issue on our github issue page
  • Commit messages should be short but clear enough and should refer to the corresponding pre-logged issue mentioned above.

For technical discussion, feel free to join our chat at Gitter.

# Packages

Package accounts implements high level Ethereum account management.
simple nonconcurrent reference implementation for hashsize segment based Binary Merkle tree hash on arbitrary but fixed maximum chunksize This implementation does not take advantage of any paralellisms and uses far more memory than necessary, but it is easy to see that it is correct.
No description provided by the author
Package common contains various helper functions.
No description provided by the author
Package consensus implements different Ethereum consensus engines.
No description provided by the author
No description provided by the author
Package core implements the Ethereum consensus protocol.
No description provided by the author
Package eth implements the Ethereum protocol.
Package ethclient provides a client for the Ethereum RPC API.
No description provided by the author
Package ethstats implements the network stats reporting service.
Package event deals with subscriptions to real-time events.
Package les implements the Light Ethereum Subprotocol.
Package light implements on-demand retrieval capable state and chain objects for the Ethereum Light Client.
Package log15 provides an opinionated, simple toolkit for best-practice logging that is both human and machine readable.
Go port of Coda Hale's Metrics library <https://github.com/rcrowley/go-metrics> Coda Hale's original work: <https://github.com/codahale/metrics>.
Package miner implements Ethereum block creation and mining.
Package geth contains the simplified mobile APIs to go-ethereum.
Package node sets up multi-protocol Ethereum nodes.
Package p2p implements the Ethereum p2p network protocols.
No description provided by the author
Package rlp implements the RLP serialization format.
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
No description provided by the author
No description provided by the author
Copyright 2019 The Tao Authors This file is part of the Core Tao infrastructure https://tao.network Package taoxDAO provides an interface to work with taox database, including leveldb for masternode and mongodb for SDK node.
No description provided by the author
Package tests implements execution of Ethereum JSON tests.
Package trie implements Merkle Patricia Tries.
No description provided by the author

# Variables

NotFound is returned by API methods if the requested item does not exist.

# Structs

CallMsg contains parameters for contract calls.
FilterQuery contains options for contract log filtering.
SyncProgress gives progress indications when the node is synchronising with the Ethereum network.

# Interfaces

ChainReader provides access to the blockchain.
ChainStateReader wraps access to the state trie of the canonical blockchain.
ChainSyncReader wraps access to the node's current sync status.
A ContractCaller provides contract calls, essentially transactions that are executed by the EVM but not mined into the blockchain.
GasEstimator wraps EstimateGas, which tries to estimate the gas needed to execute a specific transaction based on the pending state.
GasPricer wraps the gas price oracle, which monitors the blockchain to determine the optimal gas price given current fee market conditions.
LogFilterer provides access to contract log events using a one-off query or continuous event subscription.
PendingContractCaller can be used to perform calls against the pending state.
A PendingStateEventer provides access to real time notifications about changes to the pending state.
A PendingStateReader provides access to the pending state, which is the result of all known executable transactions which have not yet been included in the blockchain.
Subscription represents an event subscription where events are delivered on a data channel.
TransactionReader provides access to past transactions and their receipts.
TransactionSender wraps transaction sending.