Getting started with the Tezos command-line client on mainnet (MacOS)
Greetings, Tezos family. Some of you may know me by name, but most of you know me better as
TezosJapan within Reddit/Riot/Telegram/Twitter/etc.
I’ve watched as many people have wanted to set up a Tezos node, experiment with the command-line client, use the Ledger Nano S wallet or baking software, delegate your XTZ, etc. Yet many don’t know where to start, and are intimidated by the command-line. There are some great community guides out there, but perhaps difficult to find. This will be an effort to get it out to a wider audience. I’ll go over how to set up your node, import your fundraiser wallet, and delegate your XTZ.
This guide is specific for Mac users, if you’re using a different operating system or encounter errors please skip to the bottom of this article for a link to another guide. It is often easier to use the Docker images, but this is for building from source.
First, let’s install Opam, a package manager for OCaml. If you already have opam intalled with the correct compiler, you can skip these steps. Open up your Terminal and enter the following command. Save to the default location of
/usr/local/bin if prompted:
Then, we need to initialize Opam. Allow it to update your
.profile and add a hook to opam’s init scripts if/when prompted. The init step may take a while to complete:
opam init --compiler=4.06.1
eval $(opam env)
Tezos client setup
Now, we need to get the Tezos codebase (mainnet branch). We’ll clone this using Git and then
cd into the directory:
git clone -b mainnet https://gitlab.com/tezos/tezos.git
Next, let’s install OCaml and package dependencies. If prompted about installing the
depextpackage, agree. If you receive an error that the
make command does not exist, you may need to install Xcode first for its command-line tools (http://sourabhbajaj.com/mac-setup/Xcode/).
After that, we’ll need to compile the binaries. Let’s also update the environment again to make sure we’ve running the correct opam configuration:
eval $(opam env)
You should now have the Tezos codebase compiled and ready to go. We can begin using the Tezos command-line interface. First, let’s generate our identity:
./tezos-node identity generate 26
Now we can run our node! Let’s also open up connections so that we can access the RPC interface:
nohup ./tezos-node run --rpc-addr 127.0.0.1:8732 --connections 10 &
Congratulations, your node is running! However, just note that it will take some time for your node to sync the entire blockchain. While waiting, you can intermittently check the status of the sync process by checking the timestamp displayed with this command, which will show the latest block:
If fully synced, the timestamp should be within a minute of the current time in UTC. Once your node is fully synced, you can finally begin interacting with the blockchain!
Activating and/or importing your fundraiser account
Let’s add your public key/address to your identity as
<public_key> with your public key):
./tezos-client add address my_account <public key>
If you’d like to activate your fundraiser account using your public key and activation key (if you haven’t activated already), you can enter the following command, substituting
<activation_key> with your activation key:
./tezos-client activate fundraiser account my_account with <activation key>
And lastly, to import your fundraiser account so that you can begin performing operations with it, you can enter this:
./tezos-client import fundraiser secret key my_account
This will prompt you to enter your secret words/mnemonic, your email address, and your password from the contribution period. Once imported, you can check your balance with:
./tezos-client get balance for my_account
Delegating your XTZ
After choosing a delegation service, you can save their delegate address:
./tezos-client add address awesome_delegation_service <delegate_address>
Now that we have the address of your chosen delegation service saved, let’s delegate to them. In this example, I’m also transferring 100 XTZ to the new account, which will then be delegated.:
./tezos-client originate account my_delegation for my_account transferring 100 from my_account --delegate awesome_delegation_service --fee 0.00
Voilà! Your XTZ are now being delegated and earning rewards. Make sure you do your research to choose a competent delegate!
Moving on and/or working around errors
This is just the beginning! The protocol is yours to interact with. Enjoy, keep calm, and taco on!
Other instructions for operations such as baking, delegating, etc can be found in the official docs: http://doc.tzalpha.net/introduction/alphanet.html
If you encountered any issues that prevented you from completing this process, please refer to this amazing community guide which contains instructions for multiple operating systems and workarounds for errors encountered: