Skip to content

Instantly share code, notes, and snippets.

Last active July 29, 2023 02:51
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save gimre-xymcity/7965a83745ae62c9de1abefa0d9e92e3 to your computer and use it in GitHub Desktop.
import symbolSdk from "/path/to/symbolsdk/javascript/src/index.js";
const facade = new symbolSdk.facade.SymbolFacade("testnet");
type PrivateKey = InstanceType<typeof symbolSdk.PrivateKey>;
const privateKey: PrivateKey = symbolSdk.PrivateKey.random();
const privateKey: PrivateKey = new symbolSdk.PrivateKey(
console.log(`private key: ${privateKey.toString()}`);
type KeyPair = InstanceType<typeof symbolSdk.symbol.KeyPair>;
const keyPair: KeyPair = new symbolSdk.symbol.KeyPair(privateKey);
console.log(` public key: ${keyPair.publicKey.toString()}`);
const transaction = facade.transactionFactory.create({
type: "transfer_transaction_v1",
signerPublicKey: keyPair.publicKey.toString(),
fee: 1000000n,
deadline: 41998024783n,
mosaics: [{ mosaicId: 0x7cdf3b117a3c40ccn, amount: 1000000n }],
type Signature = InstanceType<typeof symbolSdk.Signature>;
const signature: Signature = facade.signTransaction(keyPair, transaction);
console.log(` signature: ${signature.toString()}`);
const jsonPayload: string =
console.log("json payload:");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment