{"id":26409595,"url":"https://github.com/emeks-studio/ada-valley","last_synced_at":"2025-07-21T21:31:39.449Z","repository":{"id":282800810,"uuid":"949576177","full_name":"emeks-studio/ada-valley","owner":"emeks-studio","description":"Cardano Ada Stake operator infra","archived":false,"fork":false,"pushed_at":"2025-07-18T01:34:12.000Z","size":110,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-18T06:06:18.626Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/emeks-studio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-16T18:56:46.000Z","updated_at":"2025-07-18T01:34:16.000Z","dependencies_parsed_at":"2025-03-17T02:40:29.025Z","dependency_job_id":"a94ac93a-28ce-4387-8d56-c3818f15cc99","html_url":"https://github.com/emeks-studio/ada-valley","commit_stats":null,"previous_names":["emeks-studio/ada-valley"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emeks-studio/ada-valley","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emeks-studio%2Fada-valley","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emeks-studio%2Fada-valley/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emeks-studio%2Fada-valley/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emeks-studio%2Fada-valley/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emeks-studio","download_url":"https://codeload.github.com/emeks-studio/ada-valley/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emeks-studio%2Fada-valley/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266381984,"owners_count":23920608,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-17T19:34:57.844Z","updated_at":"2025-07-21T21:31:39.433Z","avatar_url":"https://github.com/emeks-studio.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ada-valley\nCardano Ada Stake operator infra\n\n## Pre-requisites\n\n* Nix\n* QEMU\n* SOPS (sops-nix)\n* Impermanence (nix-community/impermanence)\n\n## Development\n\n0. Setup shared folder\n\n```\nsudo mkdir -p /usr/share/ada-valley\nsudo chmod -R 777 /usr/share/ada-valley\n```\n\n## 1. Setup your password\n\n```bash\n# Generate your age key!\nnix-shell -p age --run \"age-keygen -o /usr/share/ada-valley/age-password.key\"\n\u003e Public key: age1fxrjjr86wcvypgkhgq63rz0uv04c6ss0glqyxh4w88a4gdfv5sys2s6vmk\n# ^ Append your public in .sops.yaml like this:\n# - \u0026admin_$your_name age1fxrjjr86wcvypgkhgq63rz0uv04c6ss0glqyxh4w88a4gdfv5sys2s6vmk\n```\n\n1.a Encrypting the keys file\n\nIf you add a new host to your .sops.yaml file, you will need to update the keys for all secrets that are used by the new host. This can be done like so:\n\n```bash\nnix-shell -p sops --run \"export SOPS_AGE_KEY_FILE=/usr/share/ada-valley/age-password.key; sops updatekeys ./secrets/keys.enc.yaml\"\n```\n\n^ Note: In case a new admin added their public key to the .sops.yaml file, you will need to run this command to update the keys file in order to authorize the new admin to decrypt the secrets.\n\n1.b Only the first time, Open the file and add the required keys:\n```bash\n# ex. alice-password: $(mkpasswd -m sha-512 $YOUR_SECRET_PASSWORD \u003e ./secrets/alice-password.hash)\nnix-shell -p sops --run \"export SOPS_AGE_KEY_FILE=/usr/share/ada-valley/age-password.key; sops ./secrets/keys.enc.yaml\"\n```\n\n1.c  In case you need to decrypt the file:\n```bash\nnix-shell -p sops --run \"export SOPS_AGE_KEY_FILE=/usr/share/ada-valley/age-password.key; sops -d ./secrets/keys.enc.yaml\"\n```\n\n## 2. Network Setup\n\n2. A) Create your network bridge (linux)\n\nLook at your network interfaces and create a bridge for the VM\n```bash\nip -br a # Look for something like \"enpXs0\"\n```\n\n```bash\nsudo ip link add br0 type bridge\nsudo ip link set dev br0 up\nsudo ip link set $YOUR_NETWORK_INTERFACE master br0\n\nmodprobe tun tap\nsudo ip tuntap add dev tap0 mode tap\nsudo ip link set tap0 master br0\nsudo ip link set tap0 up\n```\n\n2. B) Create you network bridge on nix\n\nAt your /etc/nixos/configuration.nix\n```\n  networking.networkmanager.unmanaged = [ \"$YOUR_ETHERNET_NETWORK_INTERFACE\"];\n  systemd.network.enable = true;\n  systemd.network.netdevs = {\n    \"42-br0\" = {\n      netdevConfig.Kind = \"bridge\";\n      netdevConfig.Name = \"br0\";\n    };\n    \"43-tap0\" = {\n      netdevConfig.Kind = \"tap\";\n      netdevConfig.Name = \"tap0\";\n    };\n  };\n  systemd.network.networks = {\n    \"44-br0\" = {\n      matchConfig.Name = \"br0\";\n      networkConfig.DHCP = \"yes\";\n    };\n   \"45-tap0\" = {\n     matchConfig.Name = \"tap0\";\n     networkConfig.Bridge = \"br0\";\n    };\n   \"46-$YOUR_ETHERNET_NETWORK_INTERFACE\" = {\n     matchConfig.Name = \"$YOUR_ETHERNET_NETWORK_INTERFACE\";\n     networkConfig.Bridge = \"br0\";\n   };\n  };\n```\n^ Ref. https://nixos.wiki/wiki/Systemd-networkd\n\n```bash\n# Useful for monitoring the network\nnetworkctl\nip -br a\n```\n\n## 3. Interacting with build package\n\nThe flake provides a help command to view the options available in the package\n\n```nix\n  nix run .#help\n```\n\nThe full list of commands are:\n\n### Build\n\n - `nix build .#nixosConfigurations.nixos-vm.config.system.build.vm --override-input varsFilePath path:./vars.nix`\n\n### Execution\n\n  - `nix run .#help` help command\n  - `nix run .#show` To view how the vm will be started\n  - `nix run .#start-vm` or simply `nix run .`\n\n\n\n## 4. Cardano Node \nThe Cardano node is configured in the configuration.nix as a systemd service called **cardano-node**, it will automatically starts on system startup, it will run the cardano node with these parameters:\n - topology: the one specified in the topology.json\n - database-path: will use the path defined in the vars.nix **vm.sharedFolder** variable\n - socket-path: will use the node.socket from the cardano-db stored into the **vm.sharedFOlder** variable\n - host-addr: will use the vm's interface defined as **eth1**\n - port: default 3001 can be parametrized\n - config: config.json \n  \n\n### Check status:\n```systemctl status cardano-node```\n\n### Startup\n```systemctl start cardano-node```\n\n### View logs\n```journalctl -fu cardano-node```\n\n### Check progress\n```\n# Check sync progress\ncardano-cli query tip --testnet-magic 2 --socket-path /usr/share/ada-valley/cardano-db/node.socket \n{\n    \"block\": 11137,\n    \"epoch\": 2,\n    \"era\": \"Alonzo\",\n    \"hash\": \"924756fb4b3e974525966982b8cbbdd71c6b2bebd4c1e7e2c783647bcb7071de\",\n    \"slot\": 221974,\n    \"slotInEpoch\": 49174,\n    \"slotsToEpochEnd\": 37226,\n    \"syncProgress\": \"0.28\"\n}\n```\n\n5. A) Run inside/outside the VM\n\n```bash\n# Log-in by using alice credentials\n[alice@nixos:~]$ sudo poweroff\n```\n\n5. B) Use ssh to enter the VM\n\n```\n# Make sure you are not connected to your wifi network. You need to be connected to the ethernet network.\nssh alice@VM_IP\n```\n\n## 6. Accessing Grafana\n\nAccess Grafana in your browser at http://VM_IP:4001\n\nThe default login credentials are:\n- Username: `admin`  \n- Password: `admin` (you'll be prompted to change this on first login)\n\nGrafana comes preconfigured with a Prometheus data source that monitors:\n- The Cardano node metrics (port 12798)\n- System metrics via node_exporter (port 9100)\n\n## Update the VM\n\n1. Delete this file when you change the configuration\n\n```bash \nrm nixos.qcow2\n\n# In case you enter the VM using ssh, you will need to remove the ssh keys\nssh-keygen -R VM_IP -f /home/$YOUR_USER/.ssh/known_hosts\n```\n\n2. Run step 2 from Development section again!\n\n## How do we initialize this project the 1st time?\n\n```bash\nnixos-generate-config --dir ./\n```\n\nRef. https://nix.dev/tutorials/nixos/nixos-configuration-on-vm.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femeks-studio%2Fada-valley","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femeks-studio%2Fada-valley","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femeks-studio%2Fada-valley/lists"}