Creating Counterparty transactions in Javascript

I’ve started going through transaction.py in Counterpartylib in an attempt to translate it to Javascript for a client side wallet application.


Before I get too far into this, I figured it was worth a shot to see if anyone has already done this or started any similar project.  Is anyone aware of any Counterparty Javascript libraries?
Never heard of JS library that implements Counterparty transactions.
Even Counterwallet does not decode its own transactions in their signing interface - participants of multisig transaction do not see what really they are signing.

It will be great if you can do this!
2 Likes

Looks like your library doesn’t check a transaction for Counterparty markers.

bdf2e93abaae1c2102d379edfe568376f696a9c999113c5f47ddf15f7a339030

Hashed Data: 50aa65948e8e61f8c9d991f9219a259b255b9d9e7e11e2da249c045ee0c58f56cd6ef698a06b81c14fdaeb4c0c6185d489167c80c7842347af6174f09d58
Asset ID: 11107454640732348000
Asset Amount: 12888322941.525932

But this is not a Counterparty transaction.

Was this transaction generated by the library?

I did have an issue with it generating funky transactions every once in awhile so I added a function in the XCP Wallet for Chrome repo to check if the data is correct. See Lines 154-172 of https://github.com/loon3/XCP-Wallet-for-Chrome/blob/master/Chrome%20Extension/js/xcp-js/transactions.js. The script then runs that function prior to pushing the tx to the Bitcoin network.

I will update xcp-tools-js to add this check.

Was this transaction generated by the library?

No, it’s just a random non-Counterparty transaction with a multisig output.

I think, library should check if multisig output contains correct counterparty data before decoding it (check presence of CNTRPRTY mark).

I agree.

Feel free to submit a pull request or you can open an Issue in the Github repo and I’ll get to it when I have a chance.