Advertisement
obernardovieira

stella multi sig setup

Sep 6th, 2018
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.get('/mssetup', (request, response) => {
  2.  
  3.     var bobPair = StellarSdk.Keypair.fromSecret("SAN5EIFHBYNOGYNNQWI27DRQ67HHOLEMBM4V3IGSOX2QNNW2O3RBA27Y");
  4.     var alicePair = StellarSdk.Keypair.fromSecret("SDLNYNCBBS5NBGQTWWQR7CMUUADA4NGBUY6WU3TOEKVWET5VGOEKFD4K");
  5.     //
  6.     var fromPair = StellarSdk.Keypair.fromSecret("SACBACXALCZNQJJJ3AW5NGEAQYJHPDRSOLF4HNNSSQ3GMW2GPSEJLTWU");
  7.  
  8.     server.loadAccount(fromPair.publicKey()).then((account) => {
  9.  
  10.         var transaction = new StellarSdk.TransactionBuilder(account)
  11.             .addOperation(StellarSdk.Operation.setOptions({
  12.                 setFlags: 1,
  13.                 signer: {
  14.                     ed25519PublicKey: bobPair.publicKey(),
  15.                     weight: 1
  16.                 },
  17.                 signer: {
  18.                     ed25519PublicKey: alicePair.publicKey(),
  19.                     weight: 1
  20.                 },
  21.                 masterWeight: 0, // set master key weight
  22.                 lowThreshold: 1,
  23.                 medThreshold: 1, // a payment is medium threshold
  24.                 highThreshold: 1 // make sure to have enough weight to add up to the high threshold!
  25.             }))
  26.             .build();
  27.  
  28.         transaction.sign(fromPair);
  29.  
  30.         server.submitTransaction(transaction)
  31.             .then(() => {
  32.                 response.send('worked!')
  33.             })
  34.             .catch((err) => {
  35.                 console.log(err.response.data.extras.result_codes);
  36.                 response.send('An error ocurred!')
  37.             });
  38.  
  39.     }).catch((err) => {
  40.         console.log(err.response.data.extras.result_codes);
  41.         response.send('An error ocurred2!')
  42.     });
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement