Using a Public Address Account (PDA) in accounting program

In the Solana ecosystem, the program of the programmical public address (PDA) allows for security transfers and efficient transmission management. However, when it comes to using such an account in another program or application, it must be me.

background

PDA is a public document that can be registered with every program to be adopted. However, not all programs allow trips from their PDA accounts. To solve this problem, wet to consider how from AxDrawal processes and what will sleep in another program.

Choice process

Solana: Can a PDA account created in a program be allowed to use in another program to sign?

When in the Solan Crese and the PDA account, they occupy the following steps:

problem

Now let’s consider how he was attributed to the Awelist in Awelist for a white base that allows for accommodation to the accommodation specificator. This requires a certain setting and configuration of assignment:

and. The user of the Amissia Initiative and submits to it.

b. The original program has configured the PDA account, the Illladrawal transaction will be with its private key.

Solution

To solve this edition, we have implemented the most important AllLows that you will be able to do to stab. Here is one possible access:

Example code

Here is stupid excessive how to implement from this cover bed using Solan SDK:

“ Type Crip

Import {foreign, program} from “@solan/web3.js”;

Import {spltokenprogram} turned off ‘./spl token program’;

Const Original Program = new program (SPLTOENPROGGRAM, “Original_program”);

Const Newsy = New Account (“New_wallet”, “New_wallet_adddress”);

Async function with Auble Sallyfunds (Account: Account) {

// Get a private key

Const Privatekey = Acait Account.Ggetprivate ();

or

Const New Program = New Program (SplTotenprogram, “New_wallet program”));

Const Newwalletaddress = AWAIT Newprogram.CreateaCCount (Privatekey);

// sign through the extrawal transaction My

Const Soudletransction = {

to act,

AMONT: Spltokenprogram.amount,

};

Const Signransction = AWAIT Original Program.Signtransction (DownloadsTransction, Privatekey);

// Sent-Subscribed Transactions to them

Expect Original Program.

}

// Osage:

Const Newwallet = AWAIT Original Program.newwallet ();

Newwalletprogram = AWAIT New.CreateACount (Newwalletaddress);

Choose Funds (Original Program.

Ethereum Bitcoind Synchronizing

Leave a Reply

Your email address will not be published. Required fields are marked *