serum-community / pyserum

Pyserum is client library to interact with Serum DEX
MIT License
160 stars 61 forks source link

how to get private keys? #68

Closed zenpoet closed 3 years ago

zenpoet commented 3 years ago

Wanting to test pyserum but stymied on reading private keys to setup an account and access various APIs (like placing orders). How does one import private keys exported by wallets like sollet.io?

The exported keys look like an array of bytes in decimal format (with 64 entries)[ 20, 201, ..., 129 ]

Alternatively is there sample code to create accounts using the pyserum API?

Thanks.

michaelhly commented 3 years ago

When have

The exported keys look like an array of bytes in decimal format (with 64 entries)[ 20, 201, ..., 129 ]

Just use the first 32 entries like:

from solana.account import Account

kp_64 = [ 20, 201, ..., 129 ]
acc = Account(kp_64[:32])