Skip to Content
Getting StartedSending a Transaction

Sending a Transaction

Once a web application is connected to StarKey, it can prompt the user for permission to send transactions on their behalf.

To send a transaction, you will need to have a valid transaction object. It should look a little like this:

// Example transaction object const transaction = { data: "", // optional from: from_address, to: to_address, value: amount, };

However, this transaction object needs to be signed using the sender’s private key. This ensures that only the person holding the private key can send transactions from the public address.

To prompt StarKey to send a transaction to the network, use the following code snippet:

const provider = getProvider(); const transaction = { data: "", from: from_address, to: to_address, value: amount, }; const txHash = await provider.sendTransaction(transaction); console.log("txHash :: ", txHash);
Last updated on