Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Paket-based build scripts #79

Merged
merged 3 commits into from Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
265 changes: 265 additions & 0 deletions .paket/Paket.Restore.targets

Large diffs are not rendered by default.

Binary file added .paket/paket.bootstrapper.exe
Binary file not shown.
Binary file added .paket/paket.exe
Binary file not shown.
72 changes: 72 additions & 0 deletions .paket/paket.targets
@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">true</RestorePackages>
<PaketToolsPath>$(MSBuildThisFileDirectory)</PaketToolsPath>
<PaketRootPath>$(MSBuildThisFileDirectory)..\</PaketRootPath>
<PaketLockFilePath>$(PaketRootPath)paket.lock</PaketLockFilePath>
<PaketRestoreCacheFile>$(PaketRootPath)paket-files\paket.restore.cached</PaketRestoreCacheFile>
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
</PropertyGroup>

<PropertyGroup>
<!-- Paket command -->
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe')">$(PaketRootPath)paket.exe</PaketExePath>
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
</PropertyGroup>

<Choose> <!-- MyProject.fsproj.paket.references has the highest precedence -->
<When Condition="Exists('$(MSBuildProjectFullPath).paket.references')">
<PropertyGroup>
<PaketReferences>$(MSBuildProjectFullPath).paket.references</PaketReferences>
</PropertyGroup>
</When> <!-- MyProject.paket.references -->
<When Condition="Exists('$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references')">
<PropertyGroup>
<PaketReferences>$(MSBuildProjectDirectory)\$(MSBuildProjectName).paket.references</PaketReferences>
</PropertyGroup>
</When> <!-- paket.references -->
<When Condition="Exists('$(MSBuildProjectDirectory)\paket.references')">
<PropertyGroup>
<PaketReferences>$(MSBuildProjectDirectory)\paket.references</PaketReferences>
</PropertyGroup>
</When> <!-- Set to empty if a reference file isn't found matching one of the 3 format options -->
<Otherwise>
<PropertyGroup>
<PaketReferences></PaketReferences>
</PropertyGroup>
</Otherwise>
</Choose>

<PropertyGroup>
<!-- Commands -->
<RestoreCommand>$(PaketCommand) restore --references-file "$(PaketReferences)"</RestoreCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">RestorePackages; $(BuildDependsOn);</BuildDependsOn>
</PropertyGroup>
<Target Name="RestorePackages">
<PropertyGroup>
<PaketRestoreRequired>true</PaketRestoreRequired>
</PropertyGroup>

<PropertyGroup Condition="Exists('$(PaketRestoreCacheFile)') ">
<PaketRestoreCachedHash>$([System.IO.File]::ReadAllText('$(PaketRestoreCacheFile)'))</PaketRestoreCachedHash>
<PaketRestoreLockFileHash>$([System.IO.File]::ReadAllText('$(PaketLockFilePath)'))</PaketRestoreLockFileHash>
<PaketRestoreRequired>true</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '$(PaketRestoreCachedHash)' ">false</PaketRestoreRequired>
<PaketRestoreRequired Condition=" '$(PaketRestoreLockFileHash)' == '' ">true</PaketRestoreRequired>
</PropertyGroup>

<Exec Command="$(RestoreCommand)"
IgnoreStandardErrorWarningFormat="true"
WorkingDirectory="$(PaketRootPath)"
ContinueOnError="false"
Condition=" '$(PaketRestoreRequired)' == 'true' AND Exists('$(PaketReferences)') AND '$(PaketReferences)' != '' "
/>
</Target>
</Project>
121 changes: 64 additions & 57 deletions README.md
@@ -1,10 +1,8 @@
BitcoinLib
==========
# BitcoinLib

**.NET Bitcoin & Altcoins library**

Features
--------
## Features

- Fully compatible and up-to-date with [Bitcoin Core 0.11.2](https://bitcoin.org/en/download) RPC API.
- Strongly-typed structures for complex RPC requests and responses.
Expand All @@ -24,88 +22,97 @@ Features
- [Test Network (testnet)](https://bitcoin.org/en/developer-examples#testnet) and [Regression Test Mode (regtest)](https://bitcoin.org/en/developer-examples#regtest-mode) ready.
- Fully configurable.

Donations
---------
## Donations

This library took a significant amount of time and effort to build and requires continuous maintenance in order to keep up with changes introduced with every new Bitcoin-Core release. Keep it up by donating at: [15Nb3RhMd13zp5Pc7yngUon83nFtEZUyBA](bitcoin:15Nb3RhMd13zp5Pc7yngUon83nFtEZUyBA?label=BitcoinLib)

Support
-------
## Support

Premium Support is available by our team of experts for $350/h (min 1 hour) at: [hello@cryptean.com](mailto:hello@cryptean.com).

License
-------
## License

See [LICENSE](LICENSE).

NuGet packages
-------
## NuGet packages

BitcoinLib is available on NuGet:

* [BitcoinLib](https://www.nuget.org/packages/BitcoinLib/)

Versioning
-------
## Versioning

From version 1.4.0, BitcoinLib follows [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html).

## Building from source

Instructions for Bitcoin
------------------------
To build BitcoinLib from source, you will need either the
[.NET Core SDK or Visual Studio](https://www.microsoft.com/net/download/).

- Locate your `bitcoin.conf` file (in Windows it's under: `%AppData%\Roaming\Bitcoin`, if it's not there just go ahead and create it) and add these lines:
- rpcuser = MyRpcUsername
- rpcpassword = MyRpcPassword
- server=1
- txindex=1
### Linux-specific

- Edit the `app.config` file in the Console test client to best fit your needs. Make sure you also update the `bitcoin.conf` file when you alter the `Bitcoin_RpcUsername` and `Bitcoin_RpcPassword` parameters.
If you are using Linux you will also need Mono installed
(in order to run Paket). The full install sequence (for Ubuntu)
will be something like [this](https://github.com/hedgehogqa/fsharp-hedgehog/pull/153#issuecomment-364325504).

### Building & running tests

Instructions for Litecoin and other Bitcoin clones
--------------------------------------------------
With Visual Studio you can build BitcoinLib and run the tests
from inside the IDE, otherwise with the `dotnet` command-line
tool you can execute:

- Perform the same steps as those mentioned above for Bitcoin.
```sh
dotnet build src/BitcoinLib.sln
```

- Litecoin configuration file is: `litecoin.conf` under: `%AppData%\Roaming\Litecoin` and its daemon is: `litecoind`.
The first time you run it, this will use Paket to restore all
the packages, and then build the code.

- Each coin can be initialized by its own interface specification:
- `IBitcoinService BitcoinService = new BitcoinService();`
- `ILitecoinService LitecoinService = new LitecoinService();`
## Instructions for Bitcoin

- Any bitcoin clone can be adopted without any further installation steps with the use of the generic `ICryptocoinService`:
- `ICryptocoinService cryptocoinService = new CryptocoinService("daemonUrl", "rpcUsername", "rpcPassword", "walletPassword");`
- Locate your `bitcoin.conf` file (in Windows it's under: `%AppData%\Roaming\Bitcoin`, if it's not there just go ahead and create it) and add these lines:
```
rpcuser = MyRpcUsername
rpcpassword = MyRpcPassword
server=1
txindex=1
```
- Edit the `app.config` file in the Console test client to best fit your needs. Make sure you also update the `bitcoin.conf` file when you alter the `Bitcoin_RpcUsername` and `Bitcoin_RpcPassword` parameters.

- Use `(ICryptocoinService).Parameters` to fully configure each coin pointer at run-time.
## Instructions for Litecoin and other Bitcoin clones

- Perform the same steps as those mentioned above for Bitcoin.
- Litecoin configuration file is: `litecoin.conf` under: `%AppData%\Roaming\Litecoin` and its daemon is: `litecoind`.
- Each coin can be initialized by its own interface specification:
- `IBitcoinService BitcoinService = new BitcoinService();`
- `ILitecoinService LitecoinService = new LitecoinService();`
- Any bitcoin clone can be adopted without any further installation steps with the use of the generic `ICryptocoinService`:
- `ICryptocoinService cryptocoinService = new CryptocoinService("daemonUrl", "rpcUsername", "rpcPassword", "walletPassword");`
- Use `(ICryptocoinService).Parameters` to fully configure each coin pointer at run-time.

Configuration
-------------
## Configuration

Sample configuration:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>

<!-- BitcoinLib settings start -->

<!-- Shared RPC settings start -->
<add key="RpcRequestTimeoutInSeconds" value="10" />
<!-- Shared RPC settings end -->

<!-- Bitcoin settings start -->
<add key="Bitcoin_DaemonUrl" value="http://localhost:8332" />
<add key="Bitcoin_DaemonUrl_Testnet" value="http://localhost:18332" />
<add key="Bitcoin_WalletPassword" value="MyWalletPassword" />
<add key="Bitcoin_RpcUsername" value="MyRpcUsername" />
<add key="Bitcoin_RpcPassword" value="MyRpcPassword" />
<!-- Bitcoin settings end -->

<!-- BitcoinLib settings end -->

</appSettings>
</configuration>

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- BitcoinLib settings start -->

<!-- Shared RPC settings start -->
<add key="RpcRequestTimeoutInSeconds" value="10" />
<!-- Shared RPC settings end -->

<!-- Bitcoin settings start -->
<add key="Bitcoin_DaemonUrl" value="http://localhost:8332" />
<add key="Bitcoin_DaemonUrl_Testnet" value="http://localhost:18332" />
<add key="Bitcoin_WalletPassword" value="MyWalletPassword" />
<add key="Bitcoin_RpcUsername" value="MyRpcUsername" />
<add key="Bitcoin_RpcPassword" value="MyRpcPassword" />
<!-- Bitcoin settings end -->

<!-- BitcoinLib settings end -->
</appSettings>
</configuration>
```
5 changes: 5 additions & 0 deletions paket.dependencies
@@ -0,0 +1,5 @@
source https://api.nuget.org/v3/index.json
nuget FAKE
nuget NuGet.CommandLine
nuget System.Configuration.ConfigurationManager
nuget Newtonsoft.Json