https://github.com/jaminima/crypto-wallet-wrapper
A Wrapper Library & Web-API for Wallets Based On Bitcoin Core
https://github.com/jaminima/crypto-wallet-wrapper
bitcoin crypto dogecoin garlicoin libray payments wallet-api wallet-package wallet-wrapper webwallet
Last synced: 4 months ago
JSON representation
A Wrapper Library & Web-API for Wallets Based On Bitcoin Core
- Host: GitHub
- URL: https://github.com/jaminima/crypto-wallet-wrapper
- Owner: Jaminima
- License: mit
- Created: 2021-05-31T09:18:15.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-22T08:20:43.000Z (over 4 years ago)
- Last Synced: 2025-01-04T18:24:21.249Z (about 1 year ago)
- Topics: bitcoin, crypto, dogecoin, garlicoin, libray, payments, wallet-api, wallet-package, wallet-wrapper, webwallet
- Language: C#
- Homepage:
- Size: 364 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Crypto Wallet Wrapper
This project aims to provide simplified interaction with [Bitcoin Core](https://github.com/bitcoin/bitcoin) like wallets. Enabling the writing of C# apps that can exploit the wallet libray or web enabled apps via the provided simple API.
Included is a [Simple Site](https://github.com/Jaminima/Crypto-Wallet-Wrapper/tree/main/Simple-Site), functioning as nothing more than a web wallet. More details are available in its readme.
## Important Notes
## No Security
There is no real secuirty built into the current version of the API. A session key is provided on Login/Register that identifies a users current session. User does hold a placeholder password field but no validation is performed against this.
Said session key is stored in plain text in the API's memory. You **WILL** want to improve security if used in any production enviroment.
## Flat File Storage
Confirmed txID's (Wrapper Library) and User (API) data is currently stored in a flat file format. In any production environment it is highly recommended that you use a proper dB service. Chosing not to do so increases the risk of data corruption, especially at higher loads when write collisions may cause a crash.
# Set-Up
In this section we will go through setting up a Core wallet example along with changing the config to work with said wallet.
Download your Crypto's core files.
- [Bitcoin Core](https://github.com/bitcoin/bitcoin/releases)
- [Dogecoin Core](https://github.com/dogecoin/dogecoin/releases)
- [Garlicoin Core](https://github.com/GarlicoinOrg/Garlicoin/releases) - [Tutorial](https://guide.garli.co.in/wallet-win.html)
- [Litecoin Core](https://github.com/litecoin-project/litecoin/releases)
Once downloaded and followed the typical steps to download and setup your core. You must ensure RPC is enabled in your cores config, typically located in a file like **%appdata%/Garlicoin/garlicoin.conf**. Ensure the **Server** setting is set to 1, also set the **rpcuser**, **rpcpassword** & **rpcport** to sensible values of your choice.
Find the config.json located within your project (requires inital run to generate). Change your **corepath**, **coindName** to match those in your core folder. Also change the **rpcAddress**, **username** & **password** to match what you set in the core config.
When using Garlicoin Core my config ends up looking like:
|  |  |
| ---------------------------------------------------------------------------------------- |:-------------------------------------------------------------------------------- |
# Working with the Libray
The Wallet-Wrapper can be imported like any other library. On your apps start the function must be called.
```csharp
using Wallet_Wrapper;
private static void Main(string[] args){
Cli_Manager.Start(true); //By setting to true, the app wont throw an error if the core is already running
}
```
Key functions you may want to run are located in the Cli-Payments and Cli-Gets classes.
## Payments
```csharp
await Cli_Payments.PayOut("ADDRESS", 0.5f); //Pay to a given address
await Cli_Payments.ConfirmPayment("receiveAddress", "txID"); //Confirm receipt of a payment
```
## Gets
```csharp
Objects.Wallet wallet = await GetWalletInfo(); //Wallets full details
Objects.Address address = await VerifyAddress("ADDRESS");
Objects.Transaction transaction = await GetTransaction("txID");
string network = await GetNetworkInfo();
string blockchain = await GetBlockChainInfo();
string newAddress = await GetNewWalletAddress();
bool networkRunning = await IsNetworkRunning();
```
# Working with the API
An [Insomnia](https://insomnia.rest/download) api doc file is provided in the repos root directory. The api is built using ASP.net so expanding to use a scaffolded database or adding aditional functionality should be easily acheived.
The **Important Notes** section has imprtant details about the API.
# Known Issues
- Sometimes API requests stall out indefinitely. Typically when using the GetTransaction function.
# Contributing
I welcome all contributions to the project. The addition of endpoints and wrapper functions should be listed and added into docs where possible.