In this section, we'll connect to the Mina network and send our first transaction. Let's first start up the node so that we can begin issuing commands.
We have recently undergone a rebrand, changing our name to Mina. However we haven't had an opportunity to fully audit our codebase so you will encounter instances where the name
coda appears in commands and filenames. This is a known issue and we are working to fix this issue in the next release.
The first step in connecting to the network is installing the latest daemon version. Follow the instructions for your operating system below.
First remove any previously installed version of the daemon to prevent any errors when upgrading to the latest version. Then you can install the latest version as follows:
sudo apt-get remove -y mina-testnet-postake-medium-curves echo "deb [trusted=yes] http://packages.o1test.net release main" | sudo tee /etc/apt/sources.list.d/mina.list sudo apt-get update sudo apt-get install -y curl unzip mina-testnet-postake-medium-curves=0.2.9-a940247
Check that daemon installed correctly by running
coda version. The output should read
Commit [DIRTY]a9402473584c36b347d52df4f4000b7286385987 on branch HEAD.
For Testworld, we are sending out pre-generated keypairs to every participant. Once you receive the link to claim your keypair, download it onto your computer.
mkdir ~/keys wget -O ~/keys/new-keys.zip <keypair-download-url>
Next we need to unzip the file, every download has a different filename so first check the filename that you downloaded in the previous step.
cd ~/keys unzip new-keys.zip
Finally you need to rename and set proper permissions on your keypair. Look at the filenames that were extracted in the previous command to determine the name of your
mv <testworld-keypair> my-wallet mv <testworld-keypair>.pub my-wallet.pub chmod 700 ~/keys chmod 600 ~/keys/my-wallet
To connect to the network, we need an extra file: the peer list.
A peer list contains a list of node addresses that your node can initially connect to while joining the network. Since Mina is a peer-to-peer protocol, there is no single centralized server we rely on.
wget -O ~/peers.txt https://raw.githubusercontent.com/MinaProtocol/coda-automation/bug-bounty-net/terraform/testnets/testworld/peers.txt
As we're still in the testnet phase of our protocol, there are a few rare situations where your node can run into some issues. We don't want for your nodes to break and you not realize! So we've made some officially supported auto-restart flows for you. We'll be iterating on these in future releases.
However, first we'll want to make sure everything works by running it manually before starting with the auto-restart flows.
Note: If you are using the Hetzner hosting provider, we are currently experiencing an issue where Hetzner believes our software is being malicious. See the Networking section of the troubleshooting page to learn how to mitigate this before starting a node.
Run the following command to start up a Mina node instance and connect to the live network:
CODA_PRIVKEY_PASS="password from email" coda daemon -peer-list-file ~/peers.txt -block-producer-key ~/keys/my-wallet -generate-genesis-proof true -file-log-level Debug -super-catchup
-peer-list argument specified above refer to the seed peer address - this is the initial peer we will connect to on the network. Since Mina is a peer-to-peer protocol, there is no single centralized server we rely on.
See here for common issues when first running a node.
You're not done yet! Now that you've confirmed things are okay by running the standalone process, it is important we start Mina in a manner that will auto-restart itself when it dies.
First kill the existing
coda daemon process with
Ctrl-C, and then keep reading:
Ensure your peer-list file is located in
~/peers.txt and your private-key that you've registered with is located at
Add a file
~/.mina-env containing the following:
CODA_PRIVKEY_PASS="password from email" EXTRA_FLAGS=" -file-log-level Debug -super-catchup"
You can add extra flags later to
EXTRA_FLAGS as you see fit.
Then run the following commands to start up a Mina node instance and connect to the live network:
systemctl --user daemon-reload systemctl --user start mina systemctl --user enable mina sudo loginctl enable-linger
These commands will allow the node to continue running after you logout, and restart automatically when the machine reboots.
By default, the node connects to the network using the default external-port of 8302. This can be changed using the
-external-port flag, just add that to EXTRA_FLAGS.
You can also look into the mina process itself that's running in the background and auto-restarting.
This command will let you know if
mina had any trouble getting started.
systemctl --user status mina
You can stop mina gracefully, and stop automatically-restarting the service:
systemctl --user stop mina
Manually Restart it:
systemctl --user restart mina
And look at logs:
journalctl --user -u mina -n 1000 -f
In some cases in order to view logs you need to run the following command instead:
journalctl --user-unit mina -n 1000 -f
That command will show you the last 1000 lines and follow from there.
When running your daemon using Docker, first ensure that your private key has the correct permissions.
cd ~ chmod 700 ~/keys chmod 600 ~/keys/my-wallet mkdir ~/.coda-config
Now simply run the image with your keys and ~/.coda-config mounted:
docker run --name mina -d \ -p 8302:8302 \ --restart=always \ --mount "type=bind,source=`pwd`/keys,dst=/keys,readonly" \ --mount "type=bind,source=`pwd`/.coda-config,dst=/root/.coda-config" \ --mount "type=bind,source=`pwd`/peers.txt,dst=/root/peers.txt,readonly" \ -e CODA_PRIVKEY_PASS="YOUR PASSWORD HERE" \ minaprotocol/mina-daemon-baked:0.2.9-a940247-testworld-a940247 \ daemon \ -peer-list-file /root/peers.txt \ -block-producer-key /keys/my-wallet \ -insecure-rest-server \ -file-log-level Debug \ -log-level Info \ -super-catchup
docker logs -f mina to follow the logs, and if it crashes save the log output to a file with
docker logs mina > mina-log.txt and post the output to the #mentor-nodes channel or attach the full ~/.coda-config/coda.log to a github issue and link the issue in discord.
docker exec -it mina coda client status to monitor connectivity to the network, you should quickly find at least 10 peers and watch the block height / max observed block height climb.
Now that we've started up a node and are running the Mina daemon, open up another shell and run the following command:
coda client status
It may take up to a minute before
coda client status connects to the daemon when first starting up. So if you see
Error: daemon not running. See coda daemon, just a wait a bit and try again.
If you are using the Sandbox Node, due to a quirk in the way we communicate for the coda client status command, you will need to run
coda client status inside the container itself:
docker exec -it mina bash
Most likely we will see a response that include the fields below:
... Peers: Total: 4 (...) ... Sync Status: Bootstrap
If you see
Sync Status: Bootstrap, this means that the node is bootstrapping and needs to sync with the rest of the network. You may need to be patient here as this step might take some time for the node to get all the data it needs.
After a while, your node should connect to more peers and then should move into
Sync Status: Catchup, which means we're gathering the most recent blocks and state trying to catch up the the highest block.
When sync status reaches
Synced and the node is connected to 1 or more peers, we will have successfully connected to the network. We will also see a corresponding daemon log once we've synced:
[Info] Mina daemon is now synced.
If you the
Bootstrap state persists for more than an hour, there may be an issue with your port configuration.
Once our node is synced, we'll need to import our public/private keypair so that we can sign transactions and generate an address to receive payments. For security reasons, we'll want to put the keys under a directory that is harder for attackers to access.
Run the following command to import your previously generated keypair file:
coda accounts import -privkey-path ~/keys/my-wallet
You will be prompted for the password you entered when the account was created.
The public key can be shared freely with anyone, but be very careful with your private key file. Never share this private key with anyone, as it is the equivalent of a password for your funds.
The response from this command will look like this:
😄 Imported account! Public key: B62qjaA4N9843FKM5FZk1HmeuDiojG42cbCDyZeUDQVjycULte9PFkC
Additionally you can use the
coda accounts create command to generate new accounts to send and recieve transactions.
If you are one of the selected Testnet participants that has been delegated stake, please complete the challenges using the account that you had previously created. You do not need to create a new account!
If you create a new account and use it to complete the challenges, we will not be able to track your points for your activities.
Since the public key is quite long and difficult to remember, let's save it as an environment variable. Use the following command but replace
<YOUR-PUBLIC-KEY> with the public key output from the previous command:
Now we can access this everywhere as
$MINA_PUBLIC_KEY -- check if it saved properly by trying
Note that these environment variables will only be saved for the current shell session, so if you want to save them for future use, you can add them to
If you are running the node on a cloud virtual machine, make sure to export and save the key file. You can export the key with:
coda accounts export -public-key <PUBLIC-KEY> -privkey-path <EXPORT-PATH>
Then save it to your local machine, maybe using scp:
scp <EXPORT-PATH> <LOCAL-DESTINATION>
Later, when starting up a new VM, you can upload the key and then import it:
coda accounts import -privkey-path <PRIVATE-KEY-FILE>
If you ever forget what keypairs you've already created, you can see them all with:
coda accounts list
If the faucet is currently under maintenance, please request mina in the #faucet channel, and a core team member or community member will send you some tokens shortly.
Faucet Status: Unknown
In order to send our first transaction, we'll first need to get some mina to play with. Head over to the Mina Discord server and join the
#faucet channel. Once there, ask Tiny the dog for some mina (you'll receive 10 mina). Here's an example:
It may take a few minutes for your funds to appear. We can check the balance of all our accounts using this command:
coda accounts list
You might see
Balance: 0 mina for your account. Depending on the traffic in the network, it may take a few blocks before your transaction goes through.
Finally we get to the good stuff, sending our first transaction! Before you send a payment, you'll need to unlock your account:
coda accounts unlock -public-key $MINA_PUBLIC_KEY
For testing purposes, there's already an echo service set up that will immediately refund your payment minus the transaction fees. You can use the following public key for the echo bot.
Let's send some of our newly received mina to this service to see what a payment looks like:
coda client send-payment \ -amount 0.5 \ -receiver B62qndJi5mnRoBZ8SAYDM1oR2SgAk5WpZC8hGpJUZ4e64kDHGbFMeLJ \ -fee 0.1 \ -sender $MINA_PUBLIC_KEY
If you're wondering what we passed in to the commands above:
amount, we're sending a test value of
receiveris the public key of the echo service
fee, let's use 0.1 mina
senderis the full public key, eg.
If this command is formatted properly, we should get a response that looks like the following:
Dispatched payment with ID 3XCgvAHLAqz9VVbU7an7f2L5ffJtZoFega7jZpVJrPCYA4j5HEmUAx51BCeMc232eBWVz6q9t62Kp2cNvQZoNCSGqJ1rrJpXFqMN6NQe7x987sAC2Sd6wu9Vbs9xSr8g1AkjJoB65v3suPsaCcvvCjyUvUs8c3eVRucH4doa2onGj41pjxT53y5ZkmGaPmPnpWzdJt4YJBnDRW1GcJeyqj61GKWcvvrV6KcGD25VEeHQBfhGppZc7ewVwi3vcUQR7QFFs15bMwA4oZDEfzSbnr1ECoiZGy61m5LX7afwFaviyUwjphtrzoPbQ2QAZ2w2ypnVUrcJ9oUT4y4dvDJ5vkUDazRdGxjAA6Cz86bJqqgfMHdMFqpkmLxCdLbj2Nq3Ar2VpPVvfn2kdKoxwmAGqWCiVhqYbTvHkyZSc4n3siGTEpTGAK9usPnBnqLi53Z2bPPaJ3PuZTMgmdZYrRv4UPxztRtmyBz2HdQSnH8vbxurLkyxK6yEwS23JSZWToccM83sx2hAAABNynBVuxagL8aNZF99k3LKX6E581uSVSw5DAJ2S198DvZHXD53QvjcDGpvB9jYUpofkk1aPvtW7QZkcofBYruePM7kCHjKvbDXSw2CV5brHVv5ZBV9DuUcuFHfcYAA2TVuDtFeNLBjxDumiBASgaLvcdzGiFvSqqnzmS9MBXxYybQcmmz1WuKZHjgqph99XVEapwTsYfZGi1T8ApahcWc5EX9 Receipt chain hash is now A3gpLyBJGvcpMXny2DsHjvE5GaNFn2bbpLLQqTCHuY3Nd7sqy8vDbM6qHTwHt8tcfqqBkd36LuV4CC6hVH6YsmRqRp4Lzx77WnN9gnRX7ceeXdCQUVB7B2uMo3oCYxfdpU5Q2f2KzJQ46
You may not see the
Receipt chain hash on the first transaction from the account, but in following transactions, this will show you the head of the receipt chain hash list.
Once you feel comfortable with the basics of creating an address, and sending & receiving mina, we can move on to the truly unique parts of the Mina network - participating in consensus and helping compress the blockchain.
Now that we have a fully synced node, we can learn about some of the more advanced features of the daemon in Tips for Node Operators.
*Testnet Points are designed solely to track contributions to the Testnet and Testnet Points have no cash or other monetary value. Testnet Points are not transferable and are not redeemable or exchangeable for any cryptocurrency or digital assets. We may at any time amend or eliminate Testnet Points.