Closed DesWurstes closed 3 years ago
There hasn't been any use of, or implementation for, the 0x02 file type. With that said, what do you think if we just update that part of the spec?
Looks good!
I'm taking a risk here merging with trying it, but we can just fix the script if it's not working. As I mentioned previously, there isn't any actual use of this that I'm aware of.
Thank you!
Mine is tested - here's a transaction https://www.blockchain.com/bch/tx/a130f69528f51965eb668e0a53b36e24345822f0f93e6e69ae49d9ffeb954599
Thanks for the fix! Any interest in adding this capability to the bitcoinfiles TS library?
Yes! I'll look at it.
@jcramer I'm sorry, I looked at the code and saw that bitcore-lib-cash is used. My code also uses this library, however the library needs one whole new class, and unless Bitpay agrees that the code for this can live in the upstream bitcore-lib-cash, I won't be able to add it because that library doesn't have its own fork of bitcore-lib-cash whose signing code I need to be able to modify.
There shouldn't be any problem if you just use the patch-package npm package. https://www.npmjs.com/package/patch-package.
Apply your updates within the node_modules/bitcore-lib-cash then run npx patch-package bitcore-lib-cash
. This will create a patch saved in bitcoinfiles project dir which will be applied whenever someone runs npm i
using the post-install hook iirc.
OK then I'll add this.
I need to fix the index.js first. I can reproduce this problem by downloading this repo and compiling it with mkdir dist && npm i && npm run build
but the produced index.js is different. Can you reproduce this too?
Can you please run mkdir dist && npm i && npm run build
on a freshly cloned repo and tell me how you then import this from require
node.
Hello my upload function should be working now however I can't test because I can't build it for Node nor for the browser.
When I run npm run build
in the repo and call from the upper directory as:
const Bfp = require('./BitcoinFilesJS').bfp;
const Network = require('./BitcoinFilesJS').network;
const BITBOX = require('./BitcoinFilesJS').bitbox;
const bfp = new Bfp();
I get
const bfp = new Bfp();
^
TypeError: Bfp is not a constructor
How do I build it?
My index.js is:
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./lib/bfp"), exports);
__exportStar(require("./lib/utils"), exports);
//# sourceMappingURL=index.js.map
while yours from npm i bitcoinfiles
has this:
let bfp = require('./lib/bfp');
let utils = require('./lib/utils');
let network = require('./lib/network');
module.exports = {
bfp: bfp,
utils: utils,
network: network
}
When I run it in the browser from dist, it still says Uncaught TypeError: Bfp is not a constructor
@jcramer I can't wait to implement this protocol for the first time. I'm looking forward to instructions leading to a proper index.js
starting from git clone https://github.com/simpleledger/BitcoinFilesJS.git
when you have time.
EDIT sorry problem solved I didn't know that this migrated to TS only recently
Out of curiousity, why is push1
part of the redeem script, rather than the unlocking script together with push2
and push3
?
@dagurval Because stuff outside the redeemscript needs to be verified, which means more CAT HASH160 opcodes. However when they're inside changing OP_DROP to OP_2DROP, a zero cost substitute, is enough.
Edit: I'm going to edit this specification again, push1
should come after push2
and push3
, I will need to change the push numbers.
Resolves #32
Later, we could also make this a part of the SLP spec so that Flex and others who need to chain lots of transaction would make one large transaction instead, reducing tx fees? This would also remove the need to increase OP_RETURN size or increase the transaction chaining limit.