-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import json | ||
import requests | ||
|
||
def migrate_data(): | ||
# Load old data | ||
with open('old_data.json', 'r') as f: | ||
old_data = json.load(f) | ||
|
||
# Migrate data to new contract structure | ||
new_data = {} | ||
for key, value in old_data.items(): | ||
new_data[key] = value # Transform data as needed | ||
|
||
# Send new data to the blockchain | ||
response = requests.post("http://localhost:8545/migrate", json=new_data) | ||
if response.status_code == 200: | ||
print("Data migrated successfully.") | ||
else: | ||
print("Error migrating data:", response.status_code) | ||
|
||
if __name__ == "__main__": | ||
migrate_data() |