Code Monkey home page Code Monkey logo

cosmospy's People

Contributors

hukkin avatar hukkinj1 avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cosmospy's Issues

Python 3.10.4 | AttributeError: 'mpz' object has no attribute 'to_bytes'

Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32

from cosmospy import BIP32DerivationError, seed_to_privkey

seed = ("angry mouse")

try:

privkey = seed_to_privkey(seed,"m/44'/118'/1'/0/0")

except BIP32DerivationError:

print("No valid private key in this derivation path!")

AttributeError Traceback (most recent call last)
in
9 seed = ("angry mouse")
10 try:
---> 11 privkey = seed_to_privkey(seed,"m/44'/118'/2'/0/0")
12 except BIP32DerivationError:
13 print("No valid private key in this derivation path!")

C:\ProgramData\Anaconda3\lib\site-packages\cosmospy_wallet.py in seed_to_privkey(seed, path)
45 # This can raise a hdwallets.BIP32DerivationError (which we alias so
46 # that the same exception type is also in the cosmospy namespace).
---> 47 derived_privkey = hd_wallet.get_privkey_from_path(path)
48
49 return derived_privkey

C:\ProgramData\Anaconda3\lib\site-packages\hdwallets_bip32.py in get_privkey_from_path(self, path)
78 :return: privkey (bytes)
79 """
---> 80 return self.get_extended_privkey_from_path(path)[1]
81
82 def get_extended_pubkey_from_path(

C:\ProgramData\Anaconda3\lib\site-packages\hdwallets_bip32.py in get_extended_privkey_from_path(self, path)
68 assert isinstance(privkey, bytes)
69 for index in path:
---> 70 privkey, chaincode = _derive_private_child(privkey, chaincode, index)
71 return chaincode, privkey
72

C:\ProgramData\Anaconda3\lib\site-packages\hdwallets_utils.py in _derive_private_child(privkey, chaincode, index)
60 f"Invalid private key at index {index}, try the next one!"
61 )
---> 62 secret = k_int.to_bytes(32, "big")
63
64 return secret, payload[32:]

AttributeError: 'mpz' object has no attribute 'to_bytes'

keypair to seed words

Is it possible to generate seeds words from a keypair?
Cosmostation will not take any privkey, one must enter seed words instead.

signature verification failed

I am the receiver of this transaction and I want to spend 0.1 atom from this account. but when I run the following code I get ""signature verification failed; verify correct account sequence and chain-id" error.

curl -X POST "https://lcd.nylira.net/txs" -H "accept: application/json" -H "Content-Type: application/json" -d "{"tx":{"msg":[{"type":"cosmos-sdk/MsgSend","value":{"from_address":"cosmos15wa26mgeuxvtfpnqfle98wupdeeyxzdu7lff9a","to_address":"cosmos15wa26mgeuxvtfpnqfle98wupdeeyxzdu7lff9a","amount":[{"denom":"uatom","amount":"100000"}]}}],"fee":{"gas":"70000","amount":[{"denom":"uatom","amount":"1000"}]},"memo":"","signatures":[{"signature":"8KyuGPORRF5Eakxw5URy9BM0CjDM72pw25PuhXVBGCcZCvxZ/UIsssNR+OO9DH9JUDp89yX/RUMFvbES1MGwhA==","pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A3ouexs2TMGjefw2zBWKNnwSZJgFsMYmf5OHkfwdWTWX"},"account_number":"11335","sequence":"0"}]},"mode":"sync"}"

since I'm sure that my signature is true,the chain-id should be wrong. I can't find the right chain-id. can you help me please?

problem at broadcasting

hi. I use this link to post transaction created by this library. but when I paste the body of transaction at "POST/txs" I get the "TypeError: Failed to fetch" and when I use the curl command I get as a result the code of a HTML file. the transaction I'm trying to post is :

{"tx":{"msg":[{"type":"cosmos-sdk/MsgSend","value":{"from_address":"cosmos1j32hpgtzh4sudpl0658ylr2tdzu65reyy78x50","to_address":"cosmos1j32hpgtzh4sudpl0658ylr2tdzu65reyy78x50","amount":[{"denom":"uatom","amount":"2"}]}}],"fee":{"gas":"70000","amount":[{"denom":"uatom","amount":"1000"}]},"memo":"","signatures":[{"signature":"LY2iTu+6LeMh/s6ASSRlnxJE3aSpTp6Ung0JMIbyPLF+LDI7YH7M+HRzdtc+5kx+V/8fKmWxfAZIqoyNv0Rh3g==","pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A8mdavgH7MjKqgPdZ8Q9T1xihUbiiRzBqnOR5zCGA40p"},"account_number":"11335","sequence":"0"}]},"mode":"sync"}

run with python version 3.10, get issue.

thanks for your code, but i think some issue from my end, suppose the JSON part can't parse

My code :

privkey = seed_to_privkey(seed, path="m/44'/118'/0'/0/0")
tx = Transaction(
    privkey=privkey,
    account_num=account_number,
    sequence=1,
    fee=0,
    gas=80000,
    memo="",
    sync_mode='BROADCAST_MODE_SYNC',
    chain_id='korellia'
)
tx.add_transfer(
    recipient="kyve13nwxn4tuszwk6s93vk73xxe6xwf3ssauk5hhde", amount=10000
)
pushable_tx= tx.get_pushable()

api_base_url = "https://api.korellia.kyve.network"
headers = {'content-type': 'application/json'}
result = requests.post(api_base_url + "/cosmos/tx/v1beta1/txs", data=pushable_tx, proxies=proxies,headers=headers)
print(result.status_code, result.text)

The result :

400 {
  "code": 3,
  "message": "invalid empty tx",
  "details": [
  ]
}

the Json print:

{
  "tx": {
    "msg": [
      {
        "type": "cosmos-sdk/MsgSend",
        "value": {
          "from_address": "kyve1t5jjcj9terudp8serzcrsud86zgq8ad5zxxxx",
          "to_address": "kyve13nwxn4tuszwk6s93vk73xxe6xwf3ssaukxxxx",
          "amount": [
            {
              "denom": "uatom",
              "amount": "10000"
            }
          ]
        }
      }
    ],
    "fee": {
      "gas": "80000",
      "amount": [
        {
          "denom": "uatom",
          "amount": "0"
        }
      ]
    },
    "memo": "",
    "signatures": [
      {
        "signature": "yZ1Muoe1fQTdwD9wM56hs0mCJEO6S9sxDPEQaCxuL/ZF86zXRqlXMaip0wyKPh1isghjsichoUVoJPLN+KYHTA==",
        "pub_key": {
          "type": "tendermint/PubKeySecp256k1",
          "value": "A38+HgWr2p+qRCvMRuAMwNw6S3gdcGOoprByctGzqhrv"
        },
        "account_number": "26553",
        "sequence": "1"
      }
    ]
  },
  "mode": "BROADCAST_MODE_SYNC"
}

Seed words

Can any function be implemented to deal with seed words?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.