In this section, we'll make our first transaction on the Coda network. After installing the software, we'll need to create a new account before we can send or receive coda. Let's first start up the node so that we can start issuing commands.
Run the following command to start up a Coda node instance and connect to the network:
coda daemon \ -external-port 8302 \ -discovery-port 8303 \ -peer /dns4/seed-one.genesis-redux.o1test.net/tcp/10002/ipfs/12D3KooWP7fTKbyiUcYJGajQDpCFo2rDexgTHFJTxCH8jvcL1eAH \ -peer /dns4/seed-two.genesis-redux.o1test.net/tcp/10002/ipfs/12D3KooWL9ywbiXNfMBqnUKHSB1Q1BaHFNUzppu6JLMVn9TTPFSA
The host and port specified above refer to the seed peer address - this is the initial peer we will connect to on the network. Since Coda is a peer-to-peer protocol, there is no single centralized server we rely on.
If you forwarded custom ports (other than 8302 and 8303), you'll need to replace the default ports above with the ones you forwarded.
The daemon process needs to be running whenever you issue commands from
coda client, so make sure you don't kill it by accident.
See here for common issues when first running a node.
Now that we've started up a node and are running the Coda 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.
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 Coda 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. 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] Coda daemon is now synced.
Once our node is synced, we'll create a public/private key-pair 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 which will create a public and private key in
coda accounts create
If you are running the node on a cloud virtual machine, make sure to copy your generated private key file to your local machine. You can do this with the command
scp <source> <destination>. In the case that your machine shuts down, you will need to import the private key file using the following command and flag:
coda accounts import -privkey-path <PRIVATE-KEY-FILE>
You may also run the command
coda accounts -help to learn more about how to use the command.
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:
Keypair generated Public key: 4vsRCVbLm6LvUyzYWT95WaCzyi4D4UHxRpLBhMn7q2mRPgNCgRG3Jr3tDuhgQdmzbvCcBxhUwB3REpY2Dyf1NAxSSs8Q2vdJX93pT7eyqcyRU2S9UpDddDgovj46BSknNjzydKoopebp5Kva
Since the public key is quite long and difficult to remember, let's save it as an environment variable:
Now we can access this everywhere as
$CODA_PUBLIC_KEY -- see if it saved properly by trying
echo $CODA_PUBLIC_KEY. Let's also save the file path to our private key:
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 the faucet is currently under maintenance, please request coda 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 coda to play with. Head over to the Coda Discord server and join the
#faucet channel. Once there, ask Tiny the dog for some coda (you'll receive 100). Here's an example:
Once a faucet-mod thumbs up your request, keep an eye on the Discord channel to see when the transaction goes through on that side. It may take a few minutes for your funds to appear.
We can check our balance to make sure that we received the funds by running the following command, passing in our public key:
coda client get-balance -public-key $CODA_PUBLIC_KEY
You might see
Balance: 0 coda. Depending on the traffic in the network, it may take a few blocks before your transaction goes through.
Hint: you can look at your daemon logs for new blocks being generated. Run
coda client status to see the current block height.
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 $CODA_PUBLIC_KEY
For testing purposes, there's already an echo service set up that will immediately refund your payment minus the transaction fees.
Let's send some of our newly received coda to this service to see what a payment looks like:
coda client send-payment \ -amount 10 \ -receiver 4vsRCVNep7JaFhtySu6vZCjnArvoAhkRscTy5TQsGTsKM4tJcYVc3uNUMRxQZAwVzSvkHDGWBmvhFpmCeiPASGnByXqvKzmHt4aR5uAWAQf3kqhwDJ2ZY3Hw4Dzo6awnJkxY338GEp12LE4x \ -fee 5 \ -sender $CODA_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 the current market rate of
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.
Now that we can send transactions, it might be helpful to know our balance, so that we don't spend our testnet tokens too carelessly! Let's check our current balance by running the following command, passing in the public key of the account we generated:
coda client get-balance -public-key $CODA_PUBLIC_KEY
We'll get a response that looks like this:
Balance: 50 coda
Once you feel comfortable with the basics of creating an address, and sending & receiving coda, we can move on to the truly unique parts of the Coda network - participating in consensus and helping compress the blockchain.
*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.