forked from lightningdevkit/rapid-gossip-sync-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the need for bitcoin full node
This commit adds middleware that uses GWallet's existing electrum client to help RGS verify utxos while removing the need for bitcoin full node.
- Loading branch information
Showing
10 changed files
with
161 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "geewallet"] | ||
path = geewallet | ||
url = https://github.com/aarani/geewallet.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
*.swp | ||
*.*~ | ||
project.lock.json | ||
.DS_Store | ||
*.pyc | ||
nupkg/ | ||
|
||
# Visual Studio Code | ||
.vscode | ||
|
||
# Rider | ||
.idea | ||
|
||
# User-specific files | ||
*.suo | ||
*.user | ||
*.userosscache | ||
*.sln.docstates | ||
|
||
# Build results | ||
[Dd]ebug/ | ||
[Dd]ebugPublic/ | ||
[Rr]elease/ | ||
[Rr]eleases/ | ||
x64/ | ||
x86/ | ||
build/ | ||
bld/ | ||
[Bb]in/ | ||
[Oo]bj/ | ||
[Oo]ut/ | ||
msbuild.log | ||
msbuild.err | ||
msbuild.wrn | ||
|
||
# Visual Studio 2015 | ||
.vs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
open System | ||
open System.Threading.Tasks | ||
open Microsoft.AspNetCore.Builder | ||
open Microsoft.Extensions.Hosting | ||
|
||
open GWallet.Backend | ||
open GWallet.Backend.UtxoCoin | ||
|
||
[<EntryPoint>] | ||
let main args = | ||
let builder = WebApplication.CreateBuilder args | ||
let app = builder.Build() | ||
|
||
app.Urls.Add "http://0.0.0.0:5108" | ||
|
||
app.MapGet("/getTransaction/{height}/{txPos}", | ||
Func<string, string, Task<string>>( | ||
fun height txPos -> | ||
task { | ||
Console.WriteLine(sprintf "Request: looking for transaction #%s at block height #%s" txPos height) | ||
|
||
let height = Convert.ToUInt32 height | ||
let txPos = Convert.ToUInt32 txPos | ||
|
||
let querySettings = | ||
QuerySettings.Default ServerSelectionMode.Fast | ||
|
||
let getTransactionFromPosIdJob = ElectrumClient.GetBlockchainTransactionIdFromPos height txPos | ||
let! txId = | ||
Server.Query Currency.BTC querySettings getTransactionFromPosIdJob None | ||
|
||
let getTransactionJob = ElectrumClient.GetBlockchainTransaction txId | ||
let! tx = | ||
Server.Query Currency.BTC querySettings getTransactionJob None | ||
|
||
return tx | ||
} | ||
) | ||
) |> ignore | ||
|
||
app.Run() | ||
|
||
0 // Exit code | ||
|
19 changes: 19 additions & 0 deletions
19
RgsToElectrumServerMiddleware/RgsToElectrumServerMiddleware.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="Program.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="NBitcoin" Version="6.0.17" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\geewallet\src\GWallet.Backend\GWallet.Backend.fsproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters