Step 3: Start container
Start a new container based on the image. This might take a few minutes and you should see output similar to what is shown below.
$ docker run --name trysia trysia
Waiting for Sia daemon to become available...
Sia Daemon v1.5.5
Git Revision e8fdbe9
Loading...
(1/6) Loading siad...
(2/6) Loading gateway...
(3/6) Loading consensus...
(4/6) Loading transaction pool...
(5/6) Loading wallet...
(6/6) Loading renter...
API is now available, synchronous startup completed in 55.887 seconds
Finished full setup in 58s
Waiting for Sia daemon to sync...
Unlocking wallet...
Sia daemon is ready
Step 4: Check daemon
Open a new terminal where you will shell into the container. Once
you are inside the container, you can use siac
to
interact with the Sia daemon. Run siac gateway
to check
that the daemon managed to connect to some peers.
$ docker exec -it trysia bash
# siac gateway
[...]
Active peers: 8
[...]
Even though the image contains almost the complete Sia
blockchain, the daemon might need to do some initial processing
until it is fully synced. Wait until the output of
siac consensus
shows Synced: Yes
.
# siac consensus
Synced: Yes
[...]
Step 5: Wait for file contracts
Before you can upload files to the Sia network, the Sia daemon will
need to form file contracts with a number of hosts. The container is
configured to automatically start doing this, but it will take a few
minutes. You can watch the output of siac
to see how
many contracts have been formed. You might also like to open an
additional terminal and tail
the logs of the renter
module to see the progress being made. The client will form up to 50
contracts and it's best to wait until you have around 45 contracts
before continuing to the next step.
# watch siac
$ docker exec -it trysia bash
# tail -f renter/*.log
Step 6: Upload a file
With the default redundancy settings the Sia daemon will split up a file and upload the pieces to 30 different hosts. With 30+ contracts formed you are therefore ready to upload a file. On your host system, copy a test file into the container. Then inside the container, tell the Sia daemon to upload the file. The second argument to the upload command will be used as an internal name for the file by the Sia daemon. For simplicity, you can simply repeat the original file name here.
$ docker cp a-suitable-test-file.mp4 trysia:test.mp4
# siac renter upload test.mp4 test.mp4
Running siac renter uploads
will show the upload
progress. You might like to watch
the output until the
upload is complete.
# watch siac renter uploads
Uploading 1 files:
633.02 MB test.mp4 (uploading, 45.62%)
Further details regarding all uploaded files can be accessed with the command shown below.
# siac renter ls -v
Step 7: Download file
Before initiating a download, let's get a checksum with
sha1sum
for the file, so that the integrity of the
download can be confirmed. Then remove the original file inside the
container, as otherwise the download will simply be served from the local disk.
# sha1sum test.mp4
282a9254b85e0831371d6dffb91d077ebb846c20 test.mp4
# rm test.mp4
Now you are ready to get the file back from the Sia network. Request a download and let the Sia daemon save the file under a new name to keep things separate. Verify the checksum.
# siac renter download test.mp4 test-copy.mp4
# sha1sum test-copy.mp4
282a9254b85e0831371d6dffb91d077ebb846c20 test-copy.mp4
Congratulations, you completed a succesful upload to and download from the Sia network!
Step 8: Clean-up
Use the following commands to shut down the container, remove it and remove the image.
$ docker stop -t 180 trysia
$ docker rm trysia
$ docker image rm trysia
Please note that the demo container is not meant for production use. You'll find the latest release version of the software on the official Sia website.