Skip to content

SushiChain QuickStart

Kingsley Hendrickse edited this page Jan 27, 2019 · 8 revisions

This quickstart covers the following things:

The Testnet

Currently the testnet is down as we our AWS free tier has now expired.

The testnet can be accessed via HTTP or HTTPS on the following urls:

Building and running the code

Follow the instructions here: How to build SushiChain?

Alternatively if you have docker installed you can use our quick docker image. If you are using the Windows operating system you will have to use this docker image also.

> docker pull sushichain/sushichain
> docker run -it sushichain/sushichain /bin/bash

Be aware that this docker instance is temporary so when you exit from the shell you will loose all changes. If you want to keep changes then read the documentation in the README for SushiDocker

Creating a wallet

Lets create our first wallet on the testnet.

> cd SushiChain/bin
> ./sushi wallet create -w testnet-wallet-1.json --testnet

The -w flag is used to specify the file location of the new wallet you want to create. In this instance it's going to be created in the bin directory for convenience - but you can specify any location to generate it.

The --testnet flag is used to indicate that we want to create this wallet for use on the testnet. If we left this off - our wallet would be created for the mainnet.

We can also choose create and always use an encrypted wallet - see the encrypt/decrypt the wallet section for more details

So now we have a wallet we can do a few things with it:

Verify the wallet

> ./sushi wallet verify -w testnet-wallet-1.json

and we should see

testnet-wallet-1.json is perfect!
address: TTAzZDBlN2YwNTQ2MjI2YTVmMTA1ZjU4ZGQwMTgzNzQ4NTA3YTZhYjU4NjE0YWE1
network (T0): testnet

Check the balance

> ./sushi wallet amount -w testnet-wallet-1.json -n http://testnet.sushichain.io:3000

Here we are checking the balance against the testnet - but in the next section we will start up a private local node and use that.

When you check the balance it shows the amount after 1 confirmation. You can choose to supply more confirmations. Each confirmation means that there was 1 block added to the blockchain above the one your last transaction was in. Obviously the more blocks the more confidence you have that the block your transaction is in and the chain your are looking at as a whole is good.

> ./sushi wallet amount -w testnet-wallet-1.json -n http://testnet.sushichain.io:3000 

This is checking the actual amount of coins that have been confirmed (successfully processed on the testnet) - It defaults to showing after 1 confirmation.

> ./sushi wallet amount --confirmation=6 -w testnet-wallet-1.json -n http://testnet.sushichain.io:3000

The --confirmation= flag indicates we want to see the confirmed amount of coins after 6 confirmations (or blocks) have been added on top of the block our last transaction is in

Encrypt / Decrypt a wallet

We can also choose to encrypt an existing wallet, or decrypt and existing encrypted wallet. Also if we just want to always use an encrypted wallet we can create an encrypted wallet by adding the -e flag when creating the wallet.

All of the commands that require a wallet can also accept an encrypted wallet - you just have to either give the command the --password= flag or set the environment variable: WALLET_PASSWORD

Create an encrypted wallet

> ./sushi wallet create -w my-wallet.json -e --password=my-very-secure-password --testnet

Encrypt a wallet

> ./sushi wallet encrypt -w my-clear-text-wallet.json --password=my-very-secure-password

This creates an encrypted version of the wallet prefixed with encrypted along side the original

Decrypt a wallet

> ./sushi wallet decrypt -w my-encrypted-wallet.json --password=my-very-secure-password

This creates an unencrypted version of the wallet prefixed with unencrypted along side the original

Running a local private node on the testnet

  • ) Note that you don't have to create your node if you just want to do mining.
  • ) You can connect your mining process to a public node directly.

Now we are going to start up a local node that we can use for mining and that will connect to the testnet

> ./sushid -w testnet-wallet-1.json --testnet -n http://testnet.sushichain.io:3000 --private

The -n flag is to specify the connecting node e.g. the public testnet address. The --private flag means we start a private local node - e.g. not available to others on the internet.

When the local node starts it syncs with the connecting node (testnet) and brings down the latest blockchain.

Mining on the testnet via our local private node

Now it's time to do some mining.

> ./sushim -w testnet-wallet-1.json --testnet -n http://127.0.0.1:3000 --process=2

This is going to startup a miner that connects to our local node with 2 processes. We supply the wallet we want our rewards to go to with the -w flag. The -n flag is how we specify our connecting node - which is our locally running node.

Leave the miner running for about 10-15 minutes and then lets have a look in our wallet.

> ./sushi wallet amount -w testnet-wallet-1.json -n http://127.0.0.1:3000

If we look at the amount of coins you will see you will have something like 0.7

Depending on when you look - you might see it still says 0.0 - but after mining for a while the transactions will be processed and the blocks added to the testnet and then you will see the balance start to increase on the amounts.

> ./sushi wallet amount -w testnet-wallet-1.json -n http://127.0.0.1:3000

Mining against the testnet

If you don't want to run your own local node you can mine directly against the testnet.

> ./sushim -w testnet-wallet-1.json --testnet -n http://testnet.sushichain.io:3000 --process=2

Sending coins

Ok so now we have some coins - what can we do with them. Well we could send them to someone else!

create a second wallet:

> ./sushi wallet create -w testnet-wallet-2.json --testnet
> cat testnet-wallet-2.json

the cat command will show you the contents of the wallet including the address field. copy and paste the address field so you can use it to send coins to.

You will need to keep your local node running and ideally the miner.

> ./sushi transaction create -f 0.0001 -m 2 -a VDA3NmZkZmQ5MTQyNjgwZGQ4ZDYzYjA1MjA4NjAxYjg1OWVlMWYyMmJkNTcxMWQ2 -w testnet-wallet-1.json -n http://127.0.0.1:3000 
  • The -f flag is the fee - every transaction has a fee - sending coins has a minimum fee of 0.0001 coin.
  • The -m flag is the amount of coins to send - here we said 2 coins.
  • The -a flag is the address we want to send to (the address from our second wallet we created above)

Now when you check the first wallet's amount you will see it is 2 coins + plus a fee less than it was before. Everytime you send some coins the sender gets charged a small fee.

Have a look at the coins for wallet1:

> ./sushi wallet amount -w testnet-wallet-1.json -n http://127.0.0.1:3000

Now have a look at the coins for wallet2:

> ./sushi wallet amount -w testnet-wallet-2.json -n http://127.0.0.1:3000

You will see wallet2 now has 2 coins in it. After a while these balances will be updated on the testnet and you can check them again.

We can see the fees here:

> ./sushi transaction fees

Currently it costs 0.0001 coin per send transaction

You can’t perform that action at this time.