Questions tagged [python]
The python tag has no usage guidance.
53
questions
0
votes
0
answers
26
views
How to get a token's "pubkey" prior to owning it?
executing the following code using solana's mint address, So11111111111111111111111111111111111111112, I can't get the public key for Solana if I don't have wrapped Solana in my wallet. How can you ...
1
vote
0
answers
18
views
How to send a transaction with custom data to a smart contract in Python
I'm new to solana development, and I've been reading docs all morning and I can't seem to find a way to send a transaction to a smart contract with custom data. I tried using TransactionInstruction ...
0
votes
1
answer
69
views
Fetch newly listed created pairs on Raydium
I am facing following error:-
Error finding latest created pair: argument 'program': 'str' object cannot be converted to 'Pubkey'
when i try convert string to PublicKey.. It starts giving me import ...
0
votes
3
answers
102
views
How to create a metadata account with python?
Original Question
I would like to write a python script that can create tokens. Since the Metaplex Python API seems outdated and only targeted to NFTs, I decided to do it myself. With the help of the (...
1
vote
0
answers
134
views
Trying to get started with solana-py
I hope this is ok to ask here. I've been attempting to get my feet web in web3 dev stuff for awhile now. It's had fits and starts for months now. We had baby 3 a few months ago, but I'm back in the ...
0
votes
1
answer
111
views
How can I get block data with all transactions with one Solana API request?
How can I get the last block or slot with all transactions in it with one Solana API request? The way I found: getSlot() -> getBlock(slotNumber). The problem with this method is that it is very ...
1
vote
1
answer
51
views
Staking in python?
I'm currently trying to use this branch of Solana-py to create a script which allows me to automatically find the best validator and stake my SOL with it.
I'm having an issue when trying to pass the ...
0
votes
1
answer
126
views
Solana multiple spl tokens transfer python
I managed to send some USDC-dev token on the devnet with the following code.
Is there a way to send more than 1 transaction with something like Transaction.add()
Here is the working code for 1 ...
2
votes
1
answer
132
views
JSON RPC get all SPL token holders during specific time
I am trying to get all the holders of a specific SPL token during a specific time. I get the Error: {'code': -32010, 'message': 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA excluded from account ...
2
votes
2
answers
182
views
How do I implement Jupiter's VersionedTransactions into Python?
I've been having a bit of trouble while trying to implement Jupiter's V4 swap API into my program. Although I haven't had any issues retrieving the transaction, I haven't figured out how to execute ...
2
votes
1
answer
152
views
ValueError: signature error: Cannot decompress Edwards point
I use example in docs solana for python
from solders.keypair import Keypair
from mnemonic import Mnemonic
mnemo = Mnemonic("english")
words = mnemo.generate(strength=256)
seed = mnemo....
3
votes
2
answers
56
views
Why does a "bad format" error occur when importing a key into phantom app?
I use example in docs solana for python
I try get key pair and import to phantom by private key:
from solders.keypair import Keypair
from mnemonic import Mnemonic
mnemo = Mnemonic("english")...
0
votes
0
answers
91
views
How get seed phrase similar seed phrase from phantom?
i exported wallet data from phantom wallet:
seed phrase: warfare heavy proof ecology water grit toddler blade venue right denial rival
public key: DudBEyhvkAtgTWoaXSUgV2Zv7V1GgsfYGZvs9P8xztff
private ...
1
vote
0
answers
130
views
Convert rust struct to be used in python using pyo3 in solders
i am using trying to make python bindings for the solana rust sdk, on the solders repo https://github.com/kevinheavey/solders
there's a crate called primitive here that https://github.com/kevinheavey/...
4
votes
1
answer
132
views
Monitoring transactions for Solana in real time for an address
So I wonna monitor an address or more to print in my terminal each time there's a transaction...
I used the solana-py library method
signatures = client.get_signature_for_address(address, limit=1)....
0
votes
1
answer
142
views
"Invalid param: could not find account" when using solana.py to call solana RPC API function
I need some help with solana.py API (for python).
I am trying to get total supply of the token (token here) - so I copy mint address according to documentation (gettokensupply) and write usual code on ...
1
vote
1
answer
251
views
How to pull the total balance on an SPL token for a wallet address in solana (python)
Also posted on stack overflow
I'm looking to get the token balance for an SPL token in solana based on the:
Wallet address of the token holder
The token address
How can I do this?
I thought it would ...
0
votes
0
answers
243
views
Can't get data using Magic Eden API
I checked Magic Eden API documentation and wanted to see all the tokens from my wallet.
Example from the documentation:
import requests
url = "api-devnet.magiceden.dev/v2/wallets/...
0
votes
1
answer
59
views
getFeeForMessage: Index out of Bounds
I have a versioned message and when I query the RPC API method getFeeForMessage it returns "invalid transaction message: index out of bounds", but I do know it is a correctly encoded message....
0
votes
1
answer
61
views
Transferring custom made solana tokens (not owned by me) from one wallet to another
So I am working on a script that transfers tokens (custom-made tokens not owned by me) from one wallet to another in python. How do I go about doing that?
(By tokens I mean, tokens like Dust, Luv, etc....
0
votes
1
answer
22
views
skip_confirmation returning TXID
I'm using a Python library solana-py to send Solana transactions. My question is, if I use skip_confirmation=False in TxOpts for the opts for the transaction, if the tx fails, will the ...
1
vote
0
answers
41
views
How to restore Solana public key from seed (Exodus version)?
I'm doing some research about crypto wallets and their methods to restore crypto addresses from seeds. I'm actually interested in Solana and I figured out that Phantom wallet and Exodus wallets ...
1
vote
0
answers
124
views
How to restore Solana public key from seed (Exodus version)?
I'm doing some research about crypto wallets and their methods to restore crypto addresses from seeds. I'm actually interested in Solana and I figured out that Phantom wallet and Exodus wallets ...
0
votes
2
answers
108
views
Python code for Solana PDAs
I want to use PDAs in solana but there doesn’t seem to be any way of doing it with python. I looked to the Solana CLI library with no luck. Any ideas?
1
vote
1
answer
51
views
Solana Script in Python [closed]
I am writing a python program using solana CLI commands as strings:
TransW1_W2 = 'solana transfer --from ~/[WALLET1]/my-keypair.json [WALLET2 ADDRESS] 1 --with the rest of the command... Notice, after ...
0
votes
2
answers
53
views
accessing security.txt from python
I am trying to integrate security.txt https://github.com/neodyme-labs/solana-security-txt into a project, and while from the repo it is clear how to access it from rust, I am at a loss as to how to do ...
2
votes
1
answer
103
views
How to subscribe the address logs in solana by using python?
I want to subscribe the logs of my address in solana by using python
0
votes
0
answers
42
views
How to give parameters for sending transaction in solana using python?
I'm trying to create the transaction in solana when I give my secreet seed as input it throws an error that fromSeed() takes 32 bytes input my code is below.
def Send_Transaction(sender_seed, ...
1
vote
2
answers
593
views
How to validate an address of solana by using python?
I want to validate the address of solana either is valid or invalid by using python how could I do that?like in web3.py we validate an ethereum account/address and it returns false or true as output.
0
votes
1
answer
634
views
How to create an address of solana by using python?
I want to generate the address of solana by using python how could I do that?like in web3.py we create an ethereum account/address.
1
vote
0
answers
98
views
Signing a Ledger Transaction with python
I keep getting the Error: Invalid Status 6a80, and I have a hard time figuring out why.
I am able to collect the publicKeys, but I unfortunately can't get signatures through it.
any help will be much ...
2
votes
2
answers
193
views
python find_program_address, how to covert a pubkey to a byte array as in rust?
this is a really simple question but I can't seem to find an example to do it. In a rust client I am just doing the following:
let (user_data_account, _user_bump_seed) = Pubkey::find_program_address(&...
1
vote
1
answer
74
views
Deserializing Enum using borch_construct (Candy Machine Account Data)
While deserializing account data from: https://explorer.solana.com/address/DZWdnz5VXYxGrutAFCUHzy5JkGc3kY4aGGv8oeT3nR26/anchor-account I am running into issues with the Enum object in borsh_construct.
...
0
votes
1
answer
96
views
How to get the last 'n' transactions in solana.py?
I am currently working on a Shop based which accepts Solana as the form of currency, I want to know the details of last n transactions on my wallet. How can I do that?
1
vote
0
answers
30
views
How to use Magic Eden instruction endpoints and turn them into transactions in solana-py
I want to start interacting with Magic Eden NFTs through my solana-py code. So I want to learn how to use the endpoints at https://api.magiceden.dev/#82874536-9430-4dae-81dc-1235baaa3ef3. I have an ...
1
vote
2
answers
253
views
how to get owner of token account
I'm using solana-py and trying to get the owner of an associated token account. I have gotten the associated account address like this:
from solana.publickey import PublicKey
from solana.rpc.api ...
6
votes
1
answer
70
views
How to use program_subscribe function? python
I'm trying to use program_subscribe, but I get error:
apischema.validation.errors.ValidationError: ValidationError: [{'loc': ['result', 'value', 'account', 'data'], 'err': "not one of [''] (oneOf)...
1
vote
2
answers
547
views
Magic Eden API instructions/buy_now
I'm trying to use Magic Eden API and solana-py to buy an NFT for the listed price. I'm using the instructins/buy_now endpoint to do that. I get an error when trying to buy the NFT. Have been trying to ...
4
votes
1
answer
351
views
How to fetch data from Solana smart contract
Is there a tutorial or detailed explanation on how to fetch all the transactions from a deployed contract on Solana?
My concrete question is: I deployed a contract (https://explorer.solana.com/address/...
3
votes
2
answers
201
views
Finding instruction identifiers
When you send a raw instruction to the network, you have to specify in the instruction data an instruction identifier, so that the program knows what function to call. For example, in python:
from ...
2
votes
2
answers
327
views
Keypair-pubkey mismatch when partial signing - Python
I am trying to create and partial sign a transaction for create an account, but I keep receiving a keypair mismatch error. My code looks like this:
from spl.token.instructions import ...
2
votes
0
answers
41
views
How can I get a hash list of all minted NFTs for a CMV2 using Python?
I am trying to fetch a hash list of all minted NFTs from a given Candy Machine V2 ID. Ideally I'd like a method that returns similarly to the Magic Eden mint list tool.
My suspicion is that I could ...
4
votes
2
answers
82
views
Is there a way to edit NFT metadata in python?
I've been using solana-py in python to interact with Solana for a bit now. And I've been wondering if there's a way to update NFT metadata in python. I'd assume you can't do it on solana-py. So I was ...
4
votes
1
answer
78
views
How to use an already existing wallet on the network?
I am trying to transfer some funds using my private key in Python. Here's the code but I don't know how I can use my existing phantom wallet's secret key to make the transaction. Here's the code, can ...
1
vote
1
answer
38
views
Allowlist wallet based or discord base [closed]
How to implement the Allowlist Wallet base or discord base? i have an a issue on wallet based on CMV2 cause they gonna mint unli using the bot.
0
votes
1
answer
348
views
How to create a Keypair json in solana.py?
I'm attempting to create a keypair json I can save to my directory in solana.py that I can use on a local Solana test validator. Unsure if there's any built-in functions within solana.py to do so, I ...
2
votes
2
answers
190
views
Best way to "monitor" the Solana blockchain? [closed]
this isn't normally the kind of question I would ask on stack overflow, but please bear with me! Given this is the replacement for the dev-support discord channel I'm hoping that some people may be ...
4
votes
1
answer
62
views
Does Solana have an official Python implementation?
I wonder if Solana has an "official" Python implementation; specially for Keypairs, or everyone is just using this repo: https://github.com/michaelhly/solana-py/blob/master/src/solana/...
6
votes
1
answer
143
views
Solana JSON RPC error 32015: Transaction version (0) not supported
I am trying to use the Solana JSON RPC to request the data from blocks using get_block. I've been using this a bunch just fine but have started to get an error that I don't understand, and can't find ...
5
votes
1
answer
209
views
Deserializing Metaplex Metadata
I'm currently attempting to retrieve the collection field from the Metaplex metadata of a NFT in python. My results are half correct but the collection key deserialized is entirely different than what ...