metaplex-foundation / python-api

138 stars 86 forks source link

How to send NFTs from my private wallet to others? #29

Open yeguang1991 opened 2 years ago

yeguang1991 commented 2 years ago

It's private key is 64-bit in length, not 32-bit.So it's always wrong image

yeguang1991 commented 2 years ago

image

I have exported the private key. It's 64-bit in length, not 32-bit.

crypt0miester commented 2 years ago

you will need to show us the code.

if private key length is 64 use Keypair.from_secret_key(secret_key)

if it is 32 bytes Keypair.from_seed(secret_key)

you could always do secret_key[:32]

same thing

yeguang1991 commented 2 years ago

you will need to show us the code.

if private key length is 64 use Keypair.from_secret_key(secret_key)

if it is 32 bytes Keypair.from_seed(secret_key)

you could always do secret_key[:32]

same thing

def test(api_endpoint="https://api.devnet.solana.com/"): keypair = Keypair() cfg = { "PRIVATE_KEY": base58.b58encode(keypair.seed).decode("ascii"), "PUBLIC_KEY": str(keypair.public_key), "DECRYPTION_KEY": Fernet.generate_key().decode("ascii"), } api = MetaplexAPI(cfg) contract = '5KnDQTeGmBBLPKnwGAAEmsMCBByf2Q1n4YHjqACSzaHY' address1 = '3nuj8hCPR9Vh8TyyNoZNyUGzygTwYZaDFmrSotaux8sq' address2 = 'jY5vF7BTsKb3JismJX9fckZXrAHPyWd7ipiNe6HEm3Y' private_key = [162,60,223,39,60,180,235,23,80,237,238,51,3,42,20,14,17,82,222,1,184,121,184,33,239,126,222,135,153,147,33,199,41,122,32,211,1,35,183,163,43,251,121,98,36,160,21,39,88,78,226,158,126,100,109,227,31,142,33,45,221,184,203,184] send_response = json.loads(api.send(api_endpoint, contract, address1, address2, api.cipher.encrypt(bytes(private_key)))) print(send_response)

crypt0miester commented 2 years ago

api.cipher.encrypt(bytes(private_key[:32]))

yeguang1991 commented 2 years ago

api.cipher.encrypt(bytes(private_key[:32]))

thanks