Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laksa::Crypto::Schnorr.sign signature size issue #6

Open
yivo opened this issue Nov 20, 2019 · 0 comments
Open

Laksa::Crypto::Schnorr.sign signature size issue #6

yivo opened this issue Nov 20, 2019 · 0 comments

Comments

@yivo
Copy link

yivo commented Nov 20, 2019

Sometimes Laksa::Crypto::Schnorr.sign returns 126 bytes signature.

When trying to submit TX ZIL node returns: {"error":{"code":-8,"data":null,"message":"Invalid Signature size"},"id":1,"jsonrpc":"2.0"}

I noticed this issue on production account so I can't provide private key for testing but I will keep monitoring this in testing environment and if I catch this I will provide you a private key.

Here is how I use this gem:

      tx_parameters = Laksa::Account::TxParams.new.tap do |x|
        x.version        = 65537
        x.nonce          = nonce_of(issuer.fetch(:address)) + 1
        x.amount         = convert_to_base_unit(amount)
        x.gas_price      = 1000000000
        x.gas_limit      = 1
        x.sender_pub_key = issuer.fetch(:public_key)
        x.to_addr        = Laksa::Util::Bech32.from_bech32(recipient.fetch(:address))
      end

      tx = Laksa::Account::Transaction.new(tx_parameters, nil).tap do |t|
        t.signature = Laksa::Crypto::Schnorr.sign(Laksa::Util.encode_hex(t.bytes), issuer.fetch(:private_key), issuer.fetch(:public_key))
      end

      payload = tx.to_payload.tap do |p|
        p.merge! \
          amount:    p[:amount].to_s,
          gasPrice:  p[:gasPrice].to_s,
          gasLimit:  p[:gasLimit].to_s,
          signature: p[:signature].to_s
      end

Then I submit payload to ZIL by using CreateTransaction JSON-RPC call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant