Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Dockerfile.amaru
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Amaru Cardano Node Dockerfile
# Uses pre-built image from GitHub Container Registry
ARG AMARU_VERSION=latest

FROM ghcr.io/pragma-org/amaru:${AMARU_VERSION}

# Redefine build arguments for use in this stage
ARG AMARU_NETWORK
ARG AMARU_PEER_ADDRESS
ARG AMARU_PORT=3001

# Set environment variables
# The Amaru Docker image may use these environment variables for configuration
ENV AMARU_NETWORK=${AMARU_NETWORK}
ENV AMARU_PEER_ADDRESS=${AMARU_PEER_ADDRESS}
ENV AMARU_PORT=${AMARU_PORT}
ENV CARDANO_NODE_SOCKET_PATH=/ipc/node.socket

# Set working directory (should be writable)
WORKDIR /app

# Copy entrypoint wrapper script with execute permissions to a writable location
# Use --chmod to set permissions during copy (works even with non-root users)
COPY --chmod=755 scripts/amaru/entrypoint.sh /app/entrypoint.sh

# Use the wrapper script as entrypoint
# This allows us to adjust the command structure without rebuilding the base image
ENTRYPOINT ["/app/entrypoint.sh"]

25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ interact with Cardano nodes running in docker or connect via socket file.
Allowing the user to run multiple dockerised nodes,
with different versions and across networks.

**Docker node version choices:** `10.5.3`, `10.5.1`
**Node Types:** Haskell (Cardano node) and Amaru (Rust)

**Docker node version choices:** `10.5.3`, `10.5.1` (for Haskell nodes)

## Prerequisites

Expand Down Expand Up @@ -93,8 +95,8 @@ chmod +x ./start-node.sh ./stop-nodes.sh ./scripts/*
We have a start script which:

- pulls the latest testnet node configs
- pulls the Cardano node docker image
- builds and runs the Cardano node image
- pulls the node docker image (Haskell or Amaru)
- builds and runs the node image
- pushes the node logs to the terminal

In your terminal execute:
Expand All @@ -103,7 +105,12 @@ In your terminal execute:
./start-node.sh
```

Then choose which network to work on.
Then choose:
1. Which network to work on
2. Which node version (for Haskell nodes)
3. Which node type: **Haskell** or **Amaru**

**Amaru Nodes:** Amaru is a Rust-based Cardano node client that provides an alternative to the standard Haskell Cardano node. It uses the same configuration files and socket interface, making it compatible with existing `cardano-cli` tools. Amaru nodes are built from the pre-built Docker image `ghcr.io/pragma-org/amaru:latest`.

If you want to stop the logs (but the node is still running) you can press `control + c`.

Expand Down Expand Up @@ -174,7 +181,7 @@ You will have to wait till fully synced node before being able to interact with

### Stop node

This script will stop your Cardano node, remember to run this when you are done using your node.
This script will stop all running node containers (both Haskell and Amaru), remember to run this when you are done using your nodes.

In your second terminal execute:

Expand Down Expand Up @@ -243,7 +250,7 @@ Make sure you have a node running for these.

## Using Multiple Nodes and External Nodes

This toolkit supports connecting to multiple Cardano nodes simultaneously - both Docker containers and external nodes running outside of Docker.
This toolkit supports connecting to multiple nodes simultaneously - both Docker containers (Haskell and Amaru) and external nodes running outside of Docker.
You can run scripts against different networks and nodes at the same time.

### External Node Configuration
Expand All @@ -256,12 +263,16 @@ which will prompt you for the values and confirm them before use.

### Multiple Docker Containers

When multiple Docker containers are running, the toolkit will:
When multiple Docker containers are running (Haskell or Amaru), the toolkit will:

- **Automatically select** the only container if only one is running
- **Prompt you to choose** if multiple containers are running (interactive mode)
- **Use the first container** if running non-interactively (no TTY)

**Container Naming:**
- Haskell nodes: `node-{network}-{version}-container`
- Amaru nodes: `amaru-{network}-{version}-container`

### Requirements

- **Local cardano-cli**: When using external node mode, you must have `cardano-cli` installed locally and available in your PATH
Expand Down
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
network_mode: "host"
build:
context: ./
dockerfile: Dockerfile
args:
CARDANO_NODE_VERSION: ${NODE_VERSION}
CARDANO_NODE_NETWORK_ID: ${NETWORK_ID}
Expand All @@ -25,6 +26,38 @@ services:
max-size: "200k"
max-file: "10"

amaru-node-${NETWORK}-${NODE_VERSION}:
container_name: amaru-${NETWORK}-${NODE_VERSION}-container
network_mode: "host"
build:
context: ./
dockerfile: Dockerfile.amaru
args:
AMARU_VERSION: ${AMARU_VERSION:-latest}
AMARU_NETWORK: ${AMARU_NETWORK}
AMARU_PEER_ADDRESS: ${AMARU_PEER_ADDRESS}
AMARU_PORT: ${NODE_PORT}
# Try different command structures - adjust based on Amaru's actual CLI
# Option 1: Use environment variables (if Amaru supports them)
# Option 2: Pass command-line arguments
# For now, let the image use its default entrypoint and rely on environment variables
# If that doesn't work, uncomment and adjust the command below:
# command: ["--network", "${AMARU_NETWORK}", "--peer-address", "${AMARU_PEER_ADDRESS}"]
restart: always
volumes:
- ./node-${NETWORK}-${NODE_VERSION}/db:/data/db
- ./node-${NETWORK}-${NODE_VERSION}/config:/config
- ./node-${NETWORK}-${NODE_VERSION}/ipc:/ipc
- ./keys:/keys
- ./txs:/txs
- ./dumps:/dumps
- ./utilities:/utilities
logging:
driver: "json-file"
options:
max-size: "200k"
max-file: "10"

volumes:
node-db:
node-ipc:
41 changes: 41 additions & 0 deletions scripts/amaru/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/bash

# Amaru Bootstrap Script
# This script handles bootstrapping an Amaru node if needed

set -euo pipefail

# Define colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No color

# Get script directory
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
base_dir="$(cd "$script_dir/../.." && pwd)"

# Check if AMARU_NETWORK is set
if [ -z "${AMARU_NETWORK:-}" ]; then
echo -e "${RED}Error: AMARU_NETWORK environment variable is not set.${NC}"
echo -e "${YELLOW}Please set AMARU_NETWORK before running bootstrap.${NC}"
exit 1
fi

echo -e "${CYAN}Bootstrapping Amaru node for network: ${AMARU_NETWORK}${NC}"

# Note: Amaru bootstrap process may vary
# If using the Docker image, bootstrap might be handled automatically
# This script can be extended with actual bootstrap commands if needed

# Example bootstrap command (adjust based on Amaru's actual requirements):
# docker run --rm \
# -v "${base_dir}/node-${AMARU_NETWORK}-latest/db:/data/db" \
# -v "${base_dir}/node-${AMARU_NETWORK}-latest/config:/config" \
# ghcr.io/pragma-org/amaru:latest \
# amaru bootstrap --network ${AMARU_NETWORK}

echo -e "${GREEN}Bootstrap process completed (or not required for this setup).${NC}"

14 changes: 14 additions & 0 deletions scripts/amaru/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# Amaru entrypoint wrapper script
# Based on Amaru CLI documentation: amaru run --peer-address <NETWORK_ADDRESS> --network <NETWORK>

set -e

# Use environment variables set in the container
NETWORK="${AMARU_NETWORK:-preprod}"
PEER_ADDRESS="${AMARU_PEER_ADDRESS:-127.0.0.1:3001}"

# Amaru run command syntax: amaru run --peer-address <NETWORK_ADDRESS> --network <NETWORK>
# Note: --port is not a valid argument according to the CLI
exec amaru run --peer-address "$PEER_ADDRESS" --network "$NETWORK" "$@"

27 changes: 27 additions & 0 deletions scripts/amaru/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Amaru Start Helper Script
# Helper script for starting Amaru nodes with proper configuration

set -euo pipefail

# Define colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No color

# Get script directory
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
base_dir="$(cd "$script_dir/../.." && pwd)"

echo -e "${CYAN}Amaru Node Start Helper${NC}"
echo ""
echo -e "${BLUE}This script is a helper for Amaru node operations.${NC}"
echo -e "${BLUE}For starting Amaru nodes, use the main start-node.sh script:${NC}"
echo -e "${YELLOW} ./start-node.sh${NC}"
echo ""
echo -e "${BLUE}Then select 'Amaru' as the node type when prompted.${NC}"

5 changes: 3 additions & 2 deletions scripts/ga/info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -euo pipefail

# ~~~~~~~~~~~~ CHANGE THIS ~~~~~~~~~~~~

METADATA_URL="ipfs://bafkreihmmaxya6rwrnh36zfl4eaijv67oamdxbj6r3z3nfbwmn55sj4ime"
METADATA_HASH="2df56fcaaa6d6bd73e792b871b746cd9c6209e95a2f0e6344502be9f7abf5567"
METADATA_URL="ipfs://bafkreidpcmogdet4beysyxq4u7l2qywplbfnahudyevqjcu2yxiceurn3u"
METADATA_HASH="ed54ad31d48602ce7c30eba13c209c71dcb63d6eb9906345a3367acec65175ad"

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -59,6 +59,7 @@ get_utxo() {
echo "Creating and submitting info governance action."

cardano_cli conway governance action create-info \
--testnet \
--governance-action-deposit $(cardano_cli conway query gov-state | jq -r '.currentPParams.govActionDeposit') \
--deposit-return-stake-verification-key-file $keys_dir/stake.vkey \
--anchor-url $METADATA_URL \
Expand Down
4 changes: 2 additions & 2 deletions scripts/helper/get-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ if [ -n "$CARDANO_CONTAINER_NAME_OVERRIDE" ]; then
fi
fi

# Get the list of running containers
running_containers=$(docker ps --format '{{.Names}}')
# Get the list of running containers (filter for Cardano and Amaru node containers)
running_containers=$(docker ps --format '{{.Names}}' | grep -E "^(node|amaru)-[^-]+-[^-]+-container$" || true)

# Convert the running containers to an array
IFS=$'\n' read -r -d '' -a running_containers <<< "$running_containers"
Expand Down
4 changes: 2 additions & 2 deletions scripts/helper/load-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
base_dir="$(cd "$script_dir/../.." && pwd)"
docker_compose_file="$base_dir/docker-compose.yml"

# Get running containers
# Get running containers (both Cardano and Amaru)
running_containers=""
if command -v docker &> /dev/null; then
running_containers=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^node-' || true)
running_containers=$(docker ps --format '{{.Names}}' 2>/dev/null | grep -E '^(node|amaru)-' || true)
fi

# Safety check: If docker-compose.yml exists but no containers are running and no socket is set,
Expand Down
28 changes: 14 additions & 14 deletions scripts/simple/send-ada.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -euo pipefail

# ~~~~~~~~~~~~ CHANGE THIS ~~~~~~~~~~~~
LOVELACE_AMOUNT=10000000
ADDRESS="addr_test1wqft2yqkp8wj5k5k7dy9725kxkcd4ep4ycp5uczuqtt3vqcgh63dt"
LOVELACE_AMOUNT=1230000000000
ADDRESS="addr_test1qphtuq30j8tvmq0v38l9zye7sun36n6nzyygcc2mqds2sdssfd7ly7km85wtqgdempk3rfwn96px6l5k5n6ezw8ujgps20sdh8"
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Get the script's directory and project root
Expand Down Expand Up @@ -45,19 +45,19 @@ cardano_cli conway transaction build \
--change-address $(cat $keys_dir/payment.addr) \
--out-file "$tx_unsigned_path"

cardano_cli conway transaction sign \
--tx-body-file "$tx_unsigned_path" \
--signing-key-file "$keys_dir/payment.skey" \
--out-file "$tx_signed_path"
# cardano_cli conway transaction sign \
# --tx-body-file "$tx_unsigned_path" \
# --signing-key-file "$keys_dir/payment.skey" \
# --out-file "$tx_signed_path"

# Check signed transaction file was created
if [ ! -f "$tx_signed_path" ]; then
echo "Error: Failed to create signed transaction file"
exit 1
fi
# # Check signed transaction file was created
# if [ ! -f "$tx_signed_path" ]; then
# echo "Error: Failed to create signed transaction file"
# exit 1
# fi

# Submit the transaction
echo "Submitting transaction"
# # Submit the transaction
# echo "Submitting transaction"


cardano_cli conway transaction submit --tx-file $tx_signed_path
# cardano_cli conway transaction submit --tx-file $tx_signed_path
Loading
Loading