├── .gitignore ├── BitcoinLib ├── Auxiliary │ ├── Encoders │ │ ├── ASCIIEncoder.cs │ │ ├── DataEncoder.cs │ │ └── HexEncoder.cs │ ├── GlobalConstants.cs │ ├── Hashing.cs │ └── UnixTime.cs ├── BitcoinLib.csproj ├── BitcoinLib.v3.ncrunchproject ├── CoinParameters │ ├── Base │ │ ├── CoinConstants.cs │ │ ├── CoinParameters.cs │ │ └── ICoinParameters.cs │ ├── Bitcoin │ │ ├── BitcoinConstants.cs │ │ └── IBitcoinConstants.cs │ ├── Dash │ │ ├── DashConstants.cs │ │ └── IDashConstants.cs │ ├── Dogecoin │ │ ├── DogecoinConstants.cs │ │ └── IDogecoinConstants.cs │ ├── Litecoin │ │ ├── ILitecoinConstants.cs │ │ └── LitecoinConstants.cs │ └── XimBlock │ │ ├── IXimBlockConstants.cs │ │ └── XimBlockConstants.cs ├── ExceptionHandling │ ├── RawTransactions │ │ ├── RawTransactionExcessiveFeeException.cs │ │ └── RawTransactionInvalidAmountException.cs │ ├── Rpc │ │ ├── RpcException.cs │ │ ├── RpcInternalServerErrorException.cs │ │ ├── RpcRequestTimeoutException.cs │ │ └── RpcResponseDeserializationException.cs │ └── RpcExtenderService │ │ └── GetAddressBalanceException.cs ├── ExtensionMethods │ ├── CoinServiceExtensionMethods.cs │ └── DecimalExtensionMethods.cs ├── Properties │ └── AssemblyInfo.cs ├── RPC │ ├── Connector │ │ ├── IRpcConnector.cs │ │ ├── RawRpcConnector.cs │ │ └── RpcConnector.cs │ ├── RequestResponse │ │ ├── JsonRpcError.cs │ │ ├── JsonRpcRequest.cs │ │ └── JsonRpcResponse.cs │ └── Specifications │ │ ├── RpcErrorCode.cs │ │ └── RpcMethods.cs ├── Requests │ ├── AddNode │ │ └── NodeAction.cs │ ├── CreateRawTransaction │ │ ├── CreateRawTransactionInput.cs │ │ ├── CreateRawTransactionOutput.cs │ │ └── CreateRawTransactionRequest.cs │ └── SignRawTransaction │ │ ├── SigHashType.cs │ │ ├── SignRawTransactionInput.cs │ │ └── SignRawTransactionRequest.cs ├── Responses │ ├── Bridges │ │ └── ITransactionResponse.cs │ ├── CreateMultiSigResponse.cs │ ├── DecodeRawTransactionResponse.cs │ ├── DecodeScriptResponse.cs │ ├── GetAddedNodeInfoResponse.cs │ ├── GetBlockResponse.cs │ ├── GetBlockTemplateResponse.cs │ ├── GetBlockchainInfoResponse.cs │ ├── GetChainTipsResponse.cs │ ├── GetInfoResponse.cs │ ├── GetMemPoolInfoResponse.cs │ ├── GetMiningInfoResponse.cs │ ├── GetNetTotalsResponse.cs │ ├── GetNetworkInfoResponse.cs │ ├── GetPeerInfoResponse.cs │ ├── GetRawMemPoolResponse.cs │ ├── GetRawTransactionResponse.cs │ ├── GetTransactionResponse.cs │ ├── GetTxOutSetInfoResponse.cs │ ├── GetWalletInfoResponse.cs │ ├── ListAddressGroupingsResponse.cs │ ├── ListReceivedByAccountResponse.cs │ ├── ListReceivedByAddressResponse.cs │ ├── ListSinceBlockResponse.cs │ ├── ListTransactionsResponse.cs │ ├── ListUnspentResponse.cs │ ├── SharedComponents │ │ ├── Vin.cs │ │ └── Vout.cs │ ├── SignRawTransactionResponse.cs │ └── ValidateAddressResponse.cs └── Services │ ├── Coins │ ├── Base │ │ └── ICoinService.cs │ ├── Bitcoin │ │ ├── BitcoinCashService.cs │ │ ├── BitcoinService.cs │ │ └── IBitcoinService.cs │ ├── Cryptocoin │ │ ├── CryptocoinService.cs │ │ └── ICryptocoinService.cs │ ├── Dash │ │ ├── AddressBalanceRequest.cs │ │ ├── AddressBalanceResponse.cs │ │ ├── DashService.cs │ │ ├── IDashService.cs │ │ ├── ListUnspentDashResponse.cs │ │ ├── SignRawTransactionError.cs │ │ └── SignRawTransactionWithErrorResponse.cs │ ├── Dogecoin │ │ ├── DogecoinService.cs │ │ └── IDogecoinService.cs │ ├── Litecoin │ │ ├── ILitecoinService.cs │ │ └── LitecoinService.cs │ ├── Sarcoin │ │ ├── ISarcoinService.cs │ │ └── SarcoinService.cs │ └── XimBlock │ │ ├── IXimBlockService.cs │ │ └── XimBlockService.cs │ └── RpcServices │ ├── RpcExtenderService │ ├── IRpcExtenderService.cs │ └── RpcExtenderService.cs │ └── RpcService │ ├── IRpcService.cs │ └── RpcService.cs ├── Controllers └── HomeController.cs ├── LICENSE ├── Models ├── CoinMarketCapCurrencyTicker.cs ├── Currency.cs ├── CurrencyExtensions.cs ├── RawTxHashesAndRawTx.cs ├── SigningRawTxFailed.cs ├── TxInput.cs ├── TxOutput.cs └── XimBlockNode.cs ├── Program.cs ├── Properties ├── PublishProfiles │ └── FolderProfile.pubxml └── launchSettings.json ├── README.md ├── Startup.cs ├── Views ├── Home │ ├── About.cshtml │ ├── AboutCreateNewWallet.cshtml │ ├── AboutTransactionFees.cshtml │ ├── Address.cshtml │ ├── Index.cshtml │ └── Transaction.cshtml ├── Shared │ ├── Error.cshtml │ ├── _Layout.cshtml │ └── _ValidationScriptsPartial.cshtml ├── _ViewImports.cshtml └── _ViewStart.cshtml ├── appsettings.Development.json ├── appsettings.json ├── bitcore-lib-ximblock ├── generate-ximblock.js.cmd ├── how-to-build_ximblock.js.txt ├── package-lock.json └── ximblock.input.js ├── bundleconfig.json ├── myximblockwallet.org.csproj ├── myximblockwallet.org.sln └── wwwroot ├── css ├── site.css └── site.min.css ├── favicon.ico ├── images ├── MyXimBlockWallet.png ├── QrCodeWhenUnlocked.png ├── XimBlockLogoBig.png ├── ajax-loader.gif ├── banner1.svg ├── banner2.svg ├── banner3.svg ├── banner4.svg ├── icon-eye-closed.svg ├── icon-eye.svg ├── icon-help-2.svg ├── icon-help-3.svg ├── icon-help.svg ├── logo-ledger.svg ├── logo-trezor.svg ├── onboarding_icon-01.svg ├── onboarding_icon-02.svg ├── onboarding_icon-03.svg ├── onboarding_icon-04.svg ├── onboarding_icon-05.svg ├── onboarding_icon-06.svg ├── onboarding_icon-07.svg ├── onboarding_icon-08.svg ├── onboarding_icon-09.svg └── onboarding_icon-10.svg ├── index.js ├── instascan.min.js ├── lib ├── bootstrap │ ├── .bower.json │ ├── LICENSE │ └── dist │ │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js ├── jquery-validation-unobtrusive │ ├── .bower.json │ ├── jquery.validate.unobtrusive.js │ └── jquery.validate.unobtrusive.min.js ├── jquery-validation │ ├── .bower.json │ ├── LICENSE.md │ └── dist │ │ ├── additional-methods.js │ │ ├── additional-methods.min.js │ │ ├── jquery.validate.js │ │ └── jquery.validate.min.js └── jquery │ ├── .bower.json │ ├── LICENSE.txt │ └── dist │ ├── jquery.js │ ├── jquery.min.js │ └── jquery.min.map ├── ximblock-favicon.svg └── ximblock.js /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | #excluded files 35 | node_modules/ 36 | obj/ 37 | bin/ 38 | Full/ 39 | .vs/ 40 | packages/ 41 | _NCRUNCH_* 42 | *.user 43 | CustomProfile.pubxml 44 | *.config 45 | -------------------------------------------------------------------------------- /BitcoinLib/Auxiliary/Encoders/ASCIIEncoder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Linq; 5 | 6 | namespace BitcoinLib.Auxiliary.Encoders 7 | { 8 | public class ASCIIEncoder : DataEncoder 9 | { 10 | public override byte[] DecodeData(string encoded) 11 | { 12 | return string.IsNullOrEmpty(encoded) ? new byte[0] : encoded.ToCharArray().Select(o => (byte) o).ToArray(); 13 | } 14 | 15 | public override string EncodeData(byte[] data, int offset, int count) 16 | { 17 | return new string(data.Skip(offset).Take(count).Select(o => (char) o).ToArray()).Replace("\0", ""); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /BitcoinLib/Auxiliary/Encoders/DataEncoder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Auxiliary.Encoders 5 | { 6 | public abstract class DataEncoder 7 | { 8 | internal DataEncoder() 9 | { 10 | } 11 | 12 | // char.IsWhiteSpace fits well but it match other whitespaces 13 | // characters too and also works for unicode characters. 14 | public static bool IsSpace(char c) 15 | { 16 | return c == ' ' || c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r'; 17 | } 18 | 19 | public string EncodeData(byte[] data) 20 | { 21 | return EncodeData(data, 0, data.Length); 22 | } 23 | 24 | public abstract string EncodeData(byte[] data, int offset, int count); 25 | 26 | public abstract byte[] DecodeData(string encoded); 27 | } 28 | 29 | public static class Encoders 30 | { 31 | private static readonly ASCIIEncoder _ASCII = new ASCIIEncoder(); 32 | 33 | private static readonly HexEncoder _Hex = new HexEncoder(); 34 | 35 | public static DataEncoder ASCII => _ASCII; 36 | 37 | public static DataEncoder Hex => _Hex; 38 | } 39 | } -------------------------------------------------------------------------------- /BitcoinLib/Auxiliary/Encoders/HexEncoder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | using System.Linq; 6 | 7 | namespace BitcoinLib.Auxiliary.Encoders 8 | { 9 | public class HexEncoder : DataEncoder 10 | { 11 | private static readonly string[] HexTbl = Enumerable.Range(0, 256).Select(v => v.ToString("x2")).ToArray(); 12 | 13 | private static readonly int[] HexValueArray; 14 | 15 | static HexEncoder() 16 | { 17 | var hexDigits = new[] 18 | { 19 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 20 | 'A', 'B', 'C', 'D', 'E', 'F' 21 | }; 22 | var hexValues = new byte[] 23 | { 24 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 25 | 10, 11, 12, 13, 14, 15 26 | }; 27 | 28 | var max = hexDigits.Max(); 29 | HexValueArray = new int[max + 1]; 30 | for (var i = 0; i < HexValueArray.Length; i++) 31 | { 32 | var idx = Array.IndexOf(hexDigits, (char) i); 33 | var value = -1; 34 | if (idx != -1) 35 | value = hexValues[idx]; 36 | HexValueArray[i] = value; 37 | } 38 | } 39 | 40 | public bool Space { get; set; } 41 | 42 | public override string EncodeData(byte[] data, int offset, int count) 43 | { 44 | if (data == null) 45 | throw new ArgumentNullException(nameof(data)); 46 | 47 | var pos = 0; 48 | var spaces = (Space ? Math.Max((count - 1), 0) : 0); 49 | var s = new char[2 * count + spaces]; 50 | for (var i = offset; i < offset + count; i++) 51 | { 52 | if (Space && i != 0) 53 | s[pos++] = ' '; 54 | var c = HexTbl[data[i]]; 55 | s[pos++] = c[0]; 56 | s[pos++] = c[1]; 57 | } 58 | return new string(s); 59 | } 60 | 61 | public override byte[] DecodeData(string encoded) 62 | { 63 | if (encoded == null) 64 | throw new ArgumentNullException(nameof(encoded)); 65 | if (encoded.Length % 2 == 1) 66 | throw new FormatException("Invalid Hex String"); 67 | 68 | var result = new byte[encoded.Length / 2]; 69 | for (int i = 0, j = 0; i < encoded.Length; i += 2, j++) 70 | { 71 | var a = IsDigit(encoded[i]); 72 | var b = IsDigit(encoded[i + 1]); 73 | if (a == -1 || b == -1) 74 | throw new FormatException("Invalid Hex String"); 75 | result[j] = (byte) (((uint) a << 4) | (uint) b); 76 | } 77 | return result; 78 | } 79 | 80 | public bool IsValid(string str) 81 | { 82 | return str.ToCharArray().All(c => IsDigit(c) != -1) && str.Length % 2 == 0; 83 | } 84 | 85 | public static int IsDigit(char c) 86 | { 87 | return c + 1 <= HexValueArray.Length 88 | ? HexValueArray[c] 89 | : -1; 90 | } 91 | 92 | public static bool IsWellFormed(string str) 93 | { 94 | try 95 | { 96 | Encoders.Hex.DecodeData(str); 97 | return true; 98 | } 99 | catch (FormatException) 100 | { 101 | return false; 102 | } 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /BitcoinLib/Auxiliary/GlobalConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Auxiliary 5 | { 6 | public static class GlobalConstants 7 | { 8 | public const ushort MillisecondsInASecond = 1000; 9 | public const ushort MinutesInADay = 1440; 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Auxiliary/Hashing.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Linq; 5 | using System.Security.Cryptography; 6 | using System.Text; 7 | 8 | namespace BitcoinLib.Auxiliary 9 | { 10 | public class Hashing 11 | { 12 | public static string GetSha256(string text) 13 | { 14 | return new SHA256Managed().ComputeHash(Encoding.UTF8.GetBytes(text)).Aggregate(string.Empty, (current, x) => current + $"{x:x2}"); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /BitcoinLib/Auxiliary/UnixTime.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.Auxiliary 7 | { 8 | public static class UnixTime 9 | { 10 | private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0); 11 | 12 | public static DateTime UnixTimeToDateTime(double unixTimeStamp) 13 | { 14 | return Epoch.AddSeconds(unixTimeStamp).ToUniversalTime(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /BitcoinLib/BitcoinLib.v3.ncrunchproject: -------------------------------------------------------------------------------- 1 |  2 | 3 | True 4 | 5 | -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Base/CoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.CoinParameters.Base 7 | { 8 | public abstract class CoinConstants where T : CoinConstants, new() 9 | { 10 | private static readonly Lazy Lazy = new Lazy(() => new T()); 11 | public static T Instance => Lazy.Value; 12 | } 13 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Base/ICoinParameters.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.Services; 5 | 6 | namespace BitcoinLib.CoinParameters.Base 7 | { 8 | public interface ICoinParameters 9 | { 10 | CoinService.CoinParameters Parameters { get; } 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Bitcoin/BitcoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Base; 5 | 6 | namespace BitcoinLib.CoinParameters.Bitcoin 7 | { 8 | public static class BitcoinConstants 9 | { 10 | public sealed class Constants : CoinConstants 11 | { 12 | public readonly int OneBitcoinInSatoshis = 100000000; 13 | public readonly decimal OneSatoshiInBTC = 0.00000001M; 14 | public readonly int SatoshisPerBitcoin = 100000000; 15 | public readonly string Symbol = "฿"; 16 | 17 | #region Custom constructor example - commented out on purpose 18 | 19 | //private static readonly Lazy Lazy = new Lazy(() => new Constants()); 20 | 21 | //public static Constants Instance 22 | //{ 23 | // get 24 | // { 25 | // return Lazy.Value; 26 | // } 27 | //} 28 | 29 | //private Constants() 30 | //{ 31 | // // custom logic here 32 | //} 33 | 34 | #endregion 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Bitcoin/IBitcoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.CoinParameters.Bitcoin 5 | { 6 | public interface IBitcoinConstants 7 | { 8 | BitcoinConstants.Constants Constants { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Dash/DashConstants.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.CoinParameters.Base; 2 | 3 | namespace BitcoinLib.CoinParameters.Dash 4 | { 5 | public static class DashConstants 6 | { 7 | public sealed class Constants : CoinConstants 8 | { 9 | public readonly ushort CoinReleaseHalfsEveryXInYears = 7; 10 | public readonly ushort DifficultyIncreasesEveryXInBlocks = 34560; 11 | public readonly uint OneDashInDuffs = 100000000; 12 | public readonly decimal OneDuffInDash = 0.00000001M; 13 | public readonly decimal OneMicrodashInDash = 0.000001M; 14 | public readonly decimal OneMillidashInDash = 0.001M; 15 | public readonly string Symbol = "DASH"; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Dash/IDashConstants.cs: -------------------------------------------------------------------------------- 1 | namespace BitcoinLib.CoinParameters.Dash 2 | { 3 | public interface IDashConstants 4 | { 5 | DashConstants.Constants Constants { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Dogecoin/DogecoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Base; 5 | 6 | namespace BitcoinLib.CoinParameters.Dogecoin 7 | { 8 | public static class DogecoinConstants 9 | { 10 | public sealed class Constants : CoinConstants 11 | { 12 | public readonly ushort CoinReleaseHalfsEveryXInYears = 4; 13 | public readonly ushort DifficultyIncreasesEveryXInBlocks = 2016; 14 | public readonly uint OneDogecoinInKoinus = 100000000; 15 | public readonly decimal OneKoinuInXDG = 0.00000001M; 16 | public readonly decimal OneMicrocoinInXDG = 0.000001M; 17 | public readonly decimal OneMillicoinInXDG = 0.001M; 18 | public readonly string Symbol = "Ð"; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Dogecoin/IDogecoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.CoinParameters.Dogecoin 5 | { 6 | public interface IDogecoinConstants 7 | { 8 | DogecoinConstants.Constants Constants { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Litecoin/ILitecoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.CoinParameters.Litecoin 5 | { 6 | public interface ILitecoinConstants 7 | { 8 | LitecoinConstants.Constants Constants { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/Litecoin/LitecoinConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Base; 5 | 6 | namespace BitcoinLib.CoinParameters.Litecoin 7 | { 8 | public static class LitecoinConstants 9 | { 10 | public sealed class Constants : CoinConstants 11 | { 12 | public readonly ushort CoinReleaseHalfsEveryXInYears = 4; 13 | public readonly ushort DifficultyIncreasesEveryXInBlocks = 2016; 14 | public readonly uint OneLitecoinInLitetoshis = 100000000; 15 | public readonly decimal OneLitetoshiInLTC = 0.00000001M; 16 | public readonly decimal OneMicrocoinInLTC = 0.000001M; 17 | public readonly decimal OneMillicoinInLTC = 0.001M; 18 | public readonly string Symbol = "Ł"; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/XimBlock/IXimBlockConstants.cs: -------------------------------------------------------------------------------- 1 | namespace BitcoinLib.CoinParameters.XimBlock 2 | { 3 | public interface IXimBlockConstants 4 | { 5 | XimBlockConstants.Constants Constants { get; } 6 | } 7 | } -------------------------------------------------------------------------------- /BitcoinLib/CoinParameters/XimBlock/XimBlockConstants.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.CoinParameters.Base; 2 | 3 | namespace BitcoinLib.CoinParameters.XimBlock 4 | { 5 | public static class XimBlockConstants 6 | { 7 | public sealed class Constants : CoinConstants 8 | { 9 | public readonly ushort CoinReleaseHalfsEveryXInYears = 7; 10 | public readonly ushort DifficultyIncreasesEveryXInBlocks = 34560; 11 | public readonly string Symbol = "XIM"; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/RawTransactions/RawTransactionExcessiveFeeException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExceptionHandling.RawTransactions 7 | { 8 | [Serializable] 9 | public class RawTransactionExcessiveFeeException : Exception 10 | { 11 | public RawTransactionExcessiveFeeException() : base("Fee in raw transaction is greater than specified amount.") 12 | { 13 | } 14 | 15 | public RawTransactionExcessiveFeeException(decimal maxSpecifiedFee) : base($"Fee in raw transaction is greater than specified amount of {maxSpecifiedFee}.") 16 | { 17 | } 18 | 19 | public RawTransactionExcessiveFeeException(decimal actualFee, decimal maxSpecifiedFee) : base($"Fee of {actualFee} in raw transaction is greater than specified amount of {maxSpecifiedFee}.") 20 | { 21 | } 22 | 23 | public RawTransactionExcessiveFeeException(string message) : base(message) 24 | { 25 | } 26 | 27 | public RawTransactionExcessiveFeeException(string message, Exception innerException) : base(message, innerException) 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/RawTransactions/RawTransactionInvalidAmountException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExceptionHandling.RawTransactions 7 | { 8 | [Serializable] 9 | public class RawTransactionInvalidAmountException : Exception 10 | { 11 | public RawTransactionInvalidAmountException() : base("Raw Transaction amount is invalid.") 12 | { 13 | } 14 | 15 | public RawTransactionInvalidAmountException(string message) : base(message) 16 | { 17 | } 18 | 19 | public RawTransactionInvalidAmountException(string message, Exception innerException) : base(message, innerException) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/Rpc/RpcException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExceptionHandling.Rpc 7 | { 8 | [Serializable] 9 | public class RpcException : Exception 10 | { 11 | public RpcException() 12 | { 13 | } 14 | 15 | public RpcException(string customMessage) : base(customMessage) 16 | { 17 | } 18 | 19 | public RpcException(string customMessage, Exception exception) : base(customMessage, exception) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/Rpc/RpcInternalServerErrorException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | using System.Runtime.Serialization; 6 | using BitcoinLib.RPC.Specifications; 7 | 8 | namespace BitcoinLib.ExceptionHandling.Rpc 9 | { 10 | [Serializable] 11 | public class RpcInternalServerErrorException : Exception 12 | { 13 | public RpcInternalServerErrorException() 14 | { 15 | } 16 | 17 | public RpcInternalServerErrorException(string customMessage) : base(customMessage) 18 | { 19 | } 20 | 21 | public RpcInternalServerErrorException(string customMessage, Exception exception) : base(customMessage, exception) 22 | { 23 | } 24 | 25 | public RpcErrorCode? RpcErrorCode { get; set; } 26 | 27 | public override void GetObjectData(SerializationInfo info, StreamingContext context) 28 | { 29 | if (info == null) 30 | { 31 | throw new ArgumentNullException("info"); 32 | } 33 | 34 | info.AddValue("RpcErrorCode", RpcErrorCode, typeof(RpcErrorCode)); 35 | base.GetObjectData(info, context); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/Rpc/RpcRequestTimeoutException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExceptionHandling.Rpc 7 | { 8 | [Serializable] 9 | public class RpcRequestTimeoutException : Exception 10 | { 11 | public RpcRequestTimeoutException() 12 | { 13 | } 14 | 15 | public RpcRequestTimeoutException(string customMessage) : base(customMessage) 16 | { 17 | } 18 | 19 | public RpcRequestTimeoutException(string customMessage, Exception exception) : base(customMessage, exception) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/Rpc/RpcResponseDeserializationException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExceptionHandling.Rpc 7 | { 8 | [Serializable] 9 | public class RpcResponseDeserializationException : Exception 10 | { 11 | public RpcResponseDeserializationException() 12 | { 13 | } 14 | 15 | public RpcResponseDeserializationException(string customMessage) : base(customMessage) 16 | { 17 | } 18 | 19 | public RpcResponseDeserializationException(string customMessage, Exception exception) : base(customMessage, exception) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/ExceptionHandling/RpcExtenderService/GetAddressBalanceException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExceptionHandling.RpcExtenderService 7 | { 8 | [Serializable] 9 | public class GetAddressBalanceException : Exception 10 | { 11 | public GetAddressBalanceException() 12 | { 13 | } 14 | 15 | public GetAddressBalanceException(string customMessage) : base(customMessage) 16 | { 17 | } 18 | 19 | public GetAddressBalanceException(string customMessage, Exception exception) : base(customMessage, exception) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/ExtensionMethods/CoinServiceExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.Services.Coins.Base; 5 | 6 | namespace BitcoinLib.ExtensionMethods 7 | { 8 | public static class CoinServiceExtensionMethods 9 | { 10 | public static void SwitchNetworks(this ICoinService coinService) 11 | { 12 | coinService.Parameters.UseTestnet = !coinService.Parameters.UseTestnet; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /BitcoinLib/ExtensionMethods/DecimalExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | 6 | namespace BitcoinLib.ExtensionMethods 7 | { 8 | public static class DecimalExtensionMethods 9 | { 10 | public static ushort GetNumberOfDecimalPlaces(this decimal number) 11 | { 12 | return BitConverter.GetBytes(decimal.GetBits(number)[3])[2]; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /BitcoinLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | 11 | [assembly: AssemblyTitle("BitcoinLib")] 12 | [assembly: AssemblyDescription(".Net Bitcoin, Litecoin, Dogecoin and Bitcoin-Clones Library & RPC Wrapper in C#")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("George Kimionis")] 15 | [assembly: AssemblyProduct("BitcoinLib")] 16 | [assembly: AssemblyCopyright("Copyright © 2014")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | 24 | [assembly: ComVisible(false)] 25 | 26 | // The following GUID is for the ID of the typelib if this project is exposed to COM 27 | 28 | [assembly: Guid("f97fb4aa-905c-4825-8a6b-95f84d4ad321")] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | // You can specify all the values or you can default the Build and Revision Numbers 38 | // by using the '*' as shown below: 39 | // [assembly: AssemblyVersion("1.0.*")] 40 | 41 | [assembly: AssemblyVersion("1.3.3.0")] 42 | [assembly: AssemblyFileVersion("1.3.3.0")] -------------------------------------------------------------------------------- /BitcoinLib/RPC/Connector/IRpcConnector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.RPC.Specifications; 5 | 6 | namespace BitcoinLib.RPC.Connector 7 | { 8 | public interface IRpcConnector 9 | { 10 | T MakeRequest(RpcMethods method, params object[] parameters); 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/RPC/Connector/RawRpcConnector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System; 5 | using System.IO; 6 | using System.Net; 7 | using System.Text; 8 | using BitcoinLib.Services.Coins.Base; 9 | 10 | namespace BitcoinLib.RPC.Connector 11 | { 12 | // This class is disconnected from the core logic and its sole purpose is to serve as a quick and dirty means of debugging 13 | public static class RawRpcConnector 14 | { 15 | // Usage example: String networkDifficultyJsonResult = RawRpcConnector.MakeRequest("{\"method\":\"getdifficulty\",\"params\":[],\"id\":1}", "http://127.0.0.1:8332/", "MyRpcUsername", "MyRpcPassword"); 16 | public static string MakeRequest(string jsonRequest, string daemonUrl, string rpcUsername, string rpcPassword) 17 | { 18 | try 19 | { 20 | var tempCookies = new CookieContainer(); 21 | var encoding = new ASCIIEncoding(); 22 | var byteData = encoding.GetBytes(jsonRequest); 23 | var postReq = (HttpWebRequest) WebRequest.Create(daemonUrl); 24 | postReq.Credentials = new NetworkCredential(rpcUsername, rpcPassword); 25 | postReq.Method = "POST"; 26 | postReq.KeepAlive = true; 27 | postReq.CookieContainer = tempCookies; 28 | postReq.ContentType = "application/json"; 29 | postReq.ContentLength = byteData.Length; 30 | var postreqstream = postReq.GetRequestStream(); 31 | postreqstream.Write(byteData, 0, byteData.Length); 32 | postreqstream.Close(); 33 | var postresponse = (HttpWebResponse) postReq.GetResponse(); 34 | var postreqreader = new StreamReader(postresponse.GetResponseStream()); 35 | return postreqreader.ReadToEnd(); 36 | } 37 | catch (Exception exception) 38 | { 39 | return exception.ToString(); 40 | } 41 | } 42 | 43 | // Usage example: String networkDifficultyJsonResult = RawRpcConnector.MakeRequest("{\"method\":\"getdifficulty\",\"params\":[],\"id\":1}", new BitcoinService()); 44 | public static string MakeRequest(string jsonRequest, ICoinService coinService) 45 | { 46 | return MakeRequest(jsonRequest, coinService.Parameters.SelectedDaemonUrl, coinService.Parameters.RpcUsername, coinService.Parameters.RpcPassword); 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /BitcoinLib/RPC/RequestResponse/JsonRpcError.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.RPC.Specifications; 5 | using Newtonsoft.Json; 6 | 7 | namespace BitcoinLib.RPC.RequestResponse 8 | { 9 | public class JsonRpcError 10 | { 11 | [JsonProperty(PropertyName = "code")] 12 | public RpcErrorCode Code { get; set; } 13 | 14 | [JsonProperty(PropertyName = "message")] 15 | public string Message { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /BitcoinLib/RPC/RequestResponse/JsonRpcRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using Newtonsoft.Json; 8 | 9 | namespace BitcoinLib.RPC.RequestResponse 10 | { 11 | public class JsonRpcRequest 12 | { 13 | public JsonRpcRequest(int id, string method, params object[] parameters) 14 | { 15 | Id = id; 16 | Method = method; 17 | Parameters = parameters?.ToList() ?? new List(); 18 | } 19 | 20 | [JsonProperty(PropertyName = "method", Order = 0)] 21 | public string Method { get; set; } 22 | 23 | [JsonProperty(PropertyName = "params", Order = 1)] 24 | public IList Parameters { get; set; } 25 | 26 | [JsonProperty(PropertyName = "id", Order = 2)] 27 | public int Id { get; set; } 28 | 29 | public byte[] GetBytes() 30 | { 31 | var json = JsonConvert.SerializeObject(this); 32 | return Encoding.UTF8.GetBytes(json); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /BitcoinLib/RPC/RequestResponse/JsonRpcResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace BitcoinLib.RPC.RequestResponse 7 | { 8 | public class JsonRpcResponse 9 | { 10 | [JsonProperty(PropertyName = "result", Order = 0)] 11 | public T Result { get; set; } 12 | 13 | [JsonProperty(PropertyName = "id", Order = 1)] 14 | public int Id { get; set; } 15 | 16 | [JsonProperty(PropertyName = "error", Order = 2)] 17 | public JsonRpcError Error { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /BitcoinLib/RPC/Specifications/RpcErrorCode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.RPC.Specifications 5 | { 6 | // As of: https://github.com/bitcoin/bitcoin/blob/master/src/rpcprotocol.h 7 | // Note: Do not alter enum members' capitalization 8 | // Note: It's alright if the enum is not complete (for altcoins etc), the plain rpc error code number will be used instead in RpcInternalServerErrorException() 9 | public enum RpcErrorCode 10 | { 11 | //! Standard JSON-RPC 2.0 errors 12 | RPC_INVALID_REQUEST = -32600, 13 | RPC_METHOD_NOT_FOUND = -32601, 14 | RPC_INVALID_PARAMS = -32602, 15 | RPC_INTERNAL_ERROR = -32603, 16 | RPC_PARSE_ERROR = -32700, 17 | 18 | //! General application defined errors 19 | RPC_MISC_ERROR = -1, //! std::exception thrown in command handling 20 | RPC_FORBIDDEN_BY_SAFE_MODE = -2, //! Server is in safe mode, and command is not allowed in safe mode 21 | RPC_TYPE_ERROR = -3, //! Unexpected type was passed as parameter 22 | RPC_INVALID_ADDRESS_OR_KEY = -5, //! Invalid address or key 23 | RPC_OUT_OF_MEMORY = -7, //! Ran out of memory during operation 24 | RPC_INVALID_PARAMETER = -8, //! Invalid, missing or duplicate parameter 25 | RPC_DATABASE_ERROR = -20, //! Database error 26 | RPC_DESERIALIZATION_ERROR = -22, //! Error parsing or validating structure in raw format 27 | RPC_VERIFY_ERROR = -25, //! General error during transaction or block submission 28 | RPC_VERIFY_REJECTED = -26, //! Transaction or block was rejected by network rules 29 | RPC_VERIFY_ALREADY_IN_CHAIN = -27, //! Transaction already in chain 30 | RPC_IN_WARMUP = -28, //! Client still warming up 31 | 32 | //! Aliases for backward compatibility 33 | RPC_TRANSACTION_ERROR = RPC_VERIFY_ERROR, 34 | RPC_TRANSACTION_REJECTED = RPC_VERIFY_REJECTED, 35 | RPC_TRANSACTION_ALREADY_IN_CHAIN = RPC_VERIFY_ALREADY_IN_CHAIN, 36 | 37 | //! P2P client errors 38 | RPC_CLIENT_NOT_CONNECTED = -9, //! Bitcoin is not connected 39 | RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, //! Still downloading initial blocks 40 | RPC_CLIENT_NODE_ALREADY_ADDED = -23, //! Node is already added 41 | RPC_CLIENT_NODE_NOT_ADDED = -24, //! Node has not been added before 42 | 43 | //! Wallet errors 44 | RPC_WALLET_ERROR = -4, //! Unspecified problem with wallet (key not found etc.) 45 | RPC_WALLET_INSUFFICIENT_FUNDS = -6, //! Not enough funds in wallet or account 46 | RPC_WALLET_INVALID_ACCOUNT_NAME = -11, //! Invalid account name 47 | RPC_WALLET_KEYPOOL_RAN_OUT = -12, //! Keypool ran out, call keypoolrefill first 48 | RPC_WALLET_UNLOCK_NEEDED = -13, //! Enter the wallet passphrase with walletpassphrase first 49 | RPC_WALLET_PASSPHRASE_INCORRECT = -14, //! The wallet passphrase entered was incorrect 50 | RPC_WALLET_WRONG_ENC_STATE = -15, //! Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.) 51 | RPC_WALLET_ENCRYPTION_FAILED = -16, //! Failed to encrypt the wallet 52 | RPC_WALLET_ALREADY_UNLOCKED = -17, //! Wallet is already unlocked 53 | } 54 | } -------------------------------------------------------------------------------- /BitcoinLib/RPC/Specifications/RpcMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.RPC.Specifications 5 | { 6 | // Note: Do not alter the capitalization of the enum members as they are being cast as-is to the RPC server 7 | public enum RpcMethods 8 | { 9 | //== Blockchain == 10 | getbestblockhash, 11 | getblock, 12 | getblockchaininfo, 13 | getblockcount, 14 | getblockhash, 15 | getblockheader, 16 | getchaintips, 17 | getdifficulty, 18 | getmempoolinfo, 19 | getrawmempool, 20 | gettxout, 21 | gettxoutproof, 22 | gettxoutsetinfo, 23 | verifychain, 24 | verifytxoutproof, 25 | 26 | //== Control == 27 | getinfo, 28 | help, 29 | stop, 30 | 31 | //== Generating == 32 | generate, 33 | getgenerate, 34 | setgenerate, 35 | 36 | //== Mining == 37 | getblocktemplate, 38 | getmininginfo, 39 | getnetworkhashps, 40 | prioritisetransaction, 41 | submitblock, 42 | 43 | //== Network == 44 | addnode, 45 | clearbanned, 46 | disconnectnode, 47 | getaddednodeinfo, 48 | getconnectioncount, 49 | getnettotals, 50 | getnetworkinfo, 51 | getpeerinfo, 52 | listbanned, 53 | ping, 54 | setban, 55 | 56 | //== Rawtransactions == 57 | createrawtransaction, 58 | decoderawtransaction, 59 | decodescript, 60 | fundrawtransaction, 61 | getrawtransaction, 62 | sendrawtransaction, 63 | signrawtransaction, 64 | sighashtype, 65 | 66 | //== Util == 67 | createmultisig, 68 | estimatefee, 69 | estimatepriority, 70 | estimatesmartfee, 71 | estimatesmartpriority, 72 | validateaddress, 73 | verifymessage, 74 | 75 | //== Wallet == 76 | abandontransaction, 77 | addmultisigaddress, 78 | backupwallet, 79 | dumpprivkey, 80 | dumpwallet, 81 | getaccount, 82 | getaccountaddress, 83 | getaddressesbyaccount, 84 | getbalance, 85 | getnewaddress, 86 | getrawchangeaddress, 87 | getreceivedbyaccount, 88 | getreceivedbyaddress, 89 | gettransaction, 90 | getunconfirmedbalance, 91 | getwalletinfo, 92 | importaddress, 93 | importprivkey, 94 | importpubkey, 95 | importwallet, 96 | keypoolrefill, 97 | listaccounts, 98 | listaddressgroupings, 99 | listlockunspent, 100 | listreceivedbyaccount, 101 | listreceivedbyaddress, 102 | listsinceblock, 103 | listtransactions, 104 | listunspent, 105 | lockunspent, 106 | move, 107 | sendfrom, 108 | sendmany, 109 | sendtoaddress, 110 | setaccount, 111 | settxfee, 112 | signmessage, 113 | walletlock, 114 | walletpassphrase, 115 | walletpassphrasechange, 116 | 117 | //2017-09-18: added segwit support 118 | addwitnessaddress, 119 | //2018-01-20: added Dash privatesend mixing support 120 | privatesend, 121 | //2018-03-02: added getaddressbalance (needs addressindex = 1 in dash.conf) 122 | getaddressbalance 123 | } 124 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/AddNode/NodeAction.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Requests.AddNode 5 | { 6 | // Note: Do not alter the capitalization of the enum members as they are being cast as-is to the RPC server 7 | public enum NodeAction 8 | { 9 | add, 10 | remove, 11 | onetry 12 | } 13 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/CreateRawTransaction/CreateRawTransactionInput.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace BitcoinLib.Requests.CreateRawTransaction 7 | { 8 | public class CreateRawTransactionInput 9 | { 10 | [JsonProperty("txid")] 11 | public string TxId { get; set; } 12 | 13 | [JsonProperty("vout")] 14 | public int Vout { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/CreateRawTransaction/CreateRawTransactionOutput.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Requests.CreateRawTransaction 5 | { 6 | public class CreateRawTransactionOutput 7 | { 8 | public string Address { get; set; } 9 | public decimal Amount { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/CreateRawTransaction/CreateRawTransactionRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace BitcoinLib.Requests.CreateRawTransaction 8 | { 9 | public class CreateRawTransactionRequest 10 | { 11 | public CreateRawTransactionRequest() 12 | { 13 | Inputs = new List(); 14 | Outputs = new Dictionary(); 15 | } 16 | 17 | public CreateRawTransactionRequest(IList inputs, IDictionary outputs) : this() 18 | { 19 | Inputs = inputs; 20 | Outputs = outputs; 21 | } 22 | 23 | public IList Inputs { get; } 24 | public IDictionary Outputs { get; } 25 | 26 | public void AddInput(CreateRawTransactionInput input) 27 | { 28 | Inputs.Add(input); 29 | } 30 | 31 | public void AddOutput(CreateRawTransactionOutput output) 32 | { 33 | Outputs.Add(output.Address, output.Amount); 34 | } 35 | 36 | public void AddInput(string txId, int vout) 37 | { 38 | Inputs.Add(new CreateRawTransactionInput 39 | { 40 | TxId = txId, 41 | Vout = vout 42 | }); 43 | } 44 | 45 | public void AddOutput(string address, decimal amount) 46 | { 47 | Outputs.Add(address, amount); 48 | } 49 | 50 | public bool RemoveInput(CreateRawTransactionInput input) 51 | { 52 | return Inputs.Contains(input) && Inputs.Remove(input); 53 | } 54 | 55 | public bool RemoveOutput(CreateRawTransactionOutput output) 56 | { 57 | return RemoveOutput(output.Address, output.Amount); 58 | } 59 | 60 | public bool RemoveInput(string txId, int vout) 61 | { 62 | var input = Inputs.FirstOrDefault(x => x.TxId == txId && x.Vout == vout); 63 | return input != null && Inputs.Remove(input); 64 | } 65 | 66 | public bool RemoveOutput(string address, decimal amount) 67 | { 68 | var outputToBeRemoved = new KeyValuePair(address, amount); 69 | return Outputs.Contains>(outputToBeRemoved) && Outputs.Remove(outputToBeRemoved); 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/SignRawTransaction/SigHashType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Requests.SignRawTransaction 5 | { 6 | public static class SigHashType 7 | { 8 | public const string All = "ALL"; 9 | public const string None = "NONE"; 10 | public const string Single = "SINGLE"; 11 | public const string AllAnyoneCanPay = "ALL|ANYONECANPAY"; 12 | public const string NoneAnyoneCanPay = "NONE|ANYONECANPAY"; 13 | public const string SingleAnyoneCanPay = "SINGLE|ANYONECANPAY"; 14 | } 15 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/SignRawTransaction/SignRawTransactionInput.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace BitcoinLib.Requests.SignRawTransaction 7 | { 8 | public class SignRawTransactionInput 9 | { 10 | [JsonProperty(PropertyName = "txid", Order = 0)] 11 | public string TxId { get; set; } 12 | 13 | [JsonProperty(PropertyName = "vout", Order = 1)] 14 | public int Vout { get; set; } 15 | 16 | [JsonProperty(PropertyName = "scriptPubKey", Order = 2)] 17 | public string ScriptPubKey { get; set; } 18 | 19 | [JsonProperty(PropertyName = "redeemScript", Order = 3)] 20 | public string RedeemScript { get; set; } 21 | } 22 | } -------------------------------------------------------------------------------- /BitcoinLib/Requests/SignRawTransaction/SignRawTransactionRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Requests.SignRawTransaction 7 | { 8 | public class SignRawTransactionRequest 9 | { 10 | public SignRawTransactionRequest(string rawTransactionHex) 11 | { 12 | RawTransactionHex = rawTransactionHex; 13 | Inputs = new List(); 14 | PrivateKeys = new List(); 15 | SigHashType = SignRawTransaction.SigHashType.All; 16 | } 17 | 18 | public string RawTransactionHex { get; set; } 19 | public List Inputs { get; set; } 20 | public List PrivateKeys { get; set; } 21 | public string SigHashType { get; set; } 22 | 23 | public void AddInput(string txId, int vout, string scriptPubKey, string redeemScript) 24 | { 25 | Inputs.Add(new SignRawTransactionInput 26 | { 27 | TxId = txId, 28 | Vout = vout, 29 | ScriptPubKey = scriptPubKey, 30 | RedeemScript = redeemScript 31 | }); 32 | } 33 | 34 | public void AddInput(SignRawTransactionInput signRawTransactionInput) 35 | { 36 | Inputs.Add(signRawTransactionInput); 37 | } 38 | 39 | public void AddKey(string privateKey) 40 | { 41 | PrivateKeys.Add(privateKey); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/Bridges/ITransactionResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses.Bridges 5 | { 6 | // Note: This serves as a common interface for the cases that a strongly-typed response is required while it is not yet clear whether the transaction in question is in-wallet or not 7 | // A practical example is the bridging of GetTransaction(), DecodeRawTransaction() and GetRawTransaction() 8 | public interface ITransactionResponse 9 | { 10 | string TxId { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/CreateMultiSigResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class CreateMultiSigResponse 7 | { 8 | public string Address { get; set; } 9 | public string RedeemScript { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/DecodeRawTransactionResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using BitcoinLib.Responses.Bridges; 6 | using BitcoinLib.Responses.SharedComponents; 7 | 8 | namespace BitcoinLib.Responses 9 | { 10 | public class DecodeRawTransactionResponse : ITransactionResponse 11 | { 12 | public string Version { get; set; } 13 | public string LockTime { get; set; } 14 | public List Vin { get; set; } 15 | public List Vout { get; set; } 16 | public string TxId { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/DecodeScriptResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class DecodeScriptResponse 7 | { 8 | public string Asm { get; set; } 9 | public string P2SH { get; set; } 10 | public string Type { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetAddedNodeInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetAddedNodeInfoResponse 9 | { 10 | public string AddedNode { get; set; } 11 | public bool Connected { get; set; } 12 | public List Addresses { get; set; } 13 | } 14 | 15 | public class NodeAddress 16 | { 17 | public string Address { get; set; } 18 | public bool Connected { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetBlockResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetBlockResponse 9 | { 10 | public GetBlockResponse() 11 | { 12 | Tx = new List(); 13 | } 14 | 15 | public List Tx { get; set; } 16 | public string Hash { get; set; } 17 | public int Confirmations { get; set; } 18 | public int Size { get; set; } 19 | public int Height { get; set; } 20 | public int Version { get; set; } 21 | public string MerkleRoot { get; set; } 22 | public double Difficulty { get; set; } 23 | public string ChainWork { get; set; } 24 | public string PreviousBlockHash { get; set; } 25 | public string NextBlockHash { get; set; } 26 | public string Bits { get; set; } 27 | public int Time { get; set; } 28 | public string Nonce { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetBlockTemplateResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetBlockTemplateResponse 9 | { 10 | public int Version { get; set; } 11 | public string PreviousBlockHash { get; set; } 12 | public List Transactions { get; set; } 13 | public GetBlockTemplateCoinbaseAux CoinbaseAux { get; set; } 14 | public long CoinbaseValue { get; set; } 15 | public string Target { get; set; } 16 | public int MinTime { get; set; } 17 | public List Mutable { get; set; } 18 | public string NonceRange { get; set; } 19 | public int SigopLimit { get; set; } 20 | public int SizeLimit { get; set; } 21 | public uint CurTime { get; set; } 22 | public string Bits { get; set; } 23 | public int Height { get; set; } 24 | } 25 | 26 | public class GetBlockTemplateCoinbaseAux 27 | { 28 | public string Flags { get; set; } 29 | } 30 | 31 | public class GetBlockTemplateTransaction 32 | { 33 | public string Data { get; set; } 34 | public string Hash { get; set; } 35 | public List Depends { get; set; } 36 | public int Fee { get; set; } 37 | public int Sigops { get; set; } 38 | } 39 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetBlockchainInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class GetBlockchainInfoResponse 7 | { 8 | public string Chain { get; set; } 9 | public ulong Blocks { get; set; } 10 | public ulong Headers { get; set; } 11 | public string BestBlockHash { get; set; } 12 | public double Difficulty { get; set; } 13 | public double VerificationProgress { get; set; } 14 | public string ChainWork { get; set; } 15 | public bool Pruned { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetChainTipsResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class GetChainTipsResponse 7 | { 8 | public uint Height { get; set; } 9 | public string Hash { get; set; } 10 | public int BranchLen { get; set; } 11 | public string Status { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetInfoResponse 9 | { 10 | public string Version { get; set; } 11 | public string ProtocolVersion { get; set; } 12 | public string WalletVersion { get; set; } 13 | public decimal Balance { get; set; } 14 | public double Blocks { get; set; } 15 | public double TimeOffset { get; set; } 16 | public double Connections { get; set; } 17 | public string Proxy { get; set; } 18 | public double Difficulty { get; set; } 19 | public bool Testnet { get; set; } 20 | public double KeyPoolEldest { get; set; } 21 | public double KeyPoolSize { get; set; } 22 | 23 | [JsonProperty("unlocked_until")] 24 | public ulong UnlockedUntil { get; set; } 25 | 26 | public decimal PayTxFee { get; set; } 27 | public decimal RelayTxFee { get; set; } 28 | public string Errors { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetMemPoolInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class GetMemPoolInfoResponse 7 | { 8 | public uint Size { get; set; } 9 | public ulong Bytes { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetMiningInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class GetMiningInfoResponse 7 | { 8 | public int Blocks { get; set; } 9 | public int CurrentBockSize { get; set; } 10 | public int CurrentBlockTx { get; set; } 11 | public double Difficulty { get; set; } 12 | public string Errors { get; set; } 13 | public int GenProcLimit { get; set; } 14 | public long NetworkHashPS { get; set; } 15 | public int PooledTx { get; set; } 16 | public bool Testnet { get; set; } 17 | public string Chain { get; set; } 18 | public bool Generate { get; set; } 19 | public long HashesPerSec { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetNetTotalsResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class GetNetTotalsResponse 7 | { 8 | public ulong TotalBytesRecv { get; set; } 9 | public ulong TotalBytesSent { get; set; } 10 | public ulong TimeMillis { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetNetworkInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetNetworkInfoResponse 9 | { 10 | public uint Version { get; set; } 11 | public string Subversion { get; set; } 12 | public uint ProtocolVersion { get; set; } 13 | public string LocalServices { get; set; } 14 | public int TimeOffset { get; set; } 15 | public uint Connections { get; set; } 16 | public IList Networks { get; set; } 17 | public decimal RelayFee { get; set; } 18 | public IList LocalAddresses { get; set; } 19 | } 20 | 21 | public class LocalAddress 22 | { 23 | public string Address { get; set; } 24 | public ushort Port { get; set; } 25 | public int Score { get; set; } 26 | } 27 | 28 | public class Network 29 | { 30 | public string Name { get; set; } 31 | public bool Limited { get; set; } 32 | public bool Reachable { get; set; } 33 | public string Proxy { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetPeerInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using Newtonsoft.Json; 6 | 7 | namespace BitcoinLib.Responses 8 | { 9 | public class GetPeerInfoResponse 10 | { 11 | public uint Id { get; set; } 12 | public string Addr { get; set; } 13 | public string AddrLocal { get; set; } 14 | public string Services { get; set; } 15 | public int LastSend { get; set; } 16 | public int LastRecv { get; set; } 17 | public int BytesSent { get; set; } 18 | public int BytesRecv { get; set; } 19 | public int ConnTime { get; set; } 20 | public double PingTime { get; set; } 21 | public double Version { get; set; } 22 | public string SubVer { get; set; } 23 | public bool Inbound { get; set; } 24 | public int StartingHeight { get; set; } 25 | public int BanScore { get; set; } 26 | 27 | [JsonProperty("synced_headers")] 28 | public int SyncedHeaders { get; set; } 29 | 30 | [JsonProperty("synced_blocks")] 31 | public int SyncedBlocks { get; set; } 32 | 33 | public IList InFlight { get; set; } 34 | public bool WhiteListed { get; set; } 35 | } 36 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetRawMemPoolResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetRawMemPoolResponse 9 | { 10 | public GetRawMemPoolResponse() 11 | { 12 | TxIds = new List(); 13 | VerboseResponses = new List(); 14 | } 15 | 16 | public IList TxIds { get; set; } 17 | public bool IsVerbose { get; set; } 18 | public IList VerboseResponses { get; set; } 19 | } 20 | 21 | public class GetRawMemPoolVerboseResponse 22 | { 23 | public GetRawMemPoolVerboseResponse() 24 | { 25 | Depends = new List(); 26 | } 27 | 28 | public string TxId { get; set; } 29 | public int? Size { get; set; } 30 | public decimal? Fee { get; set; } 31 | public int? Time { get; set; } 32 | public int? Height { get; set; } 33 | public double? StartingPriority { get; set; } 34 | public double? CurrentPriority { get; set; } 35 | public IList Depends { get; set; } 36 | } 37 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetRawTransactionResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using BitcoinLib.Responses.Bridges; 6 | using BitcoinLib.Responses.SharedComponents; 7 | 8 | namespace BitcoinLib.Responses 9 | { 10 | public class GetRawTransactionResponse : ITransactionResponse 11 | { 12 | public string Hex { get; set; } 13 | public long Version { get; set; } 14 | public uint LockTime { get; set; } 15 | public List Vin { get; set; } 16 | public List Vout { get; set; } 17 | public string BlockHash { get; set; } 18 | public int Confirmations { get; set; } 19 | public uint Time { get; set; } 20 | public uint BlockTime { get; set; } 21 | public string TxId { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetTransactionResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using BitcoinLib.Responses.Bridges; 6 | 7 | namespace BitcoinLib.Responses 8 | { 9 | // Note: Local wallet transactions only 10 | public class GetTransactionResponse : ITransactionResponse 11 | { 12 | public decimal Amount { get; set; } 13 | public decimal Fee { get; set; } 14 | public string BlockHash { get; set; } 15 | public int BlockIndex { get; set; } 16 | public int BlockTime { get; set; } 17 | public int Confirmations { get; set; } 18 | public List Details { get; set; } 19 | public string Hex { get; set; } 20 | public int Time { get; set; } 21 | public int TimeReceived { get; set; } 22 | public List WalletConflicts { get; set; } 23 | public string TxId { get; set; } 24 | } 25 | 26 | public class GetTransactionResponseDetails 27 | { 28 | public string Account { get; set; } 29 | public string Address { get; set; } 30 | public decimal Amount { get; set; } 31 | public decimal Fee { get; set; } 32 | public int Vout { get; set; } 33 | public string Category { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetTxOutSetInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class GetTxOutSetInfoResponse 7 | { 8 | public int Height { get; set; } 9 | public string BestBlock { get; set; } 10 | public int Transactions { get; set; } 11 | public int TxOuts { get; set; } 12 | public int BytesSerialized { get; set; } 13 | public string HashSerialized { get; set; } 14 | public double TotalAmount { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/GetWalletInfoResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class GetWalletInfoResponse 9 | { 10 | public string WalletVersion { get; set; } 11 | public decimal Balance { get; set; } 12 | 13 | [JsonProperty("unconfirmed_balance")] 14 | public decimal UnconfirmedBalance { get; set; } 15 | 16 | [JsonProperty("immature_balance")] 17 | public decimal ImmatureBalance { get; set; } 18 | 19 | public ulong TxCount { get; set; } 20 | public double KeyPoolOldest { get; set; } 21 | 22 | [JsonProperty("unlocked_until")] 23 | public ulong UnlockedUntil { get; set; } 24 | 25 | public ulong KeyPoolSize { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ListAddressGroupingsResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class ListAddressGroupingsResponse 7 | { 8 | public string Address { get; set; } 9 | public decimal Balance { get; set; } 10 | public string Account { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ListReceivedByAccountResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class ListReceivedByAccountResponse 7 | { 8 | public string Account { get; set; } 9 | public double Amount { get; set; } 10 | public int Confirmations { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ListReceivedByAddressResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class ListReceivedByAddressResponse 9 | { 10 | public string Account { get; set; } 11 | public string Address { get; set; } 12 | public decimal Amount { get; set; } 13 | public int Confirmations { get; set; } 14 | public List TxIds { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ListSinceBlockResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class ListSinceBlockResponse 9 | { 10 | public List Transactions { get; set; } 11 | public string Lastblock { get; set; } 12 | } 13 | 14 | public class TransactionSinceBlock 15 | { 16 | public string Account { get; set; } 17 | public string Address { get; set; } 18 | public string Category { get; set; } 19 | public decimal Amount { get; set; } 20 | public int Vout { get; set; } 21 | public decimal Fee { get; set; } 22 | public int Confirmations { get; set; } 23 | public string BlockHash { get; set; } 24 | public long BlockIndex { get; set; } 25 | public int BlockTime { get; set; } 26 | public string TxId { get; set; } 27 | public List WalletConflicts { get; set; } 28 | public int Time { get; set; } 29 | public int TimeReceived { get; set; } 30 | public string Comment { get; set; } 31 | public string To { get; set; } 32 | public bool InvolvesWatchonly { get; set; } 33 | } 34 | 35 | // Note: Do not alter the capitalization of the enum members 36 | public enum TransactionSinceBlockCategory 37 | { 38 | send, 39 | receive, 40 | generate, 41 | immature 42 | } 43 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ListTransactionsResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses 7 | { 8 | public class ListTransactionsResponse 9 | { 10 | public string Account { get; set; } 11 | public string Address { get; set; } 12 | public string Category { get; set; } 13 | public decimal Amount { get; set; } 14 | public int Vout { get; set; } 15 | public decimal Fee { get; set; } 16 | public int Confirmations { get; set; } 17 | public string BlockHash { get; set; } 18 | public double BlockIndex { get; set; } 19 | public double BlockTime { get; set; } 20 | public string TxId { get; set; } 21 | public List WalletConflicts { get; set; } 22 | public double Time { get; set; } 23 | public double TimeReceived { get; set; } 24 | public string Comment { get; set; } 25 | public string OtherAccount { get; set; } 26 | public bool InvolvesWatchonly { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ListUnspentResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class ListUnspentResponse 7 | { 8 | public string TxId { get; set; } 9 | public int Vout { get; set; } 10 | public string Address { get; set; } 11 | public string Account { get; set; } 12 | public string ScriptPubKey { get; set; } 13 | public decimal Amount { get; set; } 14 | public int Confirmations { get; set; } 15 | public bool Spendable { get; set; } 16 | 17 | public override string ToString() 18 | { 19 | return $"Account: {Account}, Address: {Address}, Amount: {Amount}, Confirmations: {Confirmations}"; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/SharedComponents/Vin.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses.SharedComponents 5 | { 6 | public class Vin 7 | { 8 | public string TxId { get; set; } 9 | public string Vout { get; set; } 10 | public ScriptSig ScriptSig { get; set; } 11 | public string CoinBase { get; set; } 12 | public string Sequence { get; set; } 13 | } 14 | 15 | public class ScriptSig 16 | { 17 | public string Asm { get; set; } 18 | public string Hex { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/SharedComponents/Vout.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace BitcoinLib.Responses.SharedComponents 7 | { 8 | public class Vout 9 | { 10 | public decimal Value { get; set; } 11 | public int N { get; set; } 12 | public ScriptPubKey ScriptPubKey { get; set; } 13 | } 14 | 15 | public class ScriptPubKey 16 | { 17 | public string Asm { get; set; } 18 | public string Hex { get; set; } 19 | public int ReqSigs { get; set; } 20 | public string Type { get; set; } 21 | public List Addresses { get; set; } 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/SignRawTransactionResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class SignRawTransactionResponse 7 | { 8 | public string Hex { get; set; } 9 | public bool Complete { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Responses/ValidateAddressResponse.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Responses 5 | { 6 | public class ValidateAddressResponse 7 | { 8 | public bool IsValid { get; set; } 9 | public string Address { get; set; } 10 | public bool IsMine { get; set; } 11 | public bool IsScript { get; set; } 12 | public string PubKey { get; set; } 13 | public bool IsCompressed { get; set; } 14 | public string Account { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Base/ICoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Base; 5 | using BitcoinLib.Services.RpcServices.RpcExtenderService; 6 | using BitcoinLib.Services.RpcServices.RpcService; 7 | 8 | namespace BitcoinLib.Services.Coins.Base 9 | { 10 | public interface ICoinService : IRpcService, IRpcExtenderService, ICoinParameters 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Bitcoin/BitcoinCashService.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.CoinParameters.Bitcoin; 2 | 3 | namespace BitcoinLib.Services.Coins.Bitcoin 4 | { 5 | public class BitcoinCashService : CoinService, IBitcoinService 6 | { 7 | public BitcoinCashService(bool useTestnet = false) : base(useTestnet) 8 | { 9 | } 10 | 11 | public BitcoinCashService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds) : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) 12 | { 13 | } 14 | 15 | public BitcoinConstants.Constants Constants => BitcoinConstants.Constants.Instance; 16 | } 17 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Bitcoin/BitcoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Bitcoin; 5 | using BitcoinLib.RPC.Specifications; 6 | 7 | namespace BitcoinLib.Services.Coins.Bitcoin 8 | { 9 | public class BitcoinService : CoinService, IBitcoinService 10 | { 11 | public BitcoinService(bool useTestnet = false) : base(useTestnet) 12 | { 13 | } 14 | 15 | public BitcoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword) 16 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) 17 | { 18 | } 19 | 20 | public BitcoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds) 21 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) 22 | { 23 | } 24 | 25 | public BitcoinConstants.Constants Constants => BitcoinConstants.Constants.Instance; 26 | 27 | 28 | public string SendToAddress(string bitcoinAddress, decimal amount, string comment, string commentTo, bool subtractFeeFromAmount, bool allowReplaceByFee) 29 | { 30 | return _rpcConnector.MakeRequest(RpcMethods.sendtoaddress, bitcoinAddress, amount, comment, commentTo, subtractFeeFromAmount, allowReplaceByFee); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Bitcoin/IBitcoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Bitcoin; 5 | using BitcoinLib.Services.Coins.Base; 6 | 7 | namespace BitcoinLib.Services.Coins.Bitcoin 8 | { 9 | public interface IBitcoinService : ICoinService, IBitcoinConstants 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Cryptocoin/CryptocoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Services.Coins.Cryptocoin 5 | { 6 | public class CryptocoinService : CoinService, ICryptocoinService 7 | { 8 | public CryptocoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword) 9 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) 10 | { 11 | } 12 | 13 | public CryptocoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds) 14 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) 15 | { 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Cryptocoin/ICryptocoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.Services.Coins.Base; 5 | 6 | namespace BitcoinLib.Services.Coins.Cryptocoin 7 | { 8 | public interface ICryptocoinService : ICoinService 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/AddressBalanceRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Newtonsoft.Json; 3 | 4 | namespace BitcoinLib.Services.Coins.Dash 5 | { 6 | public class AddressBalanceRequest 7 | { 8 | [JsonProperty("addresses")] 9 | public List Addresses { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/AddressBalanceResponse.cs: -------------------------------------------------------------------------------- 1 | namespace BitcoinLib.Services.Coins.Dash 2 | { 3 | public class AddressBalanceResponse 4 | { 5 | public long Balance { get; set; } 6 | public long Received { get; set; } 7 | } 8 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/DashService.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using BitcoinLib.CoinParameters.Dash; 4 | using BitcoinLib.Requests.SignRawTransaction; 5 | using BitcoinLib.RPC.Specifications; 6 | using BitcoinLib.Services.Coins.Bitcoin; 7 | 8 | namespace BitcoinLib.Services.Coins.Dash 9 | { 10 | /// 11 | /// Mostly the same functionality as , just adds a bunch more features 12 | /// for handling InstantSend and PrivateSend, plus better raw tx generation support. 13 | /// 14 | public class DashService : CoinService, IDashService 15 | { 16 | public DashService(bool useTestnet = false) : base(useTestnet) { } 17 | 18 | public DashService(string daemonUrl, string rpcUsername, string rpcPassword, 19 | string walletPassword) : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) { } 20 | 21 | public DashService(string daemonUrl, string rpcUsername, string rpcPassword, 22 | string walletPassword, short rpcRequestTimeoutInSeconds) : base(daemonUrl, rpcUsername, 23 | rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) { } 24 | 25 | /// 26 | /// Adds InstantSend and PrivateSend to SendToAddress from our wallet. 27 | /// 28 | /// 29 | public string SendToAddress(string dashAddress, decimal amount, string comment = null, 30 | string commentTo = null, bool subtractFeeFromAmount = false, bool useInstantSend = false, 31 | bool usePrivateSend = false) 32 | => _rpcConnector.MakeRequest(RpcMethods.sendtoaddress, dashAddress, amount, 33 | comment, commentTo, subtractFeeFromAmount, useInstantSend, usePrivateSend); 34 | 35 | /// 36 | /// Adds InstantSend support to SendRawTransaction 37 | /// 38 | public string SendRawTransaction(string rawTransactionHexString, bool allowHighFees, 39 | bool useInstantSend) 40 | => _rpcConnector.MakeRequest(RpcMethods.sendrawtransaction, rawTransactionHexString, 41 | allowHighFees, useInstantSend); 42 | 43 | public SignRawTransactionWithErrorResponse SignRawTransactionWithErrorSupport( 44 | SignRawTransactionRequest request) 45 | { 46 | if (request.Inputs.Count == 0) 47 | request.Inputs = null; 48 | if (string.IsNullOrWhiteSpace(request.SigHashType)) 49 | request.SigHashType = "ALL"; 50 | if (request.PrivateKeys.Count == 0) 51 | request.PrivateKeys = null; 52 | return _rpcConnector.MakeRequest( 53 | RpcMethods.signrawtransaction, request.RawTransactionHex, request.Inputs, 54 | request.PrivateKeys, request.SigHashType); 55 | } 56 | 57 | /// 58 | /// privatesend "command" 59 | /// Arguments: 60 | /// 1. "command" (string or set of strings, required) The command to execute 61 | /// Available commands: 62 | /// start - Start mixing 63 | /// stop - Stop mixing 64 | /// reset - Reset mixing 65 | /// 66 | public string SendPrivateSendCommand(string command) 67 | => _rpcConnector.MakeRequest(RpcMethods.privatesend, command); 68 | 69 | public AddressBalanceResponse GetAddressBalance(AddressBalanceRequest addresses) 70 | => _rpcConnector.MakeRequest(RpcMethods.getaddressbalance, addresses); 71 | 72 | /// 73 | /// Extends unspend result to show ps_rounds to check for available mixed PrivateSend amount. 74 | /// 75 | public List ListUnspentPrivateSend() 76 | => _rpcConnector.MakeRequest>(RpcMethods.listunspent, 77 | 1, 9999999, new List()); 78 | 79 | public DashConstants.Constants Constants => DashConstants.Constants.Instance; 80 | } 81 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/IDashService.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.CoinParameters.Dash; 2 | using BitcoinLib.Services.Coins.Base; 3 | 4 | namespace BitcoinLib.Services.Coins.Dash 5 | { 6 | public interface IDashService : ICoinService, IDashConstants 7 | { 8 | /// 9 | /// Send an amount to a given address. 10 | /// 11 | /// The dash address to send to. 12 | /// The amount in DASH to send. eg 0.1. 13 | /// 14 | /// A comment used to store what the transaction is for. This is not part of the transaction, 15 | /// just kept in your wallet. 16 | /// 17 | /// 18 | /// A comment to store the name of the person or organization to which you're sending the 19 | /// transaction. This is not part of the transaction, just kept in your wallet. 20 | /// 21 | /// 22 | /// The fee will be deducted from the amount being sent. The recipient will receive 23 | /// less amount of Dash than you enter in the amount field. 24 | /// 25 | /// Send this transaction as InstantSend. 26 | /// Use anonymized funds only. 27 | /// The transaction id. 28 | string SendToAddress(string dashAddress, decimal amount, string comment = null, 29 | string commentTo = null, bool subtractFeeFromAmount = false, bool useInstantSend = false, 30 | bool usePrivateSend = false); 31 | } 32 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/ListUnspentDashResponse.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.Responses; 2 | 3 | namespace BitcoinLib.Services.Coins.Dash 4 | { 5 | public class ListUnspentDashResponse : ListUnspentResponse 6 | { 7 | public decimal Ps_Rounds { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/SignRawTransactionError.cs: -------------------------------------------------------------------------------- 1 | namespace BitcoinLib.Services.Coins.Dash 2 | { 3 | public class SignRawTransactionError 4 | { 5 | public string Txid { get; set; } 6 | public int Vout { get; set; } 7 | public string ScriptSig { get; set; } 8 | public int Sequence { get; set; } 9 | public string Error { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dash/SignRawTransactionWithErrorResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using BitcoinLib.Responses; 3 | 4 | namespace BitcoinLib.Services.Coins.Dash 5 | { 6 | public class SignRawTransactionWithErrorResponse : SignRawTransactionResponse 7 | { 8 | public List Errors { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dogecoin/DogecoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Dogecoin; 5 | 6 | namespace BitcoinLib.Services.Coins.Dogecoin 7 | { 8 | public class DogecoinService : CoinService, IDogecoinService 9 | { 10 | public DogecoinService(bool useTestnet = false) : base(useTestnet) 11 | { 12 | } 13 | 14 | public DogecoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword) 15 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) 16 | { 17 | } 18 | 19 | public DogecoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds) 20 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) 21 | { 22 | } 23 | 24 | public DogecoinConstants.Constants Constants => DogecoinConstants.Constants.Instance; 25 | } 26 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Dogecoin/IDogecoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Dogecoin; 5 | using BitcoinLib.Services.Coins.Base; 6 | 7 | namespace BitcoinLib.Services.Coins.Dogecoin 8 | { 9 | public interface IDogecoinService : ICoinService, IDogecoinConstants 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Litecoin/ILitecoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Litecoin; 5 | using BitcoinLib.Services.Coins.Base; 6 | 7 | namespace BitcoinLib.Services.Coins.Litecoin 8 | { 9 | public interface ILitecoinService : ICoinService, ILitecoinConstants 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Litecoin/LitecoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.CoinParameters.Litecoin; 5 | 6 | namespace BitcoinLib.Services.Coins.Litecoin 7 | { 8 | public class LitecoinService : CoinService, ILitecoinService 9 | { 10 | public LitecoinService(bool useTestnet = false) : base(useTestnet) 11 | { 12 | } 13 | 14 | public LitecoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword = null) 15 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) 16 | { 17 | } 18 | 19 | public LitecoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds) 20 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) 21 | { 22 | } 23 | 24 | public LitecoinConstants.Constants Constants => LitecoinConstants.Constants.Instance; 25 | } 26 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Sarcoin/ISarcoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using BitcoinLib.Services.Coins.Base; 5 | 6 | namespace BitcoinLib.Services.Coins.Sarcoin 7 | { 8 | public interface ISarcoinService : ICoinService 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/Sarcoin/SarcoinService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | namespace BitcoinLib.Services.Coins.Sarcoin 5 | { 6 | public class SarcoinService : CoinService, ISarcoinService 7 | { 8 | public SarcoinService(bool useTestnet = false) : base(useTestnet) 9 | { 10 | } 11 | 12 | public SarcoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword) 13 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) 14 | { 15 | } 16 | 17 | public SarcoinService(string daemonUrl, string rpcUsername, string rpcPassword, string walletPassword, short rpcRequestTimeoutInSeconds) 18 | : base(daemonUrl, rpcUsername, rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/XimBlock/IXimBlockService.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.CoinParameters.XimBlock; 2 | using BitcoinLib.Services.Coins.Base; 3 | 4 | namespace BitcoinLib.Services.Coins.XimBlock 5 | { 6 | public interface IXimBlockService : ICoinService, IXimBlockConstants 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/Coins/XimBlock/XimBlockService.cs: -------------------------------------------------------------------------------- 1 | using BitcoinLib.CoinParameters.XimBlock; 2 | using BitcoinLib.Services.Coins.Bitcoin; 3 | using BitcoinLib.Services.Coins.Dash; 4 | 5 | namespace BitcoinLib.Services.Coins.XimBlock 6 | { 7 | /// 8 | /// Mostly the same functionality as . 9 | /// 10 | public class XimBlockService : DashService, IXimBlockService 11 | { 12 | public XimBlockService(bool useTestnet = false) : base(useTestnet) { } 13 | 14 | public XimBlockService(string daemonUrl, string rpcUsername, string rpcPassword, 15 | string walletPassword) : base(daemonUrl, rpcUsername, rpcPassword, walletPassword) { } 16 | 17 | public XimBlockService(string daemonUrl, string rpcUsername, string rpcPassword, 18 | string walletPassword, short rpcRequestTimeoutInSeconds) : base(daemonUrl, rpcUsername, 19 | rpcPassword, walletPassword, rpcRequestTimeoutInSeconds) { } 20 | 21 | public new XimBlockConstants.Constants Constants => XimBlockConstants.Constants.Instance; 22 | } 23 | } -------------------------------------------------------------------------------- /BitcoinLib/Services/RpcServices/RpcExtenderService/IRpcExtenderService.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2014 - 2016 George Kimionis 2 | // See the accompanying file LICENSE for the Software License Aggrement 3 | 4 | using System.Collections.Generic; 5 | using BitcoinLib.Requests.CreateRawTransaction; 6 | using BitcoinLib.Responses; 7 | 8 | namespace BitcoinLib.Services.RpcServices.RpcExtenderService 9 | { 10 | public interface IRpcExtenderService 11 | { 12 | decimal GetAddressBalance(string inWalletAddress, int minConf = 0, bool validateAddressBeforeProcessing = true); 13 | decimal GetMinimumNonZeroTransactionFeeEstimate(short numberOfInputs = 1, short numberOfOutputs = 1); 14 | Dictionary GetMyPublicAndPrivateKeyPairs(); 15 | DecodeRawTransactionResponse GetPublicTransaction(string txId); 16 | decimal GetTransactionFee(CreateRawTransactionRequest createRawTransactionRequest, bool checkIfTransactionQualifiesForFreeRelay = true, bool enforceMinimumTransactionFeePolicy = true); 17 | decimal GetTransactionPriority(CreateRawTransactionRequest createRawTransactionRequest); 18 | decimal GetTransactionPriority(IList transactionInputs, int numberOfOutputs); 19 | string GetTransactionSenderAddress(string txId); 20 | int GetTransactionSizeInBytes(CreateRawTransactionRequest createRawTransactionRequest); 21 | int GetTransactionSizeInBytes(int numberOfInputs, int numberOfOutputs); 22 | GetRawTransactionResponse GetRawTxFromImmutableTxId(string rigidTxId, int listTransactionsCount = int.MaxValue, int listTransactionsFrom = 0, bool getRawTransactionVersbose = true, bool rigidTxIdIsSha256 = false); 23 | string GetImmutableTxId(string txId, bool getSha256Hash = false); 24 | bool IsInWalletTransaction(string txId); 25 | bool IsTransactionFree(CreateRawTransactionRequest createRawTransactionRequest); 26 | bool IsTransactionFree(IList transactionInputs, int numberOfOutputs, decimal minimumAmountAmongOutputs); 27 | bool IsWalletEncrypted(); 28 | } 29 | } -------------------------------------------------------------------------------- /Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Threading.Tasks; 4 | using myximblockwallet.org.Models; 5 | using Microsoft.AspNetCore.Mvc; 6 | using Newtonsoft.Json; 7 | 8 | namespace myximblockwallet.org.Controllers 9 | { 10 | public class HomeController : Controller 11 | { 12 | public HomeController(XimBlockNode node) => this.node = node; 13 | private readonly XimBlockNode node; 14 | 15 | public async Task Index() 16 | { 17 | await UpdateXimBlockPrice(); 18 | return View(); 19 | } 20 | 21 | private async Task UpdateXimBlockPrice() 22 | { 23 | var ticker = await CurrencyExtensions.GetTicker(Currency.XIM); 24 | ViewData["UsdRate"] = ticker.price_usd; 25 | ViewData["EurRate"] = ticker.price_eur; 26 | ViewData["BtcRate"] = ticker.price_btc; 27 | ViewData["XimBlock1kPrices"] = "$" + (ticker.price_usd * 1000m).ToString("#0.00") + " = €" + 28 | (ticker.price_eur * 1000m).ToString("#0.00"); 29 | ViewData["XimBlockPrices"] = "$" + ticker.price_usd.ToString("#0.00##") + " = €" + 30 | ticker.price_eur.ToString("#0.00##"); 31 | } 32 | 33 | public async Task Address() 34 | { 35 | await UpdateXimBlockPrice(); 36 | return View(); 37 | } 38 | 39 | public async Task Transaction() 40 | { 41 | await UpdateXimBlockPrice(); 42 | return View(); 43 | } 44 | 45 | public async Task About() 46 | { 47 | await UpdateXimBlockPrice(); 48 | return View(); 49 | } 50 | 51 | public async Task AboutCreateNewWallet() 52 | { 53 | await UpdateXimBlockPrice(); 54 | return View(); 55 | } 56 | 57 | public async Task AboutTransactionFees() 58 | { 59 | await UpdateXimBlockPrice(); 60 | return View(); 61 | } 62 | 63 | public async Task Error() 64 | { 65 | await UpdateXimBlockPrice(); 66 | ViewData["RequestId"] = Activity.Current?.Id ?? HttpContext.TraceIdentifier; 67 | return View(); 68 | } 69 | 70 | [HttpGet] 71 | public IActionResult GenerateRawTx(string utxos, decimal amount, string sendTo, 72 | decimal remainingAmount, string remainingAddress) 73 | { 74 | try 75 | { 76 | return Json(node.TryGenerateRawTx(utxos, amount, sendTo, remainingAmount, remainingAddress)); 77 | } 78 | catch (Exception ex) 79 | { 80 | return GetErrorResult(ex, "Failed to generate raw tx"); 81 | } 82 | } 83 | 84 | private IActionResult GetErrorResult(Exception ex, string errorMessage) 85 | { 86 | if (ex.Message == "No information available about transaction") 87 | return StatusCode(500, 88 | "Unable to generate raw tx, inputs are not found in the XIM blockchain " + 89 | "(are you on testnet or have an invalid address or transaction id?)"); 90 | if (ex.Message.Contains( 91 | "16: mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation)")) 92 | errorMessage += ": Wrong inputs were signed (used address index is already spent), " + 93 | "unable to confirm signed transaction. Double spends are not allowed!
Details"; 94 | errorMessage += ": " + 95 | #if DEBUG 96 | ex.ToString().Replace("myximblockwallet.org.Controllers.HomeController+", ""). 97 | Replace("myximblockwallet.org.Controllers.HomeController.", ""); 98 | #else 99 | ex.GetType().Name + ": " + ex.Message; 100 | #endif 101 | if (node.AdditionalErrorInformation != null) 102 | errorMessage += "

Additional Information: " + 103 | JsonConvert.SerializeObject(node.AdditionalErrorInformation); 104 | return StatusCode(500, errorMessage); 105 | } 106 | 107 | [HttpGet] 108 | public IActionResult SendSignedTx(string signedTx) 109 | { 110 | try 111 | { 112 | var txId = node.SendRawTransaction(signedTx); 113 | return Ok(txId); 114 | } 115 | catch (Exception ex) 116 | { 117 | return GetErrorResult(ex, "Failed to send signed tx"); 118 | } 119 | } 120 | } 121 | } -------------------------------------------------------------------------------- /Models/CoinMarketCapCurrencyTicker.cs: -------------------------------------------------------------------------------- 1 | namespace myximblockwallet.org.Models 2 | { 3 | /// 4 | /// Based on https://coinmarketcap.com/api/ e.g.: https://api.coinmarketcap.com/v1/ticker/bitcoin 5 | /// , 6 | /// 7 | public class CoinMarketCapCurrencyTicker 8 | { 9 | #pragma warning disable 649 10 | public string id; 11 | public string name; 12 | public string symbol; 13 | public int rank; 14 | public decimal price_usd; 15 | public decimal price_btc; 16 | public decimal price_eur; 17 | // We don't care about the rest of the fields 18 | } 19 | } -------------------------------------------------------------------------------- /Models/Currency.cs: -------------------------------------------------------------------------------- 1 | namespace myximblockwallet.org.Models 2 | { 3 | public enum Currency 4 | { 5 | // ReSharper disable InconsistentNaming 6 | mBTC = 0, 7 | mETH = 1, 8 | mLTC = 2, 9 | mDASH = 3, 10 | mBCH = 4, 11 | XIM = 5, 12 | USD, 13 | EUR 14 | } 15 | } -------------------------------------------------------------------------------- /Models/RawTxHashesAndRawTx.cs: -------------------------------------------------------------------------------- 1 | namespace myximblockwallet.org.Models 2 | { 3 | public class RawTxHashesAndRawTx 4 | { 5 | public string[] TxHashes { get; set; } 6 | public string RawTx { get; set; } 7 | public decimal UsedSendTxFee { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /Models/SigningRawTxFailed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace myximblockwallet.org.Models 4 | { 5 | public class SigningRawTxFailed : Exception 6 | { 7 | public SigningRawTxFailed(string message) : base(message) {} 8 | } 9 | } -------------------------------------------------------------------------------- /Models/TxInput.cs: -------------------------------------------------------------------------------- 1 | namespace myximblockwallet.org.Models 2 | { 3 | public class TxInput 4 | { 5 | public TxInput(string tx, int outputIndex, decimal amount) 6 | { 7 | Tx = tx; 8 | OutputIndex = outputIndex; 9 | Amount = amount; 10 | } 11 | 12 | public string Tx { get; } 13 | public int OutputIndex { get; } 14 | /// 15 | /// The amount is not needed as an input for building the raw tx, but we use it to check if 16 | /// the total amount matches (all inputs must equal all outputs+tx fee). 17 | /// 18 | public decimal Amount { get; } 19 | } 20 | } -------------------------------------------------------------------------------- /Models/TxOutput.cs: -------------------------------------------------------------------------------- 1 | namespace myximblockwallet.org.Models 2 | { 3 | public class TxOutput 4 | { 5 | public TxOutput(string address, decimal amount) 6 | { 7 | Address = address; 8 | Amount = amount; 9 | } 10 | 11 | public string Address; 12 | public decimal Amount; 13 | } 14 | } -------------------------------------------------------------------------------- /Models/XimBlockNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using BitcoinLib.Requests.CreateRawTransaction; 4 | using BitcoinLib.Requests.SignRawTransaction; 5 | using BitcoinLib.Responses; 6 | using BitcoinLib.Services.Coins.XimBlock; 7 | 8 | namespace myximblockwallet.org.Models 9 | { 10 | public class XimBlockNode 11 | { 12 | public XimBlockNode(string server = "http://localhost:42993", string user = "ytblbyousmjmidz", 13 | string password = "nbedhykaytaurclpuzgxtjhpbgbbeiv", short requestTimeoutInSeconds = 60) 14 | => service = new XimBlockService(server, user, password, password, requestTimeoutInSeconds); 15 | 16 | protected readonly XimBlockService service; 17 | public decimal GetTotalBalance() => service.GetBalance("", -1, null); 18 | 19 | public virtual RawTxHashesAndRawTx TryGenerateRawTx(string utxos, decimal amount, string sendTo, 20 | decimal remainingAmount, string remainingAddress) 21 | { 22 | AdditionalErrorInformation = null; 23 | string[] utxoParts = utxos.Split('|', StringSplitOptions.RemoveEmptyEntries); 24 | var result = new RawTxHashesAndRawTx { TxHashes = new string[utxoParts.Length / 2] }; 25 | List inputs = new List(); 26 | for (int i = 0; i < utxoParts.Length / 2; i++) 27 | { 28 | var tx = utxoParts[i * 2]; 29 | var outputIndex = int.Parse(utxoParts[i * 2 + 1]); 30 | result.TxHashes[i] = GetRawUtxo(tx); 31 | inputs.Add(new TxInput(tx, outputIndex, GetTxOutputAmount(tx, outputIndex))); 32 | } 33 | var totalInputAmount = 0m; 34 | foreach (var input in inputs) 35 | totalInputAmount += input.Amount; 36 | List outputs = new List(); 37 | // The actual used tx fee is always based on the inputs, privatesend needs to modify amounts! 38 | bool hasRemainingOutput = remainingAmount > 0; 39 | // If amount+remainingAmount is inputAmount we have no fees (zero fee is enabled) 40 | result.UsedSendTxFee = amount + remainingAmount == totalInputAmount ? 0 41 | : CalculateTxFee(inputs.Count, hasRemainingOutput ? 2 : 1); 42 | outputs.Add(new TxOutput(sendTo, amount)); 43 | if (hasRemainingOutput) 44 | outputs.Add(new TxOutput(remainingAddress, remainingAmount)); 45 | // We can only generate the raw tx if we have valid inputs (not for Trezor) 46 | if (totalInputAmount == 0m) 47 | return result; 48 | ConfirmTxInputsAndTxOutputValuesWithTxFeeMatch(inputs, outputs, result.UsedSendTxFee); 49 | result.RawTx = GenerateRawTx(inputs, outputs); 50 | return result; 51 | } 52 | 53 | public string GetRawUtxo(string tx) => service.GetRawTransaction(tx, 0).Hex; 54 | 55 | public decimal GetTxOutputAmount(string tx, int outputIndex) 56 | => service.GetRawTransaction(tx, 1).Vout[outputIndex].Value; 57 | 58 | private static void ConfirmTxInputsAndTxOutputValuesWithTxFeeMatch(List inputs, 59 | List outputs, decimal txFee) 60 | { 61 | var totalInputAmount = 0.0m; 62 | foreach (var input in inputs) 63 | totalInputAmount += input.Amount; 64 | var totalOutputAmount = 0.0m; 65 | foreach (var output in outputs) 66 | totalOutputAmount += output.Amount; 67 | if (totalInputAmount != totalOutputAmount + txFee) 68 | { 69 | // If the amount is just slightly off, fix it here by adjusting the last output (change) 70 | // This can happen because javascript is not using decimals and we might have some tiny 71 | // error beyond the 8 decimals used. Also if anything is wrong with the fee, fix it here. 72 | if (Math.Abs(totalInputAmount - (totalOutputAmount + txFee)) < 0.00024m) 73 | { 74 | if (outputs.Count == 2) 75 | outputs[1].Amount = 76 | GetCorrectDashNumberInDuffs(totalInputAmount - (txFee + outputs[0].Amount)); 77 | else 78 | // If we just have one output, spend it all 79 | outputs[0].Amount = GetCorrectDashNumberInDuffs(totalInputAmount - txFee); 80 | } 81 | else 82 | // Otherwise the problem is big, abort and report error to user 83 | throw new InputAmountsDoNotMatchOutputAmountsWithTxFee(totalInputAmount, 84 | totalOutputAmount, txFee); 85 | } 86 | } 87 | 88 | public static decimal GetCorrectDashNumberInDuffs(decimal amount) 89 | => decimal.Round(amount, 8, MidpointRounding.AwayFromZero) / 90 | 1.000000000000000000000000000000000m; 91 | 92 | private class InputAmountsDoNotMatchOutputAmountsWithTxFee : Exception 93 | { 94 | public InputAmountsDoNotMatchOutputAmountsWithTxFee(decimal totalInputAmount, 95 | decimal totalOutputAmount, decimal txFee) : base("Input amounts: " + totalInputAmount + 96 | " != Output amounts: " + GetCorrectDashNumberInDuffs(totalOutputAmount) + " + Tx fee: " + 97 | GetCorrectDashNumberInDuffs(txFee) + " (input amounts should be " + 98 | GetCorrectDashNumberInDuffs(totalOutputAmount + txFee) + ")") {} 99 | } 100 | 101 | public string GenerateRawTx(List inputs, List outputs) 102 | { 103 | var request = new CreateRawTransactionRequest(); 104 | foreach (var input in inputs) 105 | request.AddInput(input.Tx, input.OutputIndex); 106 | foreach (var output in outputs) 107 | request.AddOutput(output.Address, output.Amount); 108 | AdditionalErrorInformation = request; 109 | return service.CreateRawTransaction(request); 110 | } 111 | 112 | public object AdditionalErrorInformation { get; protected set; } 113 | 114 | public string SignRawTx(string rawTx) 115 | { 116 | var request = new SignRawTransactionRequest(rawTx); 117 | AdditionalErrorInformation = request; 118 | var result = service.SignRawTransactionWithErrorSupport(request); 119 | if (result.Complete) 120 | return result.Hex; 121 | throw new SigningRawTxFailed(result.Errors.Count > 0 ? result.Errors[0].Error : ""); 122 | } 123 | 124 | public string SendRawTransaction(string signedTx) 125 | => service.SendRawTransaction(signedTx, false); 126 | 127 | public DecodeRawTransactionResponse DecodeRawTransaction(string txHash) 128 | => service.DecodeRawTransaction(txHash); 129 | 130 | public decimal CalculateTxFee(int numberOfInputs, int numberOfOutputs) 131 | { 132 | if (numberOfInputs < 0) 133 | numberOfInputs = 1; 134 | if (numberOfOutputs < 0) 135 | numberOfOutputs = 1; 136 | return (BaseMilliFee + MilliFeePerInput * numberOfInputs + 137 | MilliFeePerOutput * numberOfOutputs) / 1000m; 138 | } 139 | 140 | protected const decimal BaseMilliFee = 0.10m; 141 | protected const decimal MilliFeePerInput = 1.48m; 142 | protected const decimal MilliFeePerOutput = 0.34m; 143 | } 144 | } -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore; 2 | using Microsoft.AspNetCore.Hosting; 3 | 4 | namespace myximblockwallet.org 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) => BuildWebHost(args).Run(); 9 | public static IWebHost BuildWebHost(string[] args) 10 | => WebHost.CreateDefaultBuilder(args).UseStartup().Build(); 11 | } 12 | } -------------------------------------------------------------------------------- /Properties/PublishProfiles/FolderProfile.pubxml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | FileSystem 9 | FileSystem 10 | Release 11 | Any CPU 12 | 13 | True 14 | False 15 | 81d2ab01-294e-4419-804c-c33f11294ac7 16 | bin\Release\netcoreapp2.0\publish\ 17 | False 18 | 19 | -------------------------------------------------------------------------------- /Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:62209/", 7 | "sslPort": 44382 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "myximblockwallet.org": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "http://localhost:62209/" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MyXimBlockWallet 2 | Web wallet for the XimBlock cryptocurrency (XIM) 3 | 4 | This project is based on MyEtherWallet and MyDashWallet, it is open-source, free to use and development was funded by XIM team :) 5 | 6 | # Runs locally 7 | You can simply download the website https://ximblockwallet.com and run it locally, the whole wallet functionality (including addresses, private keys and generating keystore wallets, unlocking, etc.) all runs offline and in your browser. However when you want to see the current XIM amount or send out XIM you need to be online as the website communicates with https://chainz.cryptoid.info for the XIM amount in your addresses and will communicate with the full XIM node on MyXimBlockWallet when sending out locally signed transactions. 8 | 9 | If you have your own full node you can simply replace it by opening up the source code and either change the connection parameters in XimBlockNode.cs or simply derive from that class and enter your own rpc username, password and IP. Please note that all signing happens locally in your browser, this will not increase the security of your transaction in any way, but if it makes you happy not to rely on third parties for sending signed transactions into the XIM network, feel free to run your own. Obviously anyone can simply copy the website and host it on their own server, we cannot guarantee that such sites don't change how the service works, thus you should ONLY trust this url https://ximblockwallet.com. 10 | 11 | If you want to host it yourself, setup a XIM node with RPC access and use those parameters in the XimBlockNode.cs (for broadcasting tx out to the XIM network). 12 | The website can be compiled with Visual Studio 2017 and can be hosted on any IIS version compatible with ASP.NET Core 2.0. -------------------------------------------------------------------------------- /Startup.cs: -------------------------------------------------------------------------------- 1 | using myximblockwallet.org.Models; 2 | using Microsoft.AspNetCore.Builder; 3 | using Microsoft.AspNetCore.Hosting; 4 | using Microsoft.Extensions.Configuration; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | namespace myximblockwallet.org 8 | { 9 | public class Startup 10 | { 11 | public Startup(IConfiguration configuration) => Configuration = configuration; 12 | public IConfiguration Configuration { get; } 13 | 14 | public void ConfigureServices(IServiceCollection services) 15 | { 16 | services.AddMvc(); 17 | services.AddSingleton(); 18 | } 19 | 20 | public void Configure(IApplicationBuilder app, IHostingEnvironment env) 21 | { 22 | if (env.IsDevelopment()) 23 | app.UseDeveloperExceptionPage(); 24 | else 25 | app.UseExceptionHandler("/Home/Error"); 26 | app.Use(async (context, next) => 27 | { 28 | if (context.Request.IsHttps) 29 | await next(); 30 | else 31 | context.Response.Redirect("https://" + context.Request.Host + context.Request.Path); 32 | }); 33 | app.UseStaticFiles(); 34 | app.UseMvc(routes => 35 | { 36 | //https://stackoverflow.com/questions/12828317/mvc-4-remove-home-from-base-route 37 | routes.MapRoute("OnlyAction", "{action}", new { controller = "Home", action = "Index" }); 38 | routes.MapRoute(name: "default", template: "{controller=Home}/{action=Index}/{id?}"); 39 | routes.MapSpaFallbackRoute(name: "spa-fallback", 40 | defaults: new { controller = "Home", action = "Index" }); 41 | }); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Views/Home/AboutCreateNewWallet.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "How to Create a Wallet via Keystore file"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 |
9 | New here? Then first check the Getting Started Guide 10 |

How To

11 |
    12 |
  • Go to https://MyXimBlockWallet.org.
  • 13 |
  • Click the "Create Keystore Wallet" button.
  • 14 |
  • 15 | Enter a strong but easy to remember password. Do not forget it.
      16 |
    • This encrypts (protects) your private key. It does not generate your private key. This password alone will not be enough to access your XIM.
    • 17 |
    18 |
  • 19 |
  • 20 | Download your Keystore file & save this file to a USB drive.
      21 |
    • This is the encrypted version of your private key. You need the password to access it. It is safer than your unencrypted private key but you must have your password to access it in the future.
    • 22 |
    23 |
  • 24 |
  • 25 | Once unlocked, print your paper wallet backup and/or carefully hand-write the private key on a piece of paper.
      26 |
    • If you are writing it, it is recommend you write it 2 or 3 times. This decreases the chance your messy handwriting will prevent you from accessing your wallet later.
    • 27 |
    28 |
  • 29 |
  • Send a small amount of XIM (10 XIM) from your previous wallet or exchange to your new wallet. You should not use big amounts without having a hardware wallet, it is recommended to only keep small amounts in your wallet like you would in real life (or do you walk around with thousands in your pocket?)
  • 30 |
  • 31 | Unlock your new wallet from the Keystore file on your USB drive or via the private key that you printed out. Ensure it unlocks the wallet you are sent to and matches the bookmark you have.
      32 |
    • Do not simply leave your new wallet open. Pretend you are coming back a year later to access your riches. Can you do it?
    • 33 |
    34 |
  • 35 |
  • 36 | Send a super small amount of XIM (0.00001 XIM) from this new wallet to another address.
      37 |
    • Perhaps to our donation address: DCT5GRhHq5t1DWZSrMBEGBZULRhCREB1s9? We are a free, open-source service. There are no fees, no ads, no tracking, no cookies, no selling your data (as we have none, everything runs locally on your PC except when sending XIM into the blockchain).
    • 38 |
    39 |
  • 40 |
  • Ensure you have recorded all necessary bits of information and the addresses match at all times. If they don't, you mis-wrote something somewhere. That means it's time to start from the beginning in order to make sure you never lose access to your funds.
  • 41 |
42 |

Doing all of this is tedious, but it ensures you (1) have complete access to your funds (2) the address you sent to is correct and matches the private key you have saved and (3) you can rest easily for years to come, knowing you will be able to access your XIM later.

43 |

Safe Storage of Backups

44 |

It is recommended that you store backups of both forms of your key (the Keystore / UTC file version and paper wallet version) in physically separate, offline environments.

45 |

This prevents loss of the private key & password due to: dead hard drive, lost USB drive, wet piece of paper, etc. Keep in mind that physical loss can affect an entire area (e.g. fire, flood).

46 |

We cannot recover your key

47 |

MyXimBlockWallet is not a web wallet (except for the tipping or other online parts, any funds in transit will either arrive at the target or be send back to you, they don't stay in the online pot) and cannot recover your private key or password, access your account, move funds, recover funds, nor cancel/reverse transactions in the blockchain.

48 |

We are a client-side interface that allows you to interact with the XIM blockchain. Please secure & back up your key like the many dollars it could some day be worth.

49 | 50 | 58 |

Short Version (Advanced Users Only)

59 |
    60 |
  1. Go to https://MyXimBlockWallet.org.
  2. 61 |
  3. Click the "Create Keystore Wallet" button.
  4. 62 |
  5. Enter a strong but easy to remember password.
  6. 63 |
  7. Click the "Download" button & save your Keystore file. Back it up.
  8. 64 |
  9. Unlock your keystore wallet with your password
  10. 65 |
  11. When unlocked you have the option of printing a paper wallet, saving your private key, or saving a QR code of your private key. Back up at least one (offline).
  12. 66 |
  13. Save your address to a text document & bookmark the link on the address site (customized for you).
  14. 67 |
  15. Ensure all information matches. Don't lose this information. Double check your work. Don't be dumb.
  16. 68 |
69 |
70 |
-------------------------------------------------------------------------------- /Views/Home/AboutTransactionFees.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Why are XIM transactions so cheap on MyXimBlockWallet?"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 7 |
8 |
9 |

Other wallets or exchanges might charge you high amounts of XIM for sending or withdrawing, which can be up to a few USD. The default minimum fee in the XIM full wallet is 10 XIM/kb, but you can even get away with zero fees right now.

10 |

MyXimBlockWallet is non-profit, there are no hidden fees and what you pay is used to pay the stakers automatically when the transaction is created and accepted in the blockchain, nothing ends up anywhere else.

11 |

Zero or Tiny fees

12 |

Anyway, you will only pay this super tiny fee or nothing at all as long as zero tx fee work in XIM. Worst case is about 2.26 XIM per tx, which is less than 1/50 of a cent right now (yes, that is up to 50 transactions per single cent). This fee does NOT depend on the amount you send, but it is not always the same and depends on how much data your transaction contains (multiple inputs if your wallet is fragmented drive the price up, see examples below).

13 | @*

Optional extra features

14 |

SwiftTX has a fixed tx cost of 10 XIM per input, which amounts to about 2 cents right now. The advantage is that your transaction is accepted and locked in about 1 second, which is very cool and useful for quick purchases. Obviously due to the higher cost this is off by default.

15 |

Obfuscation is currently only possible with full node by using the XIM Core full Wallet on your PC. It requires pre-mixing of your XIM into newly generated addresses owned by you and is done via the masternodes of the XIM network, which can take a few hours. No hardware wallet or thin client supports this feature, but MyXimBlockWallet gives you the option to send your XIM into an autogenerated anonymous address, which mixes it for you and sends out privatized XIM to the given target address.

*@ 16 |

Receiving XIM

17 |

Receiving XIM on any address you own is free for you, the transaction fee is always paid for by the sender. You also don't need to wait long as transactions are confirmed in a few seconds usually. If ShiftTX was used by the sender the XIM amount will be confirmed by the network in a second and should show up in a couple of seconds on MyXimBlockWallet as well. The website will update amounts every 10 seconds, any XIM you receive is yours and usable right way.

18 |

Recap

19 |
    20 |
  • Tx cost is usually 2.26 XIM for one input and two outputs (minimum to get accepted by the XIM network, if this goes up or the network becomes full, this fee will be increased). This is currently just around 0.02 cents, NO MATTER how much XIM you actually send to someone!
  • 21 | @*
  • For SwiftTX the tx fee is locked to 10 XIM ≈ 2 cents per input by design, but you get confirmed in a second.
  • 22 |
  • For Obfuscation the tx fee is 10 XIM + 1 XIM per mixed input (around 11-25 XIM usually).
  • 23 |
  • By default SwiftTX and Obfuscation are not used and micro-payments are possible with a neglegtible fee, why not send your friends 1 cent of XIM just for fun?
  • *@ 24 |
  • 25 | If you have multiple inputs (basically when your XIM is fragmented in multiple chunks you have received and you send more than you have in your single inputs) the tx fee increases. Examples:
      26 |
    • Inputs: 150 XIM -> sending 100 XIM: 2.26 XIM fee (1 input), or zero fee if possible
    • 27 |
    • Inputs: 100 XIM, 100 XIM -> sending 100 XIM: 3.74 XIM fee (2 inputs: 0.78+1.48*2 XIM, need that second input to cover the fee, use zero fee to avoid this alltogether)
    • 28 |
    29 |
  • 30 |
  • Please ask for more features in the XIM Discord Chat. We need your support to keep this being funded and developed further!
  • 31 |
32 |

33 | Back to the general help. 34 |
35 |
-------------------------------------------------------------------------------- /Views/Home/Address.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Check any XIM address"; 3 | } 4 |

@ViewData["Title"] 5 | Bookmark this XIM Address for easy checking

6 |

@ViewData["Message"]

7 | 8 | 58 | 59 |
60 |
61 |
62 |

Your Address can also be known as you Account # or your Public Key. It is what you share with people so they can send you XIM. Since the XIM blockchain is public and open, you can check any address (yours or any other) via the Public Key.

63 |
64 | 65 | Unlike Unlock Wallet you won't need to access your hardware wallet or stored private key here. As long as you know your (or any other) address, you can always check whats going on via chainz.cryptoid.info/ximblock. If your unlocked your wallet before your last used wallet address is shown here automatically, but you can enter any other address just as well.
66 |
67 | Enter Wallet Address to check; it looks like this: DCT5GRhHq5t1DWZSrMBEGBZULRhCREB1s9 68 | 69 | 76 | 87 |
88 |
89 | -------------------------------------------------------------------------------- /Views/Home/Transaction.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Check any transaction"; 3 | } 4 |

@ViewData["Title"]

5 |

@ViewData["Message"]

6 | 11 | 12 | Enter Transaction Id to check (if you received or send any XIM, each action shows up as a transaction in your wallet): 13 | 14 | -------------------------------------------------------------------------------- /Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Error"; 3 | } 4 |

Error.

5 |

An error occurred while processing your request.

6 | @if (!string.IsNullOrEmpty((string)ViewData["RequestId"])) 7 | { 8 |

9 | Request ID: @ViewData["RequestId"] 10 |

11 | } -------------------------------------------------------------------------------- /Views/Shared/_Layout.cshtml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | MyXimBlockWallet.org 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |
16 | 17 | MyXimBlockWallet MY XIM WALLET 18 | 19 | 33 |
34 |
1000 XIM = @ViewData["XimBlock1kPrices"]
35 |
1 XIM = @ViewData["XimBlockPrices"]
36 |
1 XIM = @ViewData["BtcRate"] BTC
37 |
38 |
39 |
40 |
41 | 47 |
48 | @RenderBody() 49 |
50 | 66 | @RenderSection("scripts", required: false) 67 | 68 | 69 | -------------------------------------------------------------------------------- /Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using myximblockwallet.org 2 | @using myximblockwallet.org.Models 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /bitcore-lib-ximblock/generate-ximblock.js.cmd: -------------------------------------------------------------------------------- 1 | browserify ximblock.input.js | uglifyjs > ..\wwwroot\ximblock.js 2 | -------------------------------------------------------------------------------- /bitcore-lib-ximblock/how-to-build_ximblock.js.txt: -------------------------------------------------------------------------------- 1 | get npm 2 | add browserify: npm install -g browserify 3 | add uglify: npm install -g uglify-js 4 | 5 | npm install 6 | browserify ximblock.input.js | uglifyjs > ..\wwwroot\ximblock.js 7 | 8 | or just double click the generate-ximblock.js.cmd file once everything is setup. 9 | -------------------------------------------------------------------------------- /bitcore-lib-ximblock/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "bindings": { 6 | "version": "1.3.0", 7 | "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", 8 | "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==" 9 | }, 10 | "bitcore-lib-pivx": { 11 | "version": "0.13.21", 12 | "resolved": "https://registry.npmjs.org/bitcore-lib-pivx/-/bitcore-lib-pivx-0.13.21.tgz", 13 | "integrity": "sha1-NhdVyh3DfjCLghLTbGklW+TuIfg=", 14 | "requires": { 15 | "bn.js": "https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz", 16 | "bs58": "https://registry.npmjs.org/bs58/-/bs58-2.0.0.tgz", 17 | "buffer-compare": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.0.0.tgz", 18 | "elliptic": "https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz", 19 | "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", 20 | "lodash": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", 21 | "sha512": "https://registry.npmjs.org/sha512/-/sha512-0.0.1.tgz", 22 | "x11-hash-js": "https://registry.npmjs.org/x11-hash-js/-/x11-hash-js-1.0.0.tgz" 23 | }, 24 | "dependencies": { 25 | "bn.js": { 26 | "version": "https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz", 27 | "integrity": "sha512-agol6nELIIhWUdrrb0ko6X/ojICxfDeUg+NUCODLS4Dn3deKCE+d1HTEjvlD/WfH6rZ1DCh7bA21tHNtmqwjWA==" 28 | }, 29 | "bs58": { 30 | "version": "https://registry.npmjs.org/bs58/-/bs58-2.0.0.tgz", 31 | "integrity": "sha512-e6HRIsesDBCrBpXbYviZDrxtwHkk2D4K7f4u/asWRrKBQTt5axZRt2nqa3Hw51+lzQOni31Xvu1/2FiZodXtow==" 32 | }, 33 | "buffer-compare": { 34 | "version": "https://registry.npmjs.org/buffer-compare/-/buffer-compare-1.0.0.tgz", 35 | "integrity": "sha512-V44fH6pgIfMge/eVmwtRHOfbYYsjRLpMTxEWYijmmendeNi8gRh4Epg0TvgLi3w/NGwVrBWV2B5++RfGTtkCLw==" 36 | }, 37 | "elliptic": { 38 | "version": "https://registry.npmjs.org/elliptic/-/elliptic-3.0.3.tgz", 39 | "integrity": "sha512-CrBEiS76Obfxgy6v25p2f7XUZ63DF6mJ/KL0lvBnIrlBeebacGjukc4KjbFWw6bdMnOMM6QXcO84Q2/VJaJlTA==", 40 | "requires": { 41 | "bn.js": "https://registry.npmjs.org/bn.js/-/bn.js-2.0.4.tgz", 42 | "brorand": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz", 43 | "hash.js": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz", 44 | "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" 45 | }, 46 | "dependencies": { 47 | "brorand": { 48 | "version": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz", 49 | "integrity": "sha512-pb4102NA1VdNIg6zALQzgTtcF1X/TzcTih82dK5FNr/z2rroufb1C5clgM6zpYtr3Gvu//mAwgkFfK2lZI60gg==" 50 | }, 51 | "hash.js": { 52 | "version": "https://registry.npmjs.org/hash.js/-/hash.js-1.0.3.tgz", 53 | "integrity": "sha512-J0ew1WQhNTfUrH4VYckHyBLq3WzyKJleK8HPeWVIFtgu/mUBKy1fKtk3drOijR2T1gh0ZqC6EZ06uGRgdMASSg==", 54 | "requires": { 55 | "inherits": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" 56 | } 57 | } 58 | } 59 | }, 60 | "inherits": { 61 | "version": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", 62 | "integrity": "sha512-8nWq2nLTAwd02jTqJExUYFSD/fKq6VH9Y/oG2accc/kdI0V98Bag8d5a4gi3XHz73rDWa2PvTtvcWYquKqSENA==" 63 | }, 64 | "lodash": { 65 | "version": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", 66 | "integrity": "sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ==" 67 | }, 68 | "sha512": { 69 | "version": "https://registry.npmjs.org/sha512/-/sha512-0.0.1.tgz", 70 | "integrity": "sha512-2t5rZu72ebMg2/OK44S/48UKxgBl7Kc3w/I0DkIzNld8NzDUxFBL2pOYAWEVknnuOqO62a3W+3x/xD7LrosGBg==" 71 | }, 72 | "x11-hash-js": { 73 | "version": "https://registry.npmjs.org/x11-hash-js/-/x11-hash-js-1.0.0.tgz", 74 | "integrity": "sha512-pNG0/uHd0dRAt/TwEE5xKeXEUKfWg1c9UVsdTkdN2ESPLMHMv5E14U/L6QzlhSdjaigjZ+RLoyMSecHsrET59g==" 75 | } 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /bitcore-lib-ximblock/ximblock.input.js: -------------------------------------------------------------------------------- 1 | var bitcore = require('ximcore-lib'); 2 | window.generatePrivateKey = function() { 3 | return new bitcore.PrivateKey().toString(); 4 | } 5 | window.fromWifKey = function(key) { 6 | return bitcore.PrivateKey.fromWIF(key); 7 | } 8 | window.toWifKey = function(key) { 9 | return new bitcore.PrivateKey(key).toWIF(); 10 | } 11 | window.getDecryptedAddress = function(key) { 12 | return new bitcore.PrivateKey(key).toAddress().toString(); 13 | } 14 | window.signRawTx = function(rawUtxosHashes, rawUtxosOutputIndex, rawTx, txFeeInDuffs, key) { 15 | try { 16 | // Due to a tx sign bug where ouput (script and satoshi amount) get lost when using our rawTx 17 | // we need to recreate the whole transaction: https://github.com/bitpay/bitcore/issues/1199 18 | var transaction = new bitcore.Transaction(); 19 | bitcore.Transaction.DUST_AMOUNT = 0; 20 | bitcore.Transaction.FEE_PER_KB = 0; 21 | bitcore.Transaction.FEE_SECURITY_MARGIN = 0; 22 | transaction.fee(txFeeInDuffs); 23 | for (var i=0; i 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /myximblockwallet.org.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2015 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "myximblockwallet.org", "myximblockwallet.org.csproj", "{81D2AB01-294E-4419-804C-C33F11294AC7}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BitcoinLib", "BitcoinLib\BitcoinLib.csproj", "{87ADBDD7-4915-4B2B-8159-529FA441E0FD}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {81D2AB01-294E-4419-804C-C33F11294AC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {81D2AB01-294E-4419-804C-C33F11294AC7}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {81D2AB01-294E-4419-804C-C33F11294AC7}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {81D2AB01-294E-4419-804C-C33F11294AC7}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {87ADBDD7-4915-4B2B-8159-529FA441E0FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {87ADBDD7-4915-4B2B-8159-529FA441E0FD}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {87ADBDD7-4915-4B2B-8159-529FA441E0FD}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {87ADBDD7-4915-4B2B-8159-529FA441E0FD}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {F2421B8E-B72D-42DC-8D5F-6F902F9935EE} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/favicon.ico -------------------------------------------------------------------------------- /wwwroot/images/MyXimBlockWallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/images/MyXimBlockWallet.png -------------------------------------------------------------------------------- /wwwroot/images/QrCodeWhenUnlocked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/images/QrCodeWhenUnlocked.png -------------------------------------------------------------------------------- /wwwroot/images/XimBlockLogoBig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/images/XimBlockLogoBig.png -------------------------------------------------------------------------------- /wwwroot/images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/images/ajax-loader.gif -------------------------------------------------------------------------------- /wwwroot/images/icon-eye-closed.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/icon-eye.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/icon-help-2.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/icon-help-3.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/icon-help.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/logo-ledger.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/logo-trezor.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-02.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-03.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-04.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-05.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-06.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-07.svg: -------------------------------------------------------------------------------- 1 | onboarding_icon-07 -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-09.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/images/onboarding_icon-10.svg: -------------------------------------------------------------------------------- 1 | onboarding_icons -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | }, 34 | "version": "3.3.7", 35 | "_release": "3.3.7", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.3.7", 39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86" 40 | }, 41 | "_source": "https://github.com/twbs/bootstrap.git", 42 | "_target": "v3.3.7", 43 | "_originalSource": "bootstrap", 44 | "_direct": true 45 | } -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2016 Twitter, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/XimBlockProject/Wallet-Web/e32f988d777c47a0a5474ba68472fe9c9acd79ac/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /wwwroot/lib/jquery-validation-unobtrusive/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation-unobtrusive", 3 | "version": "3.2.6", 4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", 5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.", 6 | "main": [ 7 | "jquery.validate.unobtrusive.js" 8 | ], 9 | "ignore": [ 10 | "**/.*", 11 | "*.json", 12 | "*.md", 13 | "*.txt", 14 | "gulpfile.js" 15 | ], 16 | "keywords": [ 17 | "jquery", 18 | "asp.net", 19 | "mvc", 20 | "validation", 21 | "unobtrusive" 22 | ], 23 | "authors": [ 24 | "Microsoft" 25 | ], 26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm", 27 | "repository": { 28 | "type": "git", 29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git" 30 | }, 31 | "dependencies": { 32 | "jquery-validation": ">=1.8", 33 | "jquery": ">=1.8" 34 | }, 35 | "_release": "3.2.6", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.2.6", 39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7" 40 | }, 41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git", 42 | "_target": "3.2.6", 43 | "_originalSource": "jquery-validation-unobtrusive" 44 | } -------------------------------------------------------------------------------- /wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | ** Unobtrusive validation support library for jQuery and jQuery Validate 3 | ** Copyright (C) Microsoft Corporation. All rights reserved. 4 | */ 5 | !function(a){function e(a,e,n){a.rules[e]=n,a.message&&(a.messages[e]=a.message)}function n(a){return a.replace(/^\s+|\s+$/g,"").split(/\s*,\s*/g)}function t(a){return a.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g,"\\$1")}function r(a){return a.substr(0,a.lastIndexOf(".")+1)}function i(a,e){return 0===a.indexOf("*.")&&(a=a.replace("*.",e)),a}function o(e,n){var r=a(this).find("[data-valmsg-for='"+t(n[0].name)+"']"),i=r.attr("data-valmsg-replace"),o=i?a.parseJSON(i)!==!1:null;r.removeClass("field-validation-valid").addClass("field-validation-error"),e.data("unobtrusiveContainer",r),o?(r.empty(),e.removeClass("input-validation-error").appendTo(r)):e.hide()}function d(e,n){var t=a(this).find("[data-valmsg-summary=true]"),r=t.find("ul");r&&r.length&&n.errorList.length&&(r.empty(),t.addClass("validation-summary-errors").removeClass("validation-summary-valid"),a.each(n.errorList,function(){a("
  • ").html(this.message).appendTo(r)}))}function s(e){var n=e.data("unobtrusiveContainer");if(n){var t=n.attr("data-valmsg-replace"),r=t?a.parseJSON(t):null;n.addClass("field-validation-valid").removeClass("field-validation-error"),e.removeData("unobtrusiveContainer"),r&&n.empty()}}function l(e){var n=a(this),t="__jquery_unobtrusive_validation_form_reset";if(!n.data(t)){n.data(t,!0);try{n.data("validator").resetForm()}finally{n.removeData(t)}n.find(".validation-summary-errors").addClass("validation-summary-valid").removeClass("validation-summary-errors"),n.find(".field-validation-error").addClass("field-validation-valid").removeClass("field-validation-error").removeData("unobtrusiveContainer").find(">*").removeData("unobtrusiveContainer")}}function m(e){var n=a(e),t=n.data(v),r=a.proxy(l,e),i=p.unobtrusive.options||{},m=function(n,t){var r=i[n];r&&a.isFunction(r)&&r.apply(e,t)};return t||(t={options:{errorClass:i.errorClass||"input-validation-error",errorElement:i.errorElement||"span",errorPlacement:function(){o.apply(e,arguments),m("errorPlacement",arguments)},invalidHandler:function(){d.apply(e,arguments),m("invalidHandler",arguments)},messages:{},rules:{},success:function(){s.apply(e,arguments),m("success",arguments)}},attachValidation:function(){n.off("reset."+v,r).on("reset."+v,r).validate(this.options)},validate:function(){return n.validate(),n.valid()}},n.data(v,t)),t}var u,p=a.validator,v="unobtrusiveValidation";p.unobtrusive={adapters:[],parseElement:function(e,n){var t,r,i,o=a(e),d=o.parents("form")[0];d&&(t=m(d),t.options.rules[e.name]=r={},t.options.messages[e.name]=i={},a.each(this.adapters,function(){var n="data-val-"+this.name,t=o.attr(n),s={};void 0!==t&&(n+="-",a.each(this.params,function(){s[this]=o.attr(n+this)}),this.adapt({element:e,form:d,message:t,params:s,rules:r,messages:i}))}),a.extend(r,{__dummy__:!0}),n||t.attachValidation())},parse:function(e){var n=a(e),t=n.parents().addBack().filter("form").add(n.find("form")).has("[data-val=true]");n.find("[data-val=true]").each(function(){p.unobtrusive.parseElement(this,!0)}),t.each(function(){var a=m(this);a&&a.attachValidation()})}},u=p.unobtrusive.adapters,u.add=function(a,e,n){return n||(n=e,e=[]),this.push({name:a,params:e,adapt:n}),this},u.addBool=function(a,n){return this.add(a,function(t){e(t,n||a,!0)})},u.addMinMax=function(a,n,t,r,i,o){return this.add(a,[i||"min",o||"max"],function(a){var i=a.params.min,o=a.params.max;i&&o?e(a,r,[i,o]):i?e(a,n,i):o&&e(a,t,o)})},u.addSingleVal=function(a,n,t){return this.add(a,[n||"val"],function(r){e(r,t||a,r.params[n])})},p.addMethod("__dummy__",function(a,e,n){return!0}),p.addMethod("regex",function(a,e,n){var t;return this.optional(e)?!0:(t=new RegExp(n).exec(a),t&&0===t.index&&t[0].length===a.length)}),p.addMethod("nonalphamin",function(a,e,n){var t;return n&&(t=a.match(/\W/g),t=t&&t.length>=n),t}),p.methods.extension?(u.addSingleVal("accept","mimtype"),u.addSingleVal("extension","extension")):u.addSingleVal("extension","extension","accept"),u.addSingleVal("regex","pattern"),u.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url"),u.addMinMax("length","minlength","maxlength","rangelength").addMinMax("range","min","max","range"),u.addMinMax("minlength","minlength").addMinMax("maxlength","minlength","maxlength"),u.add("equalto",["other"],function(n){var o=r(n.element.name),d=n.params.other,s=i(d,o),l=a(n.form).find(":input").filter("[name='"+t(s)+"']")[0];e(n,"equalTo",l)}),u.add("required",function(a){("INPUT"!==a.element.tagName.toUpperCase()||"CHECKBOX"!==a.element.type.toUpperCase())&&e(a,"required",!0)}),u.add("remote",["url","type","additionalfields"],function(o){var d={url:o.params.url,type:o.params.type||"GET",data:{}},s=r(o.element.name);a.each(n(o.params.additionalfields||o.element.name),function(e,n){var r=i(n,s);d.data[r]=function(){var e=a(o.form).find(":input").filter("[name='"+t(r)+"']");return e.is(":checkbox")?e.filter(":checked").val()||e.filter(":hidden").val()||"":e.is(":radio")?e.filter(":checked").val()||"":e.val()}}),e(o,"remote",d)}),u.add("password",["min","nonalphamin","regex"],function(a){a.params.min&&e(a,"minlength",a.params.min),a.params.nonalphamin&&e(a,"nonalphamin",a.params.nonalphamin),a.params.regex&&e(a,"regex",a.params.regex)}),a(function(){p.unobtrusive.parse(document)})}(jQuery); -------------------------------------------------------------------------------- /wwwroot/lib/jquery-validation/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation", 3 | "homepage": "http://jqueryvalidation.org/", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/jzaefferer/jquery-validation.git" 7 | }, 8 | "authors": [ 9 | "Jörn Zaefferer " 10 | ], 11 | "description": "Form validation made easy", 12 | "main": "dist/jquery.validate.js", 13 | "keywords": [ 14 | "forms", 15 | "validation", 16 | "validate" 17 | ], 18 | "license": "MIT", 19 | "ignore": [ 20 | "**/.*", 21 | "node_modules", 22 | "bower_components", 23 | "test", 24 | "demo", 25 | "lib" 26 | ], 27 | "dependencies": { 28 | "jquery": ">= 1.7.2" 29 | }, 30 | "version": "1.14.0", 31 | "_release": "1.14.0", 32 | "_resolution": { 33 | "type": "version", 34 | "tag": "1.14.0", 35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48" 36 | }, 37 | "_source": "git://github.com/jzaefferer/jquery-validation.git", 38 | "_target": ">=1.8", 39 | "_originalSource": "jquery-validation" 40 | } -------------------------------------------------------------------------------- /wwwroot/lib/jquery-validation/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright Jörn Zaefferer 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors, https://jquery.org/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /wwwroot/ximblock-favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 8 | 9 | 10 | 11 | 12 | 45 | 46 | --------------------------------------------------------------------------------