Comments (6)
in reference to #2 i made the change that was suggested there on our server and it worked!
great for now, but any thoughts on how/why this is happening?
from tapscript.
Hello. This issue happens when you do not have the WebCrypto library or globalThis.crypto variable available. Please check the following:
- If you are using node, that you are using v19+ of node.
- If you are using a browser, that it supports globalThis (safari may have issues here)
- If you are using a browser, that it is either https or 127.0.0.1 (some browsers disable crypto if they are running in an insecure context)
Let me know if this helps!
from tapscript.
@cmdruid I am having the same issue, but only when running the node application from a hosted linux server.
on localhost (windows machine) I have no problem signing. works like a charm.
What's odd is that I am able to call the function from within server.js with var getRand = size => crypto.getRandomValues(new Uint8Array(size));
, which i use later in the code to generate the user's private keys. this works on the server. but when i go to sign, I am getting the same error as @sondotpin
any ideas? i tried removing the crypto 1.0.1 package install that I had so it defaults to the inbuilt one.
I am on node V19.0.0
from tapscript.
What's odd is that I am able to call the function from within server.js with
var getRand = size => crypto.getRandomValues(new Uint8Array(size));
, which i use later in the code to generate the user's private keys. this works on the server. but when i go to sign, I am getting the same error as @sondotpin
Yes the crypto
object may be available. The library is using globalThis.crypto
to reference the crypto object so that it can bundle properly between nodejs and the browser. The caveat is that you have to use nodejs version 19+ or a modern browser that supports the new globalThis
standard.
The alternative is a nightmarish polyfill of the crypto
object and all sorts of hackery in order to get crypto
to bundle properly between platforms and nested deep as a dependency. I tried to go that route and it simply wasn't worth it. I'm open to alternative solutions though and improving backwards compatibility of the crypto
object.
from tapscript.
What's odd is that I am able to call the function from within server.js with
var getRand = size => crypto.getRandomValues(new Uint8Array(size));
, which i use later in the code to generate the user's private keys. this works on the server. but when i go to sign, I am getting the same error as @sondotpinYes the
crypto
object may be available. The library is usingglobalThis.crypto
to reference the crypto object so that it can bundle properly between nodejs and the browser. The caveat is that you have to use nodejs version 19+ or a modern browser that supports the newglobalThis
standard.The alternative is a nightmarish polyfill of the
crypto
object and all sorts of hackery in order to getcrypto
to bundle properly between platforms and nested deep as a dependency. I tried to go that route and it simply wasn't worth it. I'm open to alternative solutions though and improving backwards compatibility of thecrypto
object.
so does 19+ not include 19.0.0? that's where i am seeing this behavior
from tapscript.
/Users/sonpin/Documents/bitcoin/new/node_modules/@cmdcode/tapscript/dist/main.cjs
I'm wondering if maybe globalThis.crypto behaves differently when used in a commonjs import versus an ES6 import.
Are you importing into a commonjs project in node?
from tapscript.
Related Issues (20)
- crypto is not defined HOT 2
- Taptree Example sounds strange HOT 5
- PSBT support HOT 10
- {"code":-26,"message":"non-mandatory-script-verify-flag (Witness program hash mismatch)"} HOT 6
- Tap script inquiry HOT 3
- Witness program hash mismatch HOT 2
- Custom Address Prefix HOT 1
- Ordinal Provenance HOT 13
- ReferenceError: crypto is not defined HOT 2
- ReferenceError: crypto is not defined HOT 1
- Public key version reserved for soft-fork upgrades HOT 3
- Add Metadata to inscription HOT 1
- Error: Size greater than stream: 38133322 > 56518 HOT 16
- A test failure HOT 3
- In the examples, where is the scriptPubKey address comming from? HOT 1
- Add multiple parent to a child inscription HOT 2
- Runes HOT 1
- OP_RETURN in output HOT 6
- sponsors? HOT 1
- Invalid Schnorr Siganture - Example: Basic Pay-to-Pubkey Spending HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tapscript.