Sitemap
Singapore Blockchain-Dapps

It is a space to share about Blockchain development. You

Bitcoin Wallet in C#

2 min readJun 12, 2019

--

implement bitcoin application in C#

「Bitcoin Wallet in C#」的圖片搜尋結果

Create project folder and initial project folder

mkdir MyProjectcd MyProjectdotnet new consoledotnet add package NBitcoindotnet restore

Bitcoin Address

This is how you generate a private key with NBitcoin:

Key privateKey = new Key(); // generate a random private key

Public key

PubKey publicKey = privateKey.PubKey;Console.WriteLine(publicKey); //output
03179195d8f1e0491f46d95baf853c63890b946b6a52807b7e74d467e1e5584b41

Address

Console.WriteLine(publicKey.GetAddress(ScriptPubKeyType.Legacy,Network.Main)); 
// 1ATCfxNw1Pdig3XanUxqBqXzNPurqPsM9
Console.WriteLine(publicKey.GetAddress(ScriptPubKeyType.Legacy,Network.TestNet));
// mfgQVj3Mk2ptVnX9JMTLf73rrMzcj6XVS5

Private Key

Private keys are often represented in Base58Check called a Bitcoin Secret (also known as Wallet Import Format or simply WIF), like Bitcoin Addresses.

Key privateKey2 = new Key(); //…

--

--

胡家維 Hu Kenneth
胡家維 Hu Kenneth

Written by 胡家維 Hu Kenneth

撰寫任何事情,O型水瓶混魔羯,咖啡愛好者,Full stack/blockchain Web3 developer,Founder of Blockchain&Dapps meetup ,Udemy teacher。 My Linktree: https://linktr.ee/kennethhutw

Singapore Blockchain-Dapps
Singapore Blockchain-Dapps

Published in Singapore Blockchain-Dapps

It is a space to share about Blockchain development. You