Skip to main content
use `signatures` field rather than `signature`, which doesn't exist, and clarify `sendTransaction`
Source Link
trent.sol
  • 4.6k
  • 7
  • 27

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signatures[0]signature())

You will need to already have a blockhash defined and set against the transaction for this to work.

This will not work with sendTransaction, which re-signs everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signatures[0])

You will need to already have a blockhash defined and set against the transaction for this to work.

This will not work with sendTransaction, which re-signs everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signature())

You will need to already have a blockhash defined and set against the transaction for this to work.

This will not work with sendTransaction, which re-signs everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)
use `signatures` field rather than `signature`, which doesn't exist, and clarify `sendTransaction`
Source Link

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signaturesignatures[0])

You will need to already have a blockhash defined and set against the transaction for this to work.

I -think- this mightThis will not then work with sendTransaction, which expects to re-signsigns everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signature)

You will need to already have a blockhash defined and set against the transaction for this to work.

I -think- this might not then work with sendTransaction, which expects to re-sign everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signatures[0])

You will need to already have a blockhash defined and set against the transaction for this to work.

This will not work with sendTransaction, which re-signs everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)
Source Link
yamen
  • 698
  • 3
  • 3

You can manually sign the transaction before sending it, and then retrieve signature:

const bs58 = require('bs58');

// build a transaction
const transaction = new Transaction(...);

// sign it explicitly
transaction.sign(...signers);

// retrieve the signature as base58
const signature = bs58.encode(transaction.signature)

You will need to already have a blockhash defined and set against the transaction for this to work.

I -think- this might not then work with sendTransaction, which expects to re-sign everything. So serialize the message directly to send:

const message = transaction.serialize();
connection.sendRawTransaction(message)