@@ -335,29 +335,42 @@ async function main() {
335
335
signable : true ,
336
336
} ) ;
337
337
let bc = new Uint8Array ( bcAb ) ;
338
- console . log ( `bc:` ) ;
338
+ console . log ( `bc (ready-to-sign) :` ) ;
339
339
console . log ( DashTx . utils . bytesToHex ( bc ) ) ;
340
340
console . log ( bytesToBase64 ( bc ) ) ;
341
341
342
342
/** @type {Uint8Array } */ //@ts -expect-error
343
343
let privBytes = addressKey . privateKey ;
344
344
let sigBytes = await KeyUtils . sign ( privBytes , bc ) ;
345
- let sigHex = DashTx . utils . bytesToHex ( sigBytes ) ;
345
+ // let sigHex = DashTx.utils.bytesToHex(sigBytes);
346
346
Object . assign ( stateTransition , {
347
- signature : sigHex ,
347
+ identity_id : identityId ,
348
+ // signature: sigHex,
349
+ signature : sigBytes ,
348
350
} ) ;
349
351
for ( let i = 0 ; i < identityKeys . length ; i += 1 ) {
350
352
let key = identityKeys [ i ] ;
351
353
let stPub = stateTransition . public_keys [ i ] ;
352
354
let sigBytes = await KeyUtils . sign ( key . privateKey , bc ) ;
353
- let sigHex = DashTx . utils . bytesToHex ( sigBytes ) ;
355
+ // let sigHex = DashTx.utils.bytesToHex(sigBytes);
354
356
Object . assign ( stPub , {
355
- signature : sigHex ,
357
+ // signature: sigHex,
358
+ signature : sigBytes ,
356
359
} ) ;
357
360
}
358
361
359
362
console . log ( JSON . stringify ( stateTransition , null , 2 ) ) ;
360
363
364
+ {
365
+ let bcAb = Bincode . encode ( Bincode . StateTransition , stateTransition , {
366
+ signable : false ,
367
+ } ) ;
368
+ let bc = new Uint8Array ( bcAb ) ;
369
+ console . log ( `bc (signed):` ) ;
370
+ console . log ( DashTx . utils . bytesToHex ( bc ) ) ;
371
+ console . log ( bytesToBase64 ( bc ) ) ;
372
+ }
373
+
361
374
// let identityId = assetLockProof.createIdentifier();
362
375
// let identity = Dpp.identity.create(identityId, dppKeys);
363
376
// let signedTransition = signTransition(
@@ -390,8 +403,9 @@ async function getFundingOutPointHex(txSignedHex, outputIndex) {
390
403
function createIdentityId ( fundingOutPointHex ) {
391
404
let fundingOutPointBytes = DashTx . utils . hexToBytes ( fundingOutPointHex ) ;
392
405
let identityHashBytes = DashTx . doubleSha256 ( fundingOutPointBytes ) ;
393
- let identityId = b58 . encode ( identityHashBytes ) ;
394
- return identityId ;
406
+ // let identityId = b58.encode(identityHashBytes);
407
+ // return identityId;
408
+ return identityHashBytes ;
395
409
}
396
410
397
411
/**
0 commit comments