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

Point does not lie on the curve #3820

Open
EnVires opened this issue Nov 1, 2024 · 1 comment
Open

Point does not lie on the curve #3820

EnVires opened this issue Nov 1, 2024 · 1 comment

Comments

@EnVires
Copy link

EnVires commented Nov 1, 2024

Error: Point does not lie on the curve
at Point.validate (G:\Projects JS\cryptapi-main\node_modules\bitcore-lib-cash\lib\crypto\point.js:121:11)
at new PublicKey (G:\Projects JS\cryptapi-main\node_modules\bitcore-lib-ltc\lib\publickey.js:53:14)
at PublicKey.fromPrivateKey (G:\Projects JS\cryptapi-main\node_modules\bitcore-lib-ltc\lib\publickey.js:221:10)
at PrivateKey.toPublicKey (G:\Projects JS\cryptapi-main\node_modules\bitcore-lib-ltc\lib\privatekey.js:349:30)
at Transaction.getSignatures (G:\Projects JS\cryptapi-main\node_modules\bitcore-lib-ltc\lib\transaction\transaction.js:1200:47)
at Transaction.sign (G:\Projects JS\cryptapi-main\node_modules\bitcore-lib-ltc\lib\transaction\transaction.js:1189:15)
at Transactions.buildTransaction (G:\Projects JS\cryptapi-main\dist\lib\ltc\transaction.js:129:21)
at Transactions.estimateFee (G:\Projects JS\cryptapi-main\dist\lib\ltc\transaction.js:99:34)
at Transactions.transfer (G:\Projects JS\cryptapi-main\dist\lib\ltc\transaction.js:44:32)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Problem with transaction signing
If use this code

private async _checkBitcore(payload: any, currency: string) {
        const {address} = payload
        const inp = BitcoreInputs.create(this._db, currency)
        const input = await this._getInput(inp, address);
        const utxos = await getUtxos(address, currency.toUpperCase())
        const outs = await this._processUtxos(utxos, BitcoreOutput.create);
      
        switch (currency) {
            case 'btc':
                return await this._btcTransfer.transfer(input, outs);
            case 'ltc':
                return await this._ltcTransfer.transfer(input, outs);
            case 'bch':
                return await this._bchTransfer.transfer(input, outs);
        }
    }
all ok
But
if use 
import {Transactions} from "../../lib/ltc/transaction"
import {Actor} from "../../lib/actor"
import {
    p2p, Input,
    sendMessage
} from "."
import {ConfirmedWatcher} from "../../lib/ltc/watcher"

const {Pool, Inventories, Blocks} = p2p

export class LtcWatcherActor implements Actor {
    private _confirmed: ConfirmedWatcher

    private _transactions: Transactions

    get confirmed() {
        return this._confirmed
    }

    get transaction() {
        return this._transactions
    }

    /**
     * Implemented from Actor interface
     * @param index - actor index
     */
    async start(index: number) {
        try {
            const invPool = Pool.create(20)
            invPool.on('error', error => {
            })
            await invPool.fill()

            const inventories = Inventories.create(invPool)
            const blocks = Blocks.create(invPool)
            const confirmed = ConfirmedWatcher.create(blocks)

            this._confirmed = confirmed

            blocks.on('error', error => {
            })
            confirmed.on('error', error => {
            })
            inventories.on('error', error => {
            })

            inventories.on('block', hash => {
                blocks.request(hash)
            })
            confirmed.on('confirmed', payment => {
                const {input, outputs} = payment
                this._finalizeInput(input, outputs)
            })
            this._transactions = new Transactions();
            setInterval(() => {
                confirmed.checkTTL()
            }, 60000)
            setTimeout(() => {
                confirmed.restore()
            }, 1000)

        } catch (e) {
            console.log(e)
            sendMessage('logger', {
                type: 'error',
                content: {
                    type: 'LTC watcher',
                    label: 'error',
                    message: e.message ? e.message : 'no error message'
                }
            })
        }
    }

    /**
     * Messages send to actor
     * @param msg - message
     */
    message(msg: any) {
        const {confirmed} = this
        const input = Input.parse(msg)
        confirmed.add(input)
    }

    /**
     * When actor stops
     */
    stop() {
        // Nothing to stop yet
    }

    private async _finalizeInput(input: Input, utxos: any[]) {
     
        try {
            const {transaction} = this
            const message = await transaction.transfer(input, utxos)
            sendMessage('callbacks', {post: input.post, url: input.url, message})
        } catch (e) {
            console.log(e)
            sendMessage('logger', {
                type: 'error',
                content: {
                    type: 'LTC transaction_failed',
                    label: input.address,
                    message: e.message ? e.message : 'no error message'
                }
            })
        }
    }
}

export const actor = new LtcWatcherActor()

`
i have error

@EnVires
Copy link
Author

EnVires commented Nov 3, 2024

I think the problem is that bitcore-p2p uses bitcore-lib and I use bitcore-lib-ltc

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