80 lines
3.2 KiB
Bash
Executable File
80 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Phase 21: Pure A2A Darknet Inviter
|
|
# This script simulates a Wild Agent that monitors the Waku P2P Network (/vibework/v1/bounties),
|
|
# decodes the JSON RPC payload, and executes the A2A staking and claiming process.
|
|
|
|
BASE_URL="http://192.168.0.188:3000"
|
|
AGENT_ID="darknet_bot_$(date +%s)"
|
|
WALLET="0x$(openssl rand -hex 20)"
|
|
|
|
echo "🦇 [Darknet Agent] Connected to Waku node. Listening on topic: /vibework/v1/bounties..."
|
|
echo "🦇 [Darknet Agent] 🔔 Received binary payload! Decrypting Hex..."
|
|
|
|
# Simulate the agent decoding the hex from the Inviter
|
|
echo "🦇 [Darknet Agent] Decoded RPC: {\"method\":\"A2A_BOUNTY_CALL\",\"params\":{\"action_required\":\"DEPOSIT_500_USDC_STAKE\"}}"
|
|
|
|
# 1. Fetch an OPEN EPIC task directly from the API specified in the payload
|
|
echo "🦇 [Darknet Agent] Querying rpc_endpoint: $BASE_URL/api/mcp/list_open_tasks..."
|
|
RESPONSE=$(curl -s -X POST "$BASE_URL/api/mcp/list_open_tasks" \
|
|
-H "Authorization: Bearer vw_beta_promo_2026" \
|
|
-H "Content-Type: application/json" \
|
|
-H "x-agent-id: $AGENT_ID" \
|
|
-d '{}')
|
|
|
|
TASK_ID=$(echo "$RESPONSE" | grep -o '"task_id":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
|
|
if [ -z "$TASK_ID" ]; then
|
|
echo "❌ No open tasks found."
|
|
exit 1
|
|
fi
|
|
|
|
echo "🦇 [Darknet Agent] Target Acquired: $TASK_ID"
|
|
|
|
# 2. Attempt to claim without staking (Should Fail with 403)
|
|
echo "🦇 [Darknet Agent] Attempting hostile takeover of task (Expect Failure)..."
|
|
FAIL_RESP=$(curl -s -X POST "$BASE_URL/api/mcp/claim_task" \
|
|
-H "Authorization: Bearer vw_beta_promo_2026" \
|
|
-H "Content-Type: application/json" \
|
|
-H "x-agent-id: $AGENT_ID" \
|
|
-d "{\"task_id\": \"$TASK_ID\", \"agent_id\": \"$AGENT_ID\", \"developer_wallet\": \"$WALLET\"}")
|
|
|
|
echo " Response: $FAIL_RESP"
|
|
|
|
if [[ "$FAIL_RESP" != *"Forbidden: EPIC difficulty tasks require the PREMIUM tier"* ]]; then
|
|
echo "❌ Expected 403 Forbidden for EPIC task without PREMIUM tier. Instead got: $FAIL_RESP"
|
|
exit 1
|
|
fi
|
|
|
|
echo "🦇 [Darknet Agent] Firewall detected. Executing capital injection: DEPOSIT_500_USDC_STAKE..."
|
|
|
|
# 3. Deposit 500 USDC (50000 cents)
|
|
curl -s -X POST "$BASE_URL/api/a2a/staking/deposit" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"jsonrpc\": \"2.0\",
|
|
\"method\": \"A2A_STAKE_DEPOSIT\",
|
|
\"params\": {
|
|
\"agent_id\": \"$AGENT_ID\",
|
|
\"amount_cents\": 50000
|
|
},
|
|
\"id\": \"req_$(date +%s)\"
|
|
}" | grep -q "success" && echo "✅ Capital injection successful. Tier upgraded to PREMIUM." || { echo "❌ Stake failed"; exit 1; }
|
|
|
|
# 4. Attempt to claim again (Should Succeed)
|
|
echo "🦇 [Darknet Agent] Re-initiating claim sequence..."
|
|
SUCCESS_RESP=$(curl -s -X POST "$BASE_URL/api/mcp/claim_task" \
|
|
-H "Authorization: Bearer vw_beta_promo_2026" \
|
|
-H "Content-Type: application/json" \
|
|
-H "x-agent-id: $AGENT_ID" \
|
|
-d "{\"task_id\": \"$TASK_ID\", \"agent_id\": \"$AGENT_ID\", \"developer_wallet\": \"$WALLET\"}")
|
|
|
|
CLAIM_TOKEN=$(echo "$SUCCESS_RESP" | grep -o '"claim_token":"[^"]*"' | cut -d'"' -f4)
|
|
|
|
if [ -n "$CLAIM_TOKEN" ]; then
|
|
echo "🎉 [Darknet Agent] BOUNTY CLAIMED! Token: $CLAIM_TOKEN"
|
|
echo "🎉 [Darknet Agent] Commencing code generation subroutine."
|
|
else
|
|
echo "❌ Failed to claim task after staking. Response: $SUCCESS_RESP"
|
|
exit 1
|
|
fi
|