Getting Started as an Archaeologist

This page describes how to set up an archaeologist node on Sarcophagus. At a high-level, you will need to perform the following actions:

  • Obtain the Required Tokens - You will need Arweave, SARCO, and ETH tokens to run the service.

  • Create a Node on the Ethereum Blockchain - Your service will need to be associated with a node on the Ethereum blockchain in order to submit transactions.

  • Generate a Mnemonic - You must generate a 15-word, Ethereum-compatible mnemonic that the service will use to encrypt the outer layer of each sarcophagi that you embalm.

  • Set Up Your Server - Your server will run the archaeologist service. Deploy a cloud-based server and install and configure all of the requirements.

  • Edit the Config File - Create a config file and add the details that are unique to your instance of the archaeologist service.

  • Build, Run, and Test the Service - Once all of the requirements are in place, make sure the archaeologist service runs as expected.

  • Set Up a systemd Service - Create a service file so that the archaeologist service can run continuously in the background on your server.

  • Perform the Duties of an Archaeologist - Periodically ensure that you are meeting all of the requirements of running an archaeologist service.

Each of these actions in described in detail in the sections below. For additional details refer to the Archaeologist Service Github repo and the How to Build and Run An Archaeologist Server Node On Sarcophagus - Tutorial video on YouTube. The Sarcophagus group on Telegram is a good place to ask questions.

Obtain the Tokens Required to Run the Archaeologist Service

Running the Archaeologist service requires ETH, SARCO, and ARWEAVE tokens:

  • ETH - Obtain ETH by buying it from an exchange, or obtain testnet ETH from a faucet. ETH is used to pay gas fees associated with embalming and resurrecting sarcophagi. Once you have purchased some ETH from an exchange, move the tokens to a wallet that you control using an app like MetaMask. You will need to know the following information about your ETH:

    • Token address - This is the location of the smart contract on the blockchain. It is different depending on whether you are using the mainnet or testnet. See the archaeologist config file for values.

    • Wallet address - This is the private key associated with your ETH. This value should be available in your wallet application. In MetaMask, click on the name of the wallet to copy the wallet address to your clipboard.

  • SARCO - Obtain SARCO by swapping ETH using one of the following apps: Uniswap, Zerion, 1inch Network, or Zapper.fi. SARCO is used to fund actions and incentivize services on the Sarcophagus application. You will need to connect your wallet that contains ETH to the app and follow the instructions to swap.

  • Arweave Tokens - Obtain Arweave tokens by swapping ETH or another token on Binance or from the ARWEAVE faucet. To use Arweave tokens, you will need to create an Arweave wallet using the Arweave browser add-on. ARWEAVE is used to cover fees associated with using the Arweave network to store and retrieve the files that make up sarcophagi. Once you have an Arweave wallet that contains Arweave tokens, you will need to store the Arweave wallet file on your server to run the archaeologist service and add the path to the Arweave wallet file in the archaeologist config file.

Create a Node on the Ethereum Blockchain

The server that you use to run the archaeologist service requires a node to send transactions to the Ethereum blockchain. The steps below describe how to use Infura to create a node:

  1. Create an account on Infura.

  2. Select Ethereum from the menu on the left side of the page.

  3. Click the Create A Project button.

  4. Enter a name for your project and click the CREATE button. The PROJECT DETAILS page will open.

  5. In the KEYS section of the PROJECT DETAILS page, select the network that you will use from the ENDPOINTS drop down menu. Choose Mainnet if you are ready to deploy your project on the main Ethereum blockchain, or choose Rinkeby if you are still testing your application.

  6. Make a note of the wss:// URL that is displayed in the endpoints section. You will need to add this value to the archaeologist config file.

Generate a Mnemonic

The mnemonic is a string of random words that Sarcophagus will use to generate public/private key pairs for the outer layer of encryption when embalming sarcophagi. Use the mnemonic generator created by Ian Coleman to generate a new, unique mnemonic.

NOTE: When using the mnemonic generator, select ETH-Ethereum from the Coin dropdown menu to ensure the mnemonic can be used on the Ethereum blockchain.

Save the details of the mnemonic so that you can add it to the archaeologist config file.

Set Up Your Server

The sections below describe how to deploy a cloud-based server with the following configuration:

  • Linux OS - The example below uses a recent version of Ubuntu.

  • SSH Access - Enable SSH access and generate and install SSL keys on the machine.

  • Domain - Obtain a domain, configure the DNS, and create an A record to point the domain at the IP address of your machine.

  • Firewall - Expose port 443 on you machine and ensure that your SSL certificate is properly configured.

  • Golang - Install Golang on the machine so that you can build the archaeologist service.

  • NGINX - Install NGINX and use it to create a reverse proxy file that maps the SSL port to the file port that will be used to transfer sarcophagi.

Deploy Your Server

The example below describes how to use DigitalOcean to deploy a cloud-based server that meets the requirements of the archaeologist service. If you choose to use a different provider or approach for deploying your server, the steps below should serve as a guide to ensure that your server will run the service:

  1. Log in to DigitalOcean.

  2. On the dashboard, select "Deploy a virtual machine".

    The virtual machine (VM) will be your server. The steps below will cover configuring it to meet the requirements of running an archaeologist service.

  3. Select options based on how you want to configure your server. This example uses the following settings:

    • Ubuntu 20.04

    • Shared CPU (Basic)

    • Regular Intel CPU with SSD - 1GB RAM, 25 GB SSD, 1000 GB transfer limit.

    The archeologist service does not require a particularly powerful machine. Depending on your requirements, you may want to use a machine with a dedicated CPU or additional RAM and storage.

  4. Select SSH for Authentication. If prompted, select New SSH Key. Follow the instructions to generate a new public/private key pair and load the public key in your VM. Make a note of where your key files are stored. You will need to use the private key file to connect to your server.

    You will need SSH access to set up SSL, so it is best to set it up when you deploy the VM.

  5. Click the Create Droplet button. DigitalOcean will create the droplet and you will be taken to the dashboard.

At this point you should be able to connect to your server by running the following command in your terminal application. Change droplet-IP to the IP address of your VM, which is available on the droplet dashboard in DigitalOcean:

ssh -i path_to_private_key_file root@droplet-IP

Once you are able to connect, proceed with the steps in the Set Up Your Server section below.

Set Up Your Server

The steps below describe how to configure your server and install the required software:

  1. Obtain a domain and point it to your server's IP address.

    Use a registrar like Namecheap to register a domain. Then, in your registrar's dashboard, create an A record that points to your server's IP address.

    Alternatively, you can use your registrar's dashboard to update the nameservers associated with your domain so that you can use your cloud provider to manage your domain's DNS records. In the DigitalOcean dashboard, select Networking from the left hand navigation, then select Domains in the tab menu. Follow the instructions in the Add a Domain section of the screen.

  2. Use SSH to connect to your server.

    Open a terminal application and enter the command shown below. Replace mydomain.com with the domain you added in the previous step. Set the value for the path_to_private_key_file to the path on your local machine where you stored the SSL key files when you set up SSH on your server during deployment:

     ssh -i path_to_private_key_file root@mydomain.com

    This command logs you in to your server as the root user; therefore, you can run all of the commands in the next step without using the sudo keyword. If you created and logged in a different user on the machine add sudo to the beginning of all of the commands.

  3. Create a firewall and expose port 443 and port 80. In the DigitalOcean dashboard, select Networking, then select Firewalls from the options. Click the Create Firewall button, add a name, and create HTTP and HTTPS rules. In Ubuntu, you can use the command below:

    ufw allow 443
    ufw allow 80
  4. Update the packages on the machine if needed by running the following commands:

    apt-get update
    apt upgrade

    If prompted, type 'y' and press Enter to continue.

  5. Install Go. On Ubuntu, run the following command:

    apt-get install golang

    When prompted, type 'y' and press Enter to continue.

    For other operating systems or configurations, see the GO Download and Install instructions.

  6. Create an NGINX reverse proxy to map port 443 to the port defined as the "file_port" in the Archaeologist config file. The default port is "8080". Follow the steps below to create the reverse proxy:

    1. Install NGINX. On Ubuntu, use the command below:

      apt-get install nginx

      When prompted, type 'y' and press Enter to continue.

    2. Install certbot according to the instructions for your system. On Ubuntu, use the following commands to install the snapd package manager and Certbot for NGINX:

      1. snap is preinstalled on recent versions of Ubuntu. If snapd is not already installed on your machine, install snapd:

        apt install snapd
      2. If prompted, reboot the machine.

        reboot
      3. Ensure that your version of snapd is up to date:

        snap install core; snap refresh core
      4. Remove any previous installations of Certbot that may have been added using a different package manager:

        apt-get remove certbot
      5. Install Certbot:

        snap install --classic certbot
      6. Add a link for the Certbot installation to ensure the certbot command works as expected:

        ln -s /snap/bin/certbot /usr/bin/certbot
    3. Use Certbot to install an SSL certificate on your system. The following command generates and installs a certificate that will be automatically renewed before it expires:

      certbot --nginx

      Follow the prompts displayed by the installer. You will need to enter an email address, accept terms and conditions, and enter your domain name.

    4. Test automatic renewal of your certificate:

      certbot renew --dry-run

      If the command completes without errors, your certificate will be renewed automatically.

    5. Test the certificate in your web browser by navigating to your domain using https:// in the address bar. You should see a default NGINX landing page.

    6. Update your NGINX configuration file to allow large incoming files.

      1. Locate the nginx.conf file and open it using the Nano text editor. Depending on your configuration it may be in /etc/nginx/nginx.conf.

      2. Add the following configuration to the file: client_max_body_size 20M;.

      3. Type ctrl + x to exit Nano. Type y to save the file and press Enter.

    7. Create the reverse proxy file by following the steps below:

      1. Create and open the file using the Nano text editior:

        nano /etc/nginx/sites-available/reverse-proxy.conf
      2. Copy and paste the file contents below into Nano:

        server {
                # SSL Setup
                listen 443 ssl;
                server_name arch1.myarch.com;
                ssl_certificate /etc/letsencrypt/live/myarch.com/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/myarch.com/privkey.pem;
                ssl_stapling on;
                ssl_stapling_verify on;
        
                # End SSL Setup
        
                access_log /var/log/nginx/reverse-access.log;
                error_log /var/log/nginx/reverse-error.log;
        
                location / {
                    proxy_pass http://127.0.0.1:8080;
                }
        }
      3. Edit the contents of the file as described below:

        1. Set the server_name value to your domain.

        2. Change myarch.com to your domain name in the ssl_certificate and ssl_certificate_key values.

        3. Ensure that the port number in the proxy_pass value matches the value defined for file_port in your archaeologist service config file.

      4. Type ctrl + x to exit Nano. Type y to save the file and press Enter.

      5. Create a sym link to sites-enabled:

        ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf
      6. Restart NGINX:

        sudo service nginx restart
  7. Copy the Arweave wallet file to your server. Run the following command on the machine where the key file is stored to copy the file to your server:

    scp path/to/keyfile_name.txt root@mydomain.com:~

    The path/to/keyfile_name.txt should be the path to the keyfile on your local machine. Replace root@mydomain.com with your user name and domain for your server. The :~ defines the location that the file will be stored on your server. The ~ specifies the root directory, but you can store the file anywhere. You will enter the path to the keyfile in the archaeologist config file.

  8. Clone the Archaeologist repo using the following command:

    git clone https://github.com/sarcophagus-org/archaeologist-service
  9. Open the archaeologist-service directory:

    cd archaeologist-service
  10. Initialize the config file by copying and renaming the example config file:

    cp config.example.yml config.yml
  11. Open the config file using Nano and edit the values according to the Edit the Config File section below.

Edit the Config File

Now that you have set up your server, you need to edit the archaeologist config file on your server to include your unique values. Follow the steps below to edit the config file:

  1. If you have not already done so, open the config.yml file using Nano:

    nano config.yml
  2. Edit the values in the config file as described below:

    • eth_node - The address of your node on the Ethereum network that you obtained from Infura. Use the mainnet or testnet address depending on the status of your service.

    • eth_private_key - The private key for the wallet that stores your ETH and SARCO tokens. By default, bounties will be paid to this address.

    • payment_address - The private key for a wallet that you would like to use to receive payments. This value is optional. If you do not provide a value, the address set by eth_private_key will be used.

    • mnemonic - A string of random words that will be used to generate a public/private key pair. Set this value to the mnemonic that you generated previously. The keys generated using this value will be used to encrypt the outer layer of each sarcophagi.

    • arweave_key_file - The absolute path on your server to your Arweave key file.

    • arweave_node - The node on Arweave that you will use to post sarcophagi. The default value is Arweave's public node, and you typically do not need to change it.

    • arweave_multiplier - This value increases the Arweave Winston fee that you pay when submitting a sarcophagus for storage on the Arweave network. Setting this value to something between 1.5 and 2.0 ensures that the transaction will go through. Setting this value too high burns any excess Arweave tokens.

    • contract_address - The address of the main Sarcophagus contract. The contract registers you as an archaeologist, maintains a list of active archeologists, and tracks the status of all of the sarcophagi including when they need to be rewrapped or resurrected. The default value is the Rinkeby network address: "0x939BE928b0d5fBb7f3FA07217c816496FcBEBa46". When you are ready to go live, change this value to the mainnet address: "0xD227e63E7d74Ba0374E1d5B2479666b21ba7811c" .

    • token_address - The Sarcophagus token contract address. The default value is the Rinkeby network address: "0x77ec161f6c2f2ce4554695a07e071d3f0ef3aef5". Update the value to the mainnet address when your service is ready to go live: "0x7697b462a7c4ff5f8b55bdbc2f4076c2af9cf51a".

    • endpoint - The URL that embalmers will use to send sarcophagi to your service. This URL must be configured to use HTTPS and should be mapped to the port on your server that is defined by the file_port config value. If you followed the steps in the Set Up Your Server section above, the URL of your server should already meet these requirements.

    • file_port - The port on your server that you opened to receive files from Embalmers. The default value is 8080. If needed, update this value to match the value that you defined when you Set Up Your Server.

    • fee_per_byte - The amount of SARCO per byte that you will be paid to upload a sarcophagus to Arweave. Set this value based on the amount of Arweave it costs you to upload the file. The upload cost changes depending on the status of the Arweave network, so you may update this value periodically.

    • min_bounty - The minimum amount of SARCO that you will accept as bounty when resurrecting a sarcophagus. If a user sends less than this amount as bounty, the network will automatically reject the transaction. It is possible for a user to send an amount greater than this value as bounty. This value should be based on your costs associated with maintaining the service and paying associated gas fees.

    • min_digging_fee - The minimum amount of SARCO that you will accept as payment for rewrapping a sarcophagus. Rewrapping occurs if the embalmer does not want to resurrect the sarcophagus after the resurrection period established by your archeologist agreement. This value should be set based on your costs associated with rewrapping the sarcophagus, which include gas fees and server costs.

    • max_resurrection_time - The maximum amount of time in seconds that you will maintain a sarcophagus before either unwrapping or rewrapping it. This value gives you control over how often you will receive bounties or rewrapping fees. This value should be set based on your costs and cash flow requirements.

    • add_to_free_bond - An amount of SARCO tokens that will be added to your service's free bond when you run the service for the first time. Your wallet must have enough SARCO to cover this value. SARCO in your free bond is maintained on the Sarcophagus main contract and you must maintain SARCO in your free bond to accept new jobs. When you accept a new job, some amount of SARCO in your free bond will be set aside to ensure that you perform your duties as an archaeologist. If you fail to perform your duties, you will lose the tokens associated with the sarcophagus. When you run the service for the first time, this amount of SARCO tokens is sent from your wallet to the main contract, and this value is automatically reset to zero. If you want to commit more tokens to the SARCO free bond, you must reset this value and restart the service.

    • remove_from_free_bond - An amount of SARCO tokens to withdraw from the free bond on the SARCO main contract. Use this value to reclaim tokens that you previously committed to the free bond. When you start the service this amount of SARCO tokens is sent from the main contract to your wallet address, and this value is reset to zero. To reclaim additional tokens, you must reset this value and restart the service.

    Now that you have updated the necessary values in the config file, you can build and run the service.

Build, Run, and Test the Service

Follow the steps below to build and run the archaeologist service:

  1. Open the archaeologist-service project directory:

    cd archaeologist-service
  2. Build the service using Go:

    go build

    Building the service will take some time. When it is complete, use the ls command to review the files in the archaeologist-service directory to ensure the build generated an airfoil-sarcophagus-archaeologist-service file.

  3. Run the service:

    ./airfoil-sarcophagus-archaeologist-service

    If all of the settings in your config file are valid, the service will start without any errors.

  4. Test the service by pinging your server:

    curl mydomain.com/ping

    If the action completes successfully, your system should be set up correctly. If you receive an error message, you may need to edit your server configuration.

Once everything is running properly, you can shut down the service and prepare to run it in the background by following the steps in the Set Up a systemd Service section below.

Set Up a systemd Service

Now that your server and the archaeologist service are properly configured, you can create a systemd service to run the archaeologist service continuously in the background. Follow the steps below to create and run a systemd service:

  1. Use Nano to create and edit the service file in the systemd/system directory:

    nano /etc/systemd/system/archservice.service

    Nano will create and open the file for you to edit.

  2. Copy and paste the template below into your service file:

    [Unit]
    Description=Archaeologist service
    ConditionPathExists=<full-path-to-arch-service-directory>  (e.g. /home/ubuntu/go/bin)
    After=network.target
    
    [Service]
    Type=simple
    User=<your-user>
    WorkingDirectory=<full-path-to-arch-service-directory>  (e.g. /home/ubuntu/go/bin)
    ExecStart=<full-path-to-arch-service>  (e.g. /home/ubuntu/go/bin/archaeologist-service)
    
    TimeoutSec=10
    Restart=always
    RestartSec=10
    
    PermissionsStartOnly=true
    StandardOutput=syslog
    StandardError=syslog
    SyslogIdentifier=archservice
    
    [Install]
    WantedBy=multi-user.target
  3. Edit the service file as described below:

    • <full-path-to-arch-service-directory> - Replace this value with the path to the directory where you cloned the archaeologist service repo and built the archaeologist service. If you followed the steps in the Set Up Your Server section, the path is ~/archaeologist-service.

    • <your-user> - Replace this value with your user name on the server. The Set Up Your Server instructions use the root user.

    • <full-path-to-arch-service> - Replace this value with the path to the airfoil-sarcophagus-archaeologist-service file. In the Set Up Your Server example the path is ~/archaeologist-service/airfoil-sarcophagus-archaeologist-service.

  4. Type ctrl+x to exit Nano.

  5. Type Y when prompted to save the file, then press enter to confirm the location to save the file.

  6. Reload systemd:

    systemctl daemon-reload
  7. Start the service:

    service archservice start

    The archaeologist service will start, and will continue running in the background.

When the service is running, you can perform the following actions as needed:

  • Restart the service - service archservice restart

  • View the service logs in real time - journalctl -f -u archservice

  • View the most recent logs - nano /var/log/syslog

Now that the service is running, you can deploy it to the mainnet by changing the testnet values in your config files. You will need to make sure that your wallets contain mainnet ETH and SARCO. With a working archaeologist service deployed on the mainnet, you have to perform a few tasks periodically, to ensure that you are able to accept jobs, and embalm and resurrect sarcophagi. See the Perform the Duties of an Archaeologist section for details.

Perform the Duties of an Archaeologist

In order to accept a new job, you need to have sufficient SARCO in your free bond. Follow the steps below to check the balance of your free bond and to add more SARCO to your free bond if necessary:

  • Check your available free bond - Your available free bond is displayed every time you start the service. Use the service archservice restart command to check your available free bond.

  • Add additional free bond - If your free bond is low, perform the steps below to add more:

    1. Stop the service:

      service archservice stop
    2. Edit the add_to_free_bond line in the config file:

      nano /path-archaeologist-service/config.yml

      Set the value to a reasonable amount of SARCO. Your SARCO wallet must contain sufficient funds.

    3. Start the service:

      service archservice start

      The service will start and display the updated amount of available free bond.

Last updated