We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build this neo cli plugin and you will have the ability to sign the transaction generated by neooffline
<PackageReference Include="Neo.ConsoleService" Version="1.2.0" />
using Neo.Network.P2P.Payloads; using Neo.Wallets; using Neo.ConsoleService; using Neo.IO; namespace Neo.Plugins; public class OfflineSigner : Plugin { public override string Description => "Offline Transaction Signer"; private IWalletProvider? walletProvider; private Wallets.Wallet? w; public NeoSystem? neoSystem; protected override void OnSystemLoaded(NeoSystem system) { neoSystem = system; neoSystem.ServiceAdded += NeoSystem_ServiceAdded!; } private void NeoSystem_ServiceAdded(object sender, object service) { if (service is IWalletProvider) { walletProvider = service as IWalletProvider; neoSystem!.ServiceAdded -= NeoSystem_ServiceAdded!; walletProvider!.WalletChanged += WalletProvider_WalletChanged!; } } private void WalletProvider_WalletChanged(object sender, Wallet wallet) { walletProvider!.WalletChanged -= WalletProvider_WalletChanged!; w = wallet; } [ConsoleCommand("offsign", Category = "Lazynode", Description = "sign the hex encoded transaction")] private void OnOffSign(string txhex) { if (w == null) { ConsoleHelper.Error("You have to open the wallet first."); return; } byte[] data = Convert.FromHexString(txhex); Transaction tx = new(); MemoryReader reader = new(data); tx.DeserializeUnsigned(ref reader); tx.Witnesses = tx.Signers.Select(v => new Witness { }).ToArray(); Console.WriteLine(tx.ToJson(neoSystem.Settings).ToString(true)); w.GetAccounts().Where(v => tx.Signers.Any(w => w.Account == v.ScriptHash)).Select(account => { var signature = tx.Sign(account.GetKey(), neoSystem!.Settings.Network); Console.WriteLine($"{account.Address}: {signature.ToHexString()}"); return 0; }).ToArray().ToString(); } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
build this neo cli plugin and you will have the ability to sign the transaction generated by neooffline
The text was updated successfully, but these errors were encountered: