Git Product home page Git Product logo

thresh-sig-js's Introduction

Build Status NPM

Two Party signatures JS SDK

Supports:

Algorithm Curve Compatible blockchains
ECDSA Secp256k1 Bitcoin, Ethereum
Schnorr Secp256k1 Zilliqa
EdDSA Curve25519 Tezos, Libra

Installation:

  1. If on Linux, install needed packages:
$ sudo apt-get update
$ sudo apt-get install libgmp3-dev pkg-config libssl-dev clang libclang-dev
  1. Install Node.js
    (tested on Node 10)
  2. Install nightly Rust
    (tested on rustc 1.38.0-nightly (0b680cfce 2019-07-09))
  3. Install the package:
$ npm install @kzen-networks/thresh-sig

Alternatively, clone it:

$ git clone https://github.com/KZen-networks/thresh-sig-js
$ cd thresh-sig-js
$ npm install
$ npm run build

Usage:

Start party one's server (acts as the co-signer in the two-party signature scheme):

const { Party1 } = require('@kzen-networks/thresh-sig');
const p1 = new Party1();
p1.launchServer();

ECDSA party two:

const { EcdsaParty2 } = require('@kzen-networks/thresh-sig');
const crypto = require('crypto');

const P1_ENDPOINT = 'http://localhost:8000';

(async () => {
    const party2 = new EcdsaParty2(P1_ENDPOINT);
    const party2MasterKeyShare = await party2.generateMasterKey();
    const party2ChildShare = party2.getChildShare(party2MasterKeyShare, 0, 0);
    const msgHash = crypto.createHash('sha256').update('some message').digest();
    const signature = await party2.sign(msgHash, party2ChildShare, 0, 0);
    console.log(JSON.stringify(signature));
    // {"r": <32-bytes-hex>,"s": <32-bytes-hex>,"recid": <0 or 1>}
})();

Schnorr party two:

const { SchnorrParty2 } = require('@kzen-networks/thresh-sig');
const crypto = require('crypto');

const P1_ENDPOINT = 'http://localhost:8000';

(async () => {
    const party2 = new SchnorrParty2(P1_ENDPOINT);
    const party2Share = await party2.generateKey();
    const msgHash = crypto.createHash('sha256').update('some message').digest();
    const signature = await party2.sign(msgHash, party2Share);
    console.log(JSON.stringify(signature));
    // {"e": <32-bytes-hex>,"s": <32-bytes-hex>}
})();

EdDSA party two:

const { Ed25519Party2 } = require('@kzen-networks/thresh-sig');
const crypto = require('crypto');

const P1_ENDPOINT = 'http://localhost:8000';

(async () => {
    const party2 = new Ed25519Party2(P1_ENDPOINT);
    const party2Share = await party2.generateKey();
    console.log(party2Share.getAggregatedPublicKey().apk.bytes_str);
    // <32-bytes-hex>
    const msgHash = crypto.createHash('sha256').update('some message').digest();
    const signature = await party2.sign(msgHash, party2Share);
    console.log(JSON.stringify(signature));
    // {"R":{"bytes_str":<32-bytes-hex>},"s":<32-bytes-hex>}
})()

Demo:

You can run a command line demo and see the two-party signing protocol in action.
Party one:

$ node ./demo/party1.js
๐Ÿ”ง Configured for production.
    => address: 0.0.0.0
    => port: 8000
    => log: critical
    => workers: 24
    => secret key: generated
    => limits: forms = 32KiB
    => keep-alive: 5s
    => tls: disabled
๐Ÿš€ Rocket has launched from http://0.0.0.0:8000

Party two (separate shell) -

  1. ECDSA:
$ node ./demo/ecdsa-party2.js
{"r":"b3d6168cc8ab6da64697b9e81c55863078da65cac7bbebc3d3f747dae0c6ac16","s":"449052412e20e510f8d4e31d721b3ef42199a9886a58a058c42d142b5850a177","recid":0}
  1. Schnorr:
$ node ./demo/schnorr-party2.js
{"e":"d960b3fe66d2dc1c2115c93b3e674344d73063c22148ff3bc8d67493ffb19814","s":"ed2ecaa8882ccaac946bf951835033d4326aaff2e1e466ecf1fdda32a6fc762b"}
  1. EdDSA:
$ node ./demo/eddsa-party2.js
{"R":{"bytes_str":"d86c5da0a257fd66acd007776f28d9f7a5083f84c66a41c98104c11cc5e9eaa3"},"s":"9964b5053843d6f6ddfaa25977f14f55676ae8a0e6bf89eafb412f417257abc"}

Contact

Feel free to reach out or join ZenGo X Telegram for discussions on code and research.

thresh-sig-js's People

Contributors

dependabot[bot] avatar oleiba avatar omershlo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

thresh-sig-js's Issues

fatal runtime error: failed to initiate panic, error 5

ClientShim initialization is failing with "fatal runtime error: failed to initiate panic, error 5" (command: node ./demo/ecdsa-party2.js)

I debug it and the line that throws the fatal runtime error is https://github.com/KZen-networks/thresh-sig-js/blob/master/native/src/party2/ecdsa.rs#L99 ( I tested directly downloading the repo and with terra-thresh-wallet repo)

My Environment:

  • OS: Ubuntu 18.04.5 LTS
  • Node version: v10.19.0
  • Rust version: rustc 1.38.0-nightly (0b680cfce 2019-07-09)

Other considerations:

  • The server is running successfully (command: node ./demo/party1.js)
  • I tested updating gotham-city to v0.1.3 but still got the same error

Unable to `yarn add` with nightly version 1.42

Getting an error

>> yarn add @kzen-networks/thresh-sig
yarn add v1.21.1
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "@terra-money/core > [email protected]" has unmet peer dependency "typescript@>=2.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
error /Users/amanusk/Code/Terra/terra-playground/node_modules/@kzen-networks/thresh-sig: Command failed.
Exit code: 1
Command: npm run build-rust
Arguments:
Directory: /Users/amanusk/Code/Terra/terra-playground/node_modules/@kzen-networks/thresh-sig
Output:
npm WARN lifecycle The node binary used for scripts is /var/folders/kv/n_fr2nfd6xs03k6dsx6zc4lm0000gn/T/yarn--1578386046202-0.9547941415549657/node but npm is using /Users/amanusk/.nvm/versions/node/v10.18.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> @kzen-networks/[email protected] build-rust /Users/amanusk/Code/Terra/terra-playground/node_modules/@kzen-networks/thresh-sig
> neon build -r

neon info forcing rebuild for new build settings
neon info running cargo
   Compiling libc v0.2.62
   Compiling cfg-if v0.1.9
   Compiling lazy_static v1.4.0
   Compiling semver-parser v0.7.0
   Compiling either v1.5.3
   Compiling arrayvec v0.4.11
   Compiling nodrop v0.1.13
   Compiling byteorder v1.3.2
   Compiling autocfg v0.1.6
   Compiling scopeguard v1.0.0
   Compiling rayon-core v1.6.0
   Compiling rand_core v0.4.2
   Compiling log v0.4.8
   Compiling version_check v0.1.5
   Compiling proc-macro2 v1.0.3
   Compiling unicode-xid v0.2.0
   Compiling syn v1.0.5
   Compiling memchr v2.2.1
   Compiling serde v1.0.101
   Compiling smallvec v0.6.10
   Compiling itoa v0.4.4
   Compiling futures v0.1.29
   Compiling proc-macro2 v0.4.30
   Compiling typenum v1.11.2
   Compiling unicode-xid v0.1.0
   Compiling ryu v1.0.0
   Compiling syn v0.15.44
   Compiling bitflags v1.1.0
   Compiling scopeguard v0.3.3
   Compiling matches v0.1.8
   Compiling slab v0.4.2
   Compiling gcc v0.3.55
   Compiling fnv v1.0.6
   Compiling regex-syntax v0.6.12
   Compiling stable_deref_trait v1.1.1
   Compiling constant_time_eq v0.1.4
   Compiling httparse v1.3.4
   Compiling percent-encoding v1.0.1
   Compiling arrayref v0.3.5
   Compiling hex v0.3.2
   Compiling byte-tools v0.3.1
   Compiling indexmap v1.2.0
   Compiling rustc-demangle v0.1.16
   Compiling getrandom v0.1.12
   Compiling opaque-debug v0.2.3
   Compiling failure_derive v0.1.5
   Compiling core-foundation-sys v0.6.2
   Compiling ppv-lite86 v0.2.5
   Compiling rustc-serialize v0.3.24
   Compiling safemem v0.3.2
   Compiling keccak v0.1.0
   Compiling try-lock v0.2.2
   Compiling zeroize v0.10.1
   Compiling yansi v0.4.0
   Compiling remove_dir_all v0.5.2
   Compiling yansi v0.5.0
   Compiling version_check v0.9.1
   Compiling native-tls v0.2.3
   Compiling glob v0.2.11
   Compiling unicode-width v0.1.6
   Compiling language-tags v0.2.2
   Compiling vec_map v0.8.1
   Compiling strsim v0.8.0
   Compiling ansi_term v0.11.0
   Compiling typeable v0.1.2
   Compiling traitobject v0.1.0
   Compiling yaml-rust v0.3.5
   Compiling ucd-util v0.1.5
   Compiling state v0.4.1
   Compiling percent-encoding v2.1.0
   Compiling quick-error v1.2.2
   Compiling regex v0.2.11
   Compiling crc32fast v1.2.0
   Compiling fake-simd v0.1.2
   Compiling termcolor v1.0.5
   Compiling bindgen v0.47.3
   Compiling same-file v1.0.5
   Compiling utf8-ranges v1.0.4
   Compiling encoding_rs v0.8.19
   Compiling adler32 v1.0.3
   Compiling serde v0.8.23
   Compiling peeking_take_while v0.1.2
   Compiling dtoa v0.4.4
   Compiling mime v0.3.14
   Compiling byte-tools v0.2.0
   Compiling neon-build v0.2.0
   Compiling bit-vec v0.6.1
   Compiling subtle v2.1.1
   Compiling md5 v0.3.8
   Compiling lazy_static v0.2.11
   Compiling linked-hash-map v0.5.2
   Compiling cryptoxide v0.1.2
   Compiling spin v0.5.2
   Compiling untrusted v0.6.2
   Compiling rust-ini v0.13.0
   Compiling bech32 v0.7.1
   Compiling cslice v0.2.0
   Compiling try_from v0.3.2
   Compiling crossbeam-utils v0.6.6
   Compiling thread_local v0.3.6
   Compiling semver v0.9.0
   Compiling itertools v0.7.11
   Compiling itertools v0.8.0
   Compiling rand_core v0.3.1
   Compiling rand_pcg v0.1.2
   Compiling rand_chacha v0.1.1
   Compiling rand v0.6.5
   Compiling num-traits v0.2.8
   Compiling num-integer v0.1.41
   Compiling unicode-normalization v0.1.8
   Compiling unicode-bidi v0.3.4
   Compiling nom v4.2.3
   Compiling unicase v1.4.2
   Compiling unicase v2.5.1
   Compiling error-chain v0.12.1
   Compiling owning_ref v0.4.0
   Compiling block-padding v0.1.4
   Compiling tokio-sync v0.1.6
   Compiling pear_codegen v0.1.2
   Compiling c2-chacha v0.2.2
   Compiling textwrap v0.11.0
   Compiling rocket_codegen v0.4.2
   Compiling rocket v0.4.2
   Compiling regex-syntax v0.5.6
   Compiling humantime v1.3.0
   Compiling clang-sys v0.26.4
   Compiling rust-crypto v0.2.36
   Compiling walkdir v2.2.9
   Compiling miniz_oxide v0.3.2
   Compiling block-buffer v0.3.3
   Compiling neon v0.2.0
   Compiling mpc-bindings v0.1.0 (/Users/amanusk/Code/Terra/terra-playground/node_modules/@kzen-networks/thresh-sig/native)
   Compiling yaml-rust v0.4.3
   Compiling crossbeam-queue v0.1.2
   Compiling tokio-executor v0.1.8
   Compiling rustc_version v0.2.3
   Compiling rand_isaac v0.1.1
   Compiling rand_hc v0.1.0
   Compiling rand_xorshift v0.1.1
   Compiling serde_test v0.8.23
   Compiling lock_api v0.1.5
   Compiling idna v0.1.5
   Compiling idna v0.2.0
   Compiling tokio-current-thread v0.1.6
   Compiling tokio-timer v0.2.11
   Compiling memoffset v0.5.1
   Compiling parking_lot_core v0.4.0
   Compiling hyper v0.12.35
   Compiling rusoto_core v0.36.0
   Compiling want v0.2.0
   Compiling log v0.3.9
   Compiling num_cpus v1.10.1
   Compiling rand_os v0.1.3
   Compiling rand_jitter v0.1.4
   Compiling time v0.1.42
   Compiling iovec v0.1.2
   Compiling net2 v0.2.33
   Compiling rand v0.4.6
   Compiling atty v0.2.13
   Compiling fsevent-sys v2.0.1
   Compiling filetime v0.2.7
   Compiling dirs v1.0.5
   Compiling rand v0.5.6
   Compiling linked-hash-map v0.3.0
   Compiling blake2b_simd v0.5.8
   Compiling base64 v0.9.3
   Compiling base64 v0.10.1
   Compiling hashbrown v0.1.8
   Compiling quote v1.0.2
   Compiling aho-corasick v0.7.6
   Compiling aho-corasick v0.6.10
   Compiling xml-rs v0.7.0
   Compiling security-framework-sys v0.3.1
   Compiling core-foundation v0.6.4
   Compiling quote v0.6.13
   Compiling url v1.7.2
   Compiling generic-array v0.12.3
   Compiling generic-array v0.9.0
   Compiling flate2 v1.0.11
   Compiling url v2.1.0
   Compiling mime v0.2.6
   Compiling futures-cpupool v0.1.8
   Compiling bytes v0.4.12
   Compiling time-test v0.2.1
   Compiling rand_core v0.5.1
   Compiling mio v0.6.19
   Compiling clap v2.33.0
   Compiling fsevent v0.4.0
   Compiling rand v0.3.23
   Compiling num-traits v0.1.43
   Compiling regex v1.3.1
   Compiling cexpr v0.3.5
   Compiling mime_guess v2.0.1
   Compiling security-framework v0.3.1
   Compiling cookie v0.11.1
   Compiling cookie v0.12.0
   Compiling digest v0.7.6
   Compiling crypto-mac v0.5.2
   Compiling digest v0.8.1
   Compiling block-buffer v0.7.3
   Compiling hyper v0.10.16
   Compiling rand_chacha v0.2.1
   Compiling tokio-io v0.1.12
   Compiling http v0.1.18
   Compiling string v0.2.1
   Compiling tokio-buf v0.1.1
   Compiling mio-uds v0.6.7
   Compiling notify v4.0.13
   Compiling uuid v0.7.4
   Compiling rust-gmp v0.5.0
   Compiling env_logger v0.6.2
   Compiling serde-hjson v0.8.2
   Compiling sha2 v0.7.1
   Compiling hmac v0.5.0
   Compiling sha3 v0.8.2
   Compiling sha2 v0.8.0
   Compiling crossbeam-epoch v0.7.2
   Compiling rand v0.7.1
   Compiling tokio-codec v0.1.1
   Compiling synstructure v0.10.2
   Compiling devise_core v0.2.0
   Compiling http-body v0.1.0
   Compiling h2 v0.1.26
   Compiling merkle-sha3 v0.1.0
   Compiling neon-runtime v0.2.0
   Compiling parking_lot v0.7.1
   Compiling serde_derive v1.0.101
   Compiling crossbeam-deque v0.7.1
   Compiling tempfile v3.1.0
   Compiling tokio-reactor v0.1.9
   Compiling tokio-threadpool v0.1.15
   Compiling tokio-uds v0.2.5
   Compiling tokio-udp v0.1.5
   Compiling tokio-tcp v0.1.3
   Compiling rayon v1.2.0
   Compiling tokio-fs v0.1.6
   Compiling tokio v0.1.22
   Compiling cc v1.0.41
   Compiling hyper-tls v0.3.2
   Compiling backtrace-sys v0.1.31
   Compiling secp256k1 v0.15.5
   Compiling libloading v0.5.2
   Compiling ring v0.14.6
   Compiling backtrace v0.3.37
   Compiling publicsuffix v1.5.3
   Compiling devise_codegen v0.2.0
   Compiling failure v0.1.5
   Compiling which v2.0.1
   Compiling devise v0.2.0
   Compiling serde_json v1.0.40
   Compiling toml v0.4.10
   Compiling chrono v0.4.9
   Compiling serde_urlencoded v0.5.5
   Compiling bitcoin_hashes v0.7.1
   Compiling pear v0.1.2
   Compiling rust-gmp v0.5.0 (https://github.com/KZen-networks/rust-gmp#a15e0ec2)
   Compiling cookie_store v0.7.0
   Compiling config v0.9.3
   Compiling rocket_http v0.4.2
   Compiling rusoto_credential v0.15.0
   Compiling jsonwebtoken v6.0.1
   Compiling curv v0.2.0 (https://github.com/KZen-networks/curv?tag=v0.2.0#1d858a07)
   Compiling curv v0.2.0 (https://github.com/KZen-networks/curv?tag=v0.2.0-ed25519#1d858a07)
   Compiling reqwest v0.9.20
   Compiling bulletproof v0.2.0 (https://github.com/KZen-networks/bulletproofs?tag=v0.2.0#3bbbd2c9)
   Compiling paillier v0.3.0 (https://github.com/KZen-networks/rust-paillier?tag=v0.3.0#735c95ec)
error[E0557]: feature has been removed
 --> /Users/amanusk/.cargo/git/checkouts/rust-paillier-5e0399ff4bbd1793/735c95e/src/lib.rs:1:12
  |
1 | #![feature(custom_attribute)]
  |            ^^^^^^^^^^^^^^^^ feature has been removed
  |
  = note: removed in favor of `#![register_tool]` and `#![register_attr]`

   Compiling bitcoin v0.20.0
error: aborting due to previous error

For more information about this error, try `rustc --explain E0557`.
error: could not compile `paillier`.
warning: build failed, waiting for other jobs to finish...
error: build failed
neon ERR! cargo build failed

Error: cargo build failed
    at Target.<anonymous> (/Users/amanusk/Code/Terra/terra-playground/node_modules/neon-cli/lib/target.js:121:35)
    at step (/Users/amanusk/Code/Terra/terra-playground/node_modules/neon-cli/lib/target.js:32:23)
    at Object.next (/Users/amanusk/Code/Terra/terra-playground/node_modules/neon-cli/lib/target.js:13:53)
    at fulfilled (/Users/amanusk/Code/Terra/terra-playground/node_modules/neon-cli/lib/target.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @kzen-networks/[email protected] build-rust: `neon build -r`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @kzen-networks/[email protected] build-rust script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/amanusk/.npm/_logs/2020-01-07T08_38_50_631Z-debug.log
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Adding with nightly-2019-09-28 works

Convert ECDSA Signature to HEX equivalent

Hello ๐Ÿ‘‹

I am using the ECDSA Sign function.

I provided a raw TX ( HEX TX) to the ECDSA Sign function

It returns :

EcdsaSignature { r: '48c84f78d2bfddfcc0ffd00ad2122874b77c14b472ef60ee56b33db4cff24c20', s: '391ecb9b5763b7686c9291653ba05ab2b84eb49ff53e2159506602ea595b2b5e', recid: 0 }

My question is simple : is there a way to convert it to an HEX value ? Like a raw signed TX ?

Thank you

Add a LICENSE file

Hi there!

Thanks for fantastic work on this ๐ŸŽ‰

I would just recommend you add a LICENSE file to your repo to make it more clear to developers and contributors what the license for this software is. I see the package.json says MIT - which is great! Adding a LICENSE file makes this even more clear to people looking at this repo ๐Ÿ‘

You can read more about this here

Error build-rust

Updating want v0.0.6 -> v0.2.0
Updating zk-paillier v0.1.0 (https://github.com/KZen-networks/zk-paillier#fc10183a) -> #5688244b

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @kzen-networks/[email protected] build-rust: cd ./native && cargo update && cd .. && ./node_modules/.bin/neon build -r
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @kzen-networks/[email protected] build-rust script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nico\AppData\Roaming\npm-cache_logs\2019-07-17T10_54_36_122Z-debug.log
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\nico\package.json'
npm WARN [email protected] requires a peer of rollup@>=0.60.0 but none is installed. You must install peer dependencies yourself.
npm WARN nico No description
npm WARN nico No repository field.
npm WARN nico No README data
npm WARN nico No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @kzen-networks/[email protected] postinstall: npm run build-rust
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @kzen-networks/[email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nico\AppData\Roaming\npm-cache_logs\2019-07-17T10_54_36_440Z-debug.log
2019-07-17T10_54_36_122Z-debug.log

Please find the log attached.

Thank you.

Unsupported URL Type "npm:": npm:@types/elliptic@^6.4.8

Trying to install getting the following error:

npm install @kzen-networks/thresh-sig
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:@types/elliptic@^6.4.8

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\nico\AppData\Roaming\npm-cache_logs\2019-07-17T09_16_08_535Z-debug.log

unable to send signed raw transaction

Hello

I have created a bitcoin address using thresh-sig-js

Using bitcoin-core JSON RPC API i created a raw transaction :

var session_url = "http://54.XX.XX.XX:8080/api/createrawtransaction"

This is the result :

02000000026bade3490fd7baab61dae5e1c63f4ffd76ed3c92067e99204e4ca2109e1064440100000000ffffffff4dd2145b62f017531219dc50a51eb19a3035cd004ebafd8b1fff50a8fdd4ecef0000000000ffffffff0240420f000000000017a91409970857055568059b178fae6baa639d5627031c8760823b000000000017a9141cdd8ea4897b32fe81e7affc36f9d42a1b9b48c38700000000

after that i sign using thresh-sig-js function :

party2.sign(response.data.result, party2ChildShare2, 0, 1)

i have this as result :

4cc2764d0488a9077f3484f1960d3c58abb55839b9989f8492d9784faf8945514a8d78d3b72d9ea43d772e0cbb712916c608b96da2931b5b801ecc80651f8d67

Now is time to broadcast using sendrawtransaction then i have this error :

'{"result":null,"error":{"code":-22,"message":"TX decode failed"},"id":"1"}\n'

i tried to use another way to broadcast the transaction:
i used the same signed raw tx on blockcypher : https://live.blockcypher.com/btc/pushtx/ to broadcast the transaction then i get this error everytime i try to broadcast the transaction :

Error validating transaction: Transaction c76381b81c66d6559ff0cd5e35caba9dc78b9d1a631357ebd1434a88bf566f4b orphaned, missing reference b7d3788d4a514589af4f78d992849f98b93958b5ab583c0d96f184347f07a988.

So what is wrong what am i doing wrong ??

Unable to send signed TX by

Hello

My testnet thresh address is :

2MusrKiffVxSqF7DdxKDSMA41JEKoizbCHo

My Raw Transaction :

02000000026bade3490fd7baab61dae5e1c63f4ffd76ed3c92067e99204e4ca2109e1064440100000000ffffffff4dd2145b62f017531219dc50a51eb19a3035cd004ebafd8b1fff50a8fdd4ecef0000000000ffffffff0240420f000000000017a91409970857055568059b178fae6baa639d5627031c87a0bb0d000000000017a9141cdd8ea4897b32fe81e7affc36f9d42a1b9b48c38700000000

My signed TX :

723a837df7bbb151fe50a9b73b39327f5dc03b637bacde46c30769670d73b8d54720faac7a41ce1e35a3a1a6641fb9bfc9746e336da49a2ab600d77faac77060

Sending TX :

var dataString = {"jsonrpc":"2.0","id":"1","method":"sendrawtransaction","params":["723a837df7bbb151fe50a9b73b39327f5dc03b637bacde46c30769670d73b8d54720faac7a41ce1e35a3a1a6641fb9bfc9746e336da49a2ab600d77faac77060"]};

var options = { url: "http://${USER}:${PASS}@127.0.0.1:8332/", method: "POST", headers: headers, body: dataString };

Yet i have this error :

{"result":null,"error":{"code":-22,"message":"TX decode failed"},"id":"1"}

So what's wrong ? is there something missing on my side ?

May i have an example of how you send a rawtransaction signed using thresh-sig-js ??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.