by
84k 18
0
4
88k
2
Top 1% !
Pearl of Wisdom
Tagged
Specified
Popularity: 27684th place

Published on:

Architecturex86_64
LanguageC#
Windows VersionWindows7

PubKeyToScript: For POS coins - used to format wallet address pubkey to use in generation transaction's output.

For POS coins - used to format wallet address pubkey to use in generation transaction's output.

<param name="key"></param>
<example>
nodejs: https://github.com/zone117x/node-stratum-pool/blob/3586ec0d7374b2acc5a72d5ef597da26f0e39d54/lib/util.js#L243
nodejs: http://runnable.com/me/VCFHE0RrZnwbsQ6y
</example>
<returns></returns>
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1373929/PubKeyToScript--For-POS-coins---used-to-?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
using System; using System.IO; using System.Linq; using CoiniumServ.Coin.Address; using CoiniumServ.Coin.Address.Exceptions; using CoiniumServ.Cryptology; using CoiniumServ.Utils.Extensions; using CoiniumServ.Utils.Numerics; using Gibbed.IO; using Serilog; /// <summary> /// For POS coins - used to format wallet address pubkey to use in generation transaction's output. /// </summary> /// <param name="key"></param> /// <example> /// nodejs: https://github.com/zone117x/node-stratum-pool/blob/3586ec0d7374b2acc5a72d5ef597da26f0e39d54/lib/util.js#L243 /// nodejs: http://runnable.com/me/VCFHE0RrZnwbsQ6y /// </example> /// <returns></returns> public static byte[] PubKeyToScript(string key) { var pubKey = key.HexToByteArray(); if (pubKey.Length != 33) { Log.Error("invalid pubkey length for {0:l}", key); return null; } byte[] result; using (var stream = new MemoryStream()) { stream.WriteValueU8(0x21); stream.WriteBytes(pubKey); stream.WriteValueU8(0xac); result = stream.ToArray(); } return result; }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus