Comments (2)
As simple as this?
if (Context.Instance.TryCreateECPrivKey(GenerateScalar(), out privKey))
{
var pubKey = privKey.CreateXOnlyPubKey();
Span<byte> privKeyc = stackalloc byte[65];
privKey.WriteToSpan(privKeyc);
var pubKeyStr = pubKey.ToBytes().ToHex();
var privKeyStr = privKeyc.ToHex()[..64];
}
Seems to work, though I'm having a hard time understanding the private key hex part.
from nbitcoin.
if (Context.Instance.TryCreateECPrivKey(scalar, out privKey))
{
var pubKey = privKey.CreateXOnlyPubKey();
var pubKeyStr = ToHex(pubKey);
Span<byte> privKeyc = stackalloc byte[32];
privKey.WriteToSpan(privKeyc);
string hexString = BitConverter.ToString(privKeyc.ToArray()).Replace("-", "");
}
from nbitcoin.
Related Issues (20)
- Link on the github readme page to ebook is not working
- Non-segwit inputs are not serialized in PSBTs HOT 4
- VerifyMessage does not exist HOT 7
- Hello, is there any sample code for taproot? HOT 1
- How to generate taproot NOMS internal key?
- Unable to create or compile to get NBitcoin.dll
- "Unknown transaction optional data" error when calling GetBlock() HOT 1
- Sign a text message with NBitcoin HOT 6
- RobiniaDocs API Explorer
- Failing to P2WPKH HOT 4
- Getting Block, Block Height, Block Hash
- Invalid PSBTInput Unknown SigHash Type
- NBitcoin > 7.0.24 - BitcoinStream.ReadWrite(ref byte[]) does not work anymore HOT 1
- This feature of taproot is not supported in .NET Framework HOT 1
- Improve SigHash support
- I cant create BIP84 Account Extended Public Key HOT 1
- How to use NBitcoin to verify historical tx transactions data๏ผ
- How to change fee and destination address in existing transaction?
- Support for Testnet4 HOT 6
- No pruneheight property on the GetBlockchainInfo RPC call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbitcoin.