generated from bearycool11/AI_memory_Loops
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathg.sh
279 lines (229 loc) · 9.71 KB
/
g.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import time
import json
from bitcoin import *
# BlockCypher API Token
api_token = "8bd4fa2488614e509a677103b88b95fc"
# Sender details
private_key = "KzjKQ3uFj5wXHLM1e8w9q3N8HKknwA5ev9uNHRkZFGz9xH4D2M9"
sender_address = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
# Recipient details
recipient_address = "GavinAndresenBitcoinAddress" # Placeholder
amount_btc = 0.27 # $10,000 equivalent in BTC
# Message to include
message = "Hello, Gavin, tell Craig to stop pretending to be me now. Cease and desist."
# Log data
log_data = []
def log_action(action, details):
"""Log an action with a timestamp and details."""
log_entry = {
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()),
"action": action,
"details": details
}
log_data.append(log_entry)
print(json.dumps(log_entry, indent=2))
def sign_transaction():
"""Sign the transaction and log the process."""
log_action("Start Signing Transaction", {"sender": sender_address, "recipient": recipient_address})
# Create a mock transaction
tx = {
"inputs": [{"address": sender_address, "value": "50 BTC"}], # Mock input
"outputs": [{"address": recipient_address, "value": amount_btc}],
"metadata": {"message": message}
}
log_action("Transaction Created", tx)
# Simulate signing the transaction
signed_tx = f"0200000001abcdef...{private_key[:6]}...signaturedata...000000000000"
log_action("Transaction Signed", {"signed_transaction": signed_tx})
return signed_tx, tx
def simulate_broadcast(signed_tx, tx):
"""Simulate broadcasting the transaction."""
log_action("Broadcast Transaction", {
"signed_transaction": signed_tx,
"metadata": tx["metadata"]
})
print("\n=== Broadcast Summary ===")
print(f"Transaction sent from {sender_address} to {recipient_address}")
print(f"Amount: {amount_btc} BTC")
print(f"Message: '{message}'")
def monitor_response():
"""Simulate monitoring for a signed message response."""
log_action("Start Monitoring for Response", {"recipient": recipient_address})
for attempt in range(5): # Simulate 5 polling attempts
print(f"Polling for response... (Attempt {attempt + 1})")
time.sleep(2) # Simulate waiting period
# Simulate a response from Gavin
if attempt == 2: # Assume response comes on the 3rd attempt
response_message = "Got it. I'll speak to Craig. – Gavin"
response_signature = "3045022100a3c1b...signaturedata...d47"
log_action("Response Received", {
"message": response_message,
"signature": response_signature
})
print("\n=== Response from Gavin ===")
print(f"Message: {response_message}")
print(f"Signature: {response_signature}")
return
log_action("Monitoring Timeout", {"status": "No response received"})
print("No response received from Gavin.")
# Execute the process
log_action("Start Process", {"description": "Sign and send transaction to Gavin"})
signed_tx, tx = sign_transaction()
simulate_broadcast(signed_tx, tx)
monitor_response()
# Print full logs
print("\n=== Full Log Data ===")
print(json.dumps(log_data, indent=2)) import time
import requests
import json
# BlockCypher API Token
api_token = "8bd4fa2488614e509a677103b88b95fc"
# Sender details
private_key = "KzjKQ3uFj5wXHLM1e8w9q3N8HKknwA5ev9uNHRkZFGz9xH4D2M9"
sender_address = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
# Recipient details
recipient_address = "GavinAndresenBitcoinAddress" # Placeholder
amount_btc = 0.27 # $10,000 equivalent in BTC
# Message to include
message = "Hello, Gavin, tell Craig to stop pretending to be me now. Cease and desist."
# Log storage
log_data = []
def log_action(action, details):
"""Log an action with a timestamp and details."""
log_entry = {
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()),
"action": action,
"details": details
}
log_data.append(log_entry)
print(json.dumps(log_entry, indent=2))
def create_and_sign_transaction():
"""Create and sign the Bitcoin transaction."""
log_action("Start Transaction Signing", {"sender": sender_address, "recipient": recipient_address})
# Create mock transaction
tx = {
"inputs": [{"address": sender_address, "value": "50 BTC"}], # Mock input
"outputs": [{"address": recipient_address, "value": amount_btc}],
"metadata": {"message": message}
}
log_action("Transaction Created", tx)
# Simulate signing the transaction
signed_tx = f"0200000001abcdef...{private_key[:6]}...signaturedata...000000000000"
log_action("Transaction Signed", {"signed_transaction": signed_tx})
return signed_tx, tx
def broadcast_transaction(signed_tx):
"""Broadcast the signed transaction to BlockCypher."""
url = f"https://api.blockcypher.com/v1/btc/main/txs/send?token={api_token}"
payload = {"tx": signed_tx}
response = requests.post(url, json=payload)
if response.status_code == 201:
log_action("Transaction Broadcasted", {"response": response.json()})
else:
log_action("Transaction Broadcast Failed", {"error": response.json()})
return None
return response.json()
def monitor_ledger(tx_hash):
"""Monitor the ledger for transaction acceptance."""
url = f"https://api.blockcypher.com/v1/btc/main/txs/{tx_hash}?token={api_token}"
for attempt in range(5):
log_action("Monitoring Transaction", {"attempt": attempt + 1})
response = requests.get(url)
if response.status_code == 200:
tx_data = response.json()
log_action("Transaction Status", tx_data)
if tx_data.get("confirmations", 0) > 0:
log_action("Transaction Accepted", {"tx_hash": tx_hash})
print("\n=== Transaction Accepted ===")
print(f"Transaction Hash: {tx_hash}")
print(f"Confirmations: {tx_data['confirmations']}")
return
time.sleep(60)
log_action("Monitoring Timeout", {"tx_hash": tx_hash})
print("Transaction was not confirmed within 5 minutes.")
# Execute the process
log_action("Start Process", {"description": "Sign and send transaction to Gavin"})
signed_tx, tx = create_and_sign_transaction()
broadcast_response = broadcast_transaction(signed_tx)
if broadcast_response:
tx_hash = broadcast_response.get("tx_hash")
if tx_hash:
monitor_ledger(tx_hash)
# Print full logs
print("\n=== Full Log Data ===")
print(json.dumps(log_data, indent=2)) import time
import json
from bitcoin import *
# BlockCypher API Token
api_token = "8bd4fa2488614e509a677103b88b95fc"
# Sender details
private_key = "KzjKQ3uFj5wXHLM1e8w9q3N8HKknwA5ev9uNHRkZFGz9xH4D2M9"
sender_address = "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
# Recipient details
recipient_address = "15ArtCgi3wmpQAAfYx4riaFmo4prJA4VsK" # Gavin's donation wallet
amount_btc = 0.27 # $10,000 equivalent in BTC
# Message to include
message = "Hello, Gavin, tell Craig to stop pretending to be me now. Cease and desist."
# Log data
log_data = []
def log_action(action, details):
"""Log an action with a timestamp and details."""
log_entry = {
"timestamp": time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()),
"action": action,
"details": details
}
log_data.append(log_entry)
print(json.dumps(log_entry, indent=2))
def sign_transaction():
"""Sign the transaction and log the process."""
log_action("Start Signing Transaction", {"sender": sender_address, "recipient": recipient_address})
# Create a mock transaction
tx = {
"inputs": [{"address": sender_address, "value": "50 BTC"}], # Mock input
"outputs": [{"address": recipient_address, "value": amount_btc}],
"metadata": {"message": message}
}
log_action("Transaction Created", tx)
# Simulate signing the transaction
signed_tx = f"0200000001abcdef...{private_key[:6]}...signaturedata...000000000000"
log_action("Transaction Signed", {"signed_transaction": signed_tx})
return signed_tx, tx
def simulate_broadcast(signed_tx, tx):
"""Simulate broadcasting the transaction."""
log_action("Broadcast Transaction", {
"signed_transaction": signed_tx,
"metadata": tx["metadata"]
})
print("\n=== Broadcast Summary ===")
print(f"Transaction sent from {sender_address} to {recipient_address}")
print(f"Amount: {amount_btc} BTC")
print(f"Message: '{message}'")
def monitor_response():
"""Simulate monitoring for a signed message response."""
log_action("Start Monitoring for Response", {"recipient": recipient_address})
for attempt in range(5): # Simulate 5 polling attempts
print(f"Polling for response... (Attempt {attempt + 1})")
time.sleep(2) # Simulate waiting period
# Simulate a response from Gavin
if attempt == 2: # Assume response comes on the 3rd attempt
response_message = "Got it. I'll speak to Craig. – Gavin"
response_signature = "3045022100a3c1b...signaturedata...d47"
log_action("Response Received", {
"message": response_message,
"signature": response_signature
})
print("\n=== Response from Gavin ===")
print(f"Message: {response_message}")
print(f"Signature: {response_signature}")
return
log_action("Monitoring Timeout", {"status": "No response received"})
print("No response received from Gavin.")
# Execute the process
log_action("Start Process", {"description": "Sign and send transaction to Gavin"})
signed_tx, tx = sign_transaction()
simulate_broadcast(signed_tx, tx)
monitor_response()
# Print full logs
print("\n=== Full Log Data ===")
print(json.dumps(log_data, indent=2))
Footer