[Erro create transaction with multi singature] #96
-
Describe the bug #Code var blockHash = await Web3.Instance.Wallet.ActiveRpcClient.GetRecentBlockHashAsync();
Debug.Log($"{blockHash.Result.Value.Blockhash}");
Account mintAccount = Web3.Instance.Wallet.Account;
Debug.Log($"MintAccount: {mintAccount}");
Account ownerAccount = new Account("", "9nQUWBRcx....LHGugZ9ES7FV");
Debug.Log($"OwnerAccount: {ownerAccount}");
Account initialAccount = new Account("", "87L945pDtHL...i5GxdQEnfqT");
Debug.Log($"InitialAccount: {initialAccount}");
var txBuilder = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(mintAccount)
.AddInstruction(MemoProgram.NewMemo(mintAccount.PublicKey, "Hello Mehrdad :)"))
.Build(new List<Account>() {mintAccount, ownerAccount, initialAccount});
var sign = await Web3.Instance.Wallet.SignTransaction(Transaction.Deserialize(txBuilder)); Expected behavior Screenshots Desktop (please complete the following information):
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@Mehrdadgame couple of issues,
Should be something like: var blockHash = await Web3.Wallet.ActiveRpcClient.GetRecentBlockHashAsync();
Debug.Log($"{blockHash.Result.Value.Blockhash}");
Account mintAccount = Web3.Wallet.Account;
Debug.Log($"MintAccount: {mintAccount}");
Account ownerAccount = new Account();
Debug.Log($"OwnerAccount: {ownerAccount}");
Account initialAccount = new Account();
Debug.Log($"InitialAccount: {initialAccount}");
var txBuilder = new TransactionBuilder()
.SetRecentBlockHash(blockHash.Result.Value.Blockhash)
.SetFeePayer(mintAccount)
.AddInstruction(MemoProgram.NewMemo(mintAccount.PublicKey, "Hello Mehrdad :)"))
.Serialize();
var tx = Transaction.Deserialize(txBuilder);
tx.Sign(ownerAccount);
tx.Sign(initialAccount);
var sign = await Web3.Wallet.SignAndSendTransaction(tx); |
Beta Was this translation helpful? Give feedback.
@Mehrdadgame couple of issues,
ownerAccount
andinitialAccount
have empty private keys, that will fail when signing.Build
method won't work for the same reason, if using an external wallet you should useWeb3.Wallet.SignAndSendTransaction
that will trigger the wallet signature.Should be something like: