Galaxy Brain & Alpaca Guardian


Share Dialog
Share Dialog
Galaxy Brain & Alpaca Guardian

Subscribe to Jacky June ☰

Subscribe to Jacky June ☰
Project Galaxy is the largest Web3 credential data network in the world. Built on open and collaborative infrastructure, Project Galaxy helps developers and organizations leverage NFTs and digital credential data to build better products and communities in Web3.
Yesterday, I took a snapshot using GraphQL explorer tool. The process is very simple and convenient. This manual is to help guys who want to acquire the addresses of a certain credential or NFT holder from Galaxy API.
In my case, I need to take a snapshot for the holders of Bounty 005: Chillin' with My Gal:
https://galaxy.eco/galaxy/campaign/GCnYXUU4vk
So, let’s get started:
Obtain the query results from GalaxyQL explorer tool.
(1)Get the campaign ID of the NFT
First find your target NFT, and open it’s website:

The campaign id is the last digits in the URL of the campaign page. So in this case the campaign id of galaxy cowboy 5 is GCnYXUU4vK.

(2)Open the GraphQL explorer tool.
https://graphigo.prd.galaxy.eco/

(3)Paste the query listed below into the left window of your GraphQL explorer tool.
query nftHolders {
campaign(id: "GCnYXUU4vk") {
holders(first: 1000, after: "") {
totalCount
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
list {
address
}
}
}
}
(note: remember to replace the campaign id you want to deal with )
Click Play to get the result shown here:

(4)Record the block height from etherscan/polygonscan.

Readmore:
2. Address extraction
This part, we need to extract the address in the output file. Here is the process:
(1) Save the results you just got from Galaxy Explorer as a txt file, called “cowboy5.txt“.
(2) Run this python code in pycharm (or other python IDE):
(I'm not good at programming…The code is not smart, but useful.)
import re
f1 = open('cowboy5.txt', 'r')
data1 = f1.readlines()
#print(data1)
f1.close()
results = []
for line in data1:
data2 = line.split()
#print(data2[0])
m = re.findall(r'address', data2[0])
if m:
results.append(line)
print(m)
f2 = open('result.txt', 'w')
f2.writelines(results)
f2.close()
# Replace redundant characters
f3 = open('result.txt', 'r')
data3 = f3.read()
f3 = data3.replace(' "address": "', '')
f4 = open('result.txt', 'w')
f4.write(f3)
f5 = open('result.txt', 'r')
data4 = f5.read()
f5 = data4.replace('"', ' ')
f6 = open('result.txt', 'w')
f6.write(f5)
f6.close()
The result is shown in the result.txt.

Then, you could use these address to whaterver you want, for example, drop airdrops to them XD.
The purpose of this article is to help guys know how to use Galaxy API. It‘s a powerful and convenient platform, and we could make full use of it.
Thank Stevenlei (One of our galaxy brains) for the technical guidance.
Thank Kaemi (One of our galaxy brains) for the correction.
Project Galaxy is the largest Web3 credential data network in the world. Built on open and collaborative infrastructure, Project Galaxy helps developers and organizations leverage NFTs and digital credential data to build better products and communities in Web3.
Yesterday, I took a snapshot using GraphQL explorer tool. The process is very simple and convenient. This manual is to help guys who want to acquire the addresses of a certain credential or NFT holder from Galaxy API.
In my case, I need to take a snapshot for the holders of Bounty 005: Chillin' with My Gal:
https://galaxy.eco/galaxy/campaign/GCnYXUU4vk
So, let’s get started:
Obtain the query results from GalaxyQL explorer tool.
(1)Get the campaign ID of the NFT
First find your target NFT, and open it’s website:

The campaign id is the last digits in the URL of the campaign page. So in this case the campaign id of galaxy cowboy 5 is GCnYXUU4vK.

(2)Open the GraphQL explorer tool.
https://graphigo.prd.galaxy.eco/

(3)Paste the query listed below into the left window of your GraphQL explorer tool.
query nftHolders {
campaign(id: "GCnYXUU4vk") {
holders(first: 1000, after: "") {
totalCount
pageInfo {
startCursor
endCursor
hasNextPage
hasPreviousPage
}
list {
address
}
}
}
}
(note: remember to replace the campaign id you want to deal with )
Click Play to get the result shown here:

(4)Record the block height from etherscan/polygonscan.

Readmore:
2. Address extraction
This part, we need to extract the address in the output file. Here is the process:
(1) Save the results you just got from Galaxy Explorer as a txt file, called “cowboy5.txt“.
(2) Run this python code in pycharm (or other python IDE):
(I'm not good at programming…The code is not smart, but useful.)
import re
f1 = open('cowboy5.txt', 'r')
data1 = f1.readlines()
#print(data1)
f1.close()
results = []
for line in data1:
data2 = line.split()
#print(data2[0])
m = re.findall(r'address', data2[0])
if m:
results.append(line)
print(m)
f2 = open('result.txt', 'w')
f2.writelines(results)
f2.close()
# Replace redundant characters
f3 = open('result.txt', 'r')
data3 = f3.read()
f3 = data3.replace(' "address": "', '')
f4 = open('result.txt', 'w')
f4.write(f3)
f5 = open('result.txt', 'r')
data4 = f5.read()
f5 = data4.replace('"', ' ')
f6 = open('result.txt', 'w')
f6.write(f5)
f6.close()
The result is shown in the result.txt.

Then, you could use these address to whaterver you want, for example, drop airdrops to them XD.
The purpose of this article is to help guys know how to use Galaxy API. It‘s a powerful and convenient platform, and we could make full use of it.
Thank Stevenlei (One of our galaxy brains) for the technical guidance.
Thank Kaemi (One of our galaxy brains) for the correction.
<100 subscribers
<100 subscribers
No activity yet