Code Monkey home page Code Monkey logo

polarbear's People

Contributors

helldealer avatar wangkui0508 avatar zxh0 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

polarbear's Issues

Polarbear produces signature result which is different from "cetcli tx sign"

OS: Ubuntu 16.04.
Two issues:

  • Polarbear produces signature result which is different from "cetcli tx sign"
  • Polarbear produces different signature results with the same input.

The following python3 code can reproduce the issues on Ubuntu 16.04.

secret = 'xxxxxxxxx'
chain_id = 'coinexdex2'

# init wallet
import ctypes
from pathlib import Path
home = str(Path.home())
path = '{}/.cetcli/keys'.format(home)
lib = ctypes.CDLL('/home/ubuntu/exchanges-res/coinexdex/polarbear/sdkforpython/wallet_linux.so')
# lib = ctypes.CDLL('/home/ubuntu/exchanges-res/coinexdex/polarbear/wallet.so')
lib.BearInit(path.encode('utf-8'))
key_name = '0a542970-9fc7-11ea-a52f-00163e024c1c'

# get account_number and sequence
account_number = '339981'
sequence = '3' 

# sign and broadcast
sign = lib.SignAndBuildBroadcast
sign.restype = ctypes.c_char_p

unsigned_tx_bytes = '{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"bankx/MsgSend","value":{"from_address":"coinexxxxxxxxxxxxx","to_address":"coinexyyyyyy","amount":[{"denom":"cet","amount":"100000000"}],"unlock_time":"0"}}],"fee":{"amount":[{"denom":"cet","amount":"4000000"}],"gas":"200000"},"signatures":null,"memo":""}}'.encode('utf-8')
print('to_sign', unsigned_tx_bytes)
bz = sign(key_name.encode('utf-8'), secret.encode('utf-8'), unsigned_tx_bytes, chain_id.encode('utf-8'),
          'block'.encode('utf-8'), int(account_number), int(sequence))
print('signed', bz)

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.