QuantumMechanics / NEM-sdk

NEM Developer Kit for Node.js and the browser
MIT License
137 stars 82 forks source link

How to create Multi-signature transactions? #12

Closed hasanaliqureshi closed 7 years ago

hasanaliqureshi commented 7 years ago

I want to create a transaction which require 2 passwords or private keys to get successfully on blockchain. Is there any documentation for that?

evias commented 7 years ago

You can already create multisig transactions with :

var trx = nem.model.objects.create("transferTransaction")("RECIPIENT", 100, "Hello");
trx.isMultisig = true;
trx.multisigAccount = {publicKey: "YOUR MULTISIG PUBLIC KEY"};

var trxEntity = nem.model.transaction.prepare("transferTransaction")(common, trx, nem.model.network.data.testnet.id);

you can then send the trxEntity object.

-- Signing features are not yet present in the SDK and I have sent a PR for this, will be soon.

Have a look at the source code you will understand how to work with the objects..