bitcoin core – How to develop a crypto exchange leveraging on third party API like coinbase, blockchain.com

I got a request as a developer to develop a bitcoin exchange site like https://mypatricia.co/ or https://instantcoins.ng/ I am to leverage on third party API like Coinbase, blockchain, it could be anything reliable API.

Users will be able to buy and sell bitcoin. For instance USER A makes an offer. USER B is interested in USER A’s offer. When USER B clicks a button, with be a switch from USER A’s wallet to USER B’s wallet. Before the EXCHANGE is done. USER B is prompted to make payment in local currency.

I have been looking at https://developers.coinbase.com/api/v2#introduction https://api.blockchain.com/v3 I dont know how to go about it.

Is there any other better ones to work with?

There will be some other endpoints like

Where users get list of their orders
check wallet etc
I will appreciate your contribution

bitcoincore development – Should I always run “make clean” between building different PR branches of Bitcoin Core?

You could always run make clean between builds but a lot of the time it won’t be necessary and it is slower.

Pieter Wuille usually doesn’t run make clean and only runs it when the build fails.

If it still fails after that he runs git clean -dfx. Warning: This deletes everything and resets your work directory to a fresh checkout. You’ll need to autogen.sh again.

(Glen Willen suggests running git clean -dfX instead of git clean -dfx as X only removes ignored files, x also removes locally added non-ignored files, including e.g. new code you did not yet call git add on)

make clean is only necessary when the configuration changes. This could be because you run ./configure with different flags or it could be because there are substantial changes to the autoconf/automake scripts when changing branches. Of course the act of changing branches isn’t relevant as the build system doesn’t know or care that you are using Git. The build system just sees some code and/or configure scripts changed and re-runs them as necessary. Without make clean it will just see existing .o files not realizing that the rules used to build them have changed

Jon Atack usually doesn’t run make clean but does if there is slight weirdness or if switching to fuzz build or back.

Thanks to Pieter Wuille, Jon Atack, Marco Falke and Glen Willen for answering this question on IRC.

sql server – Visual studio core no conecta a SQLserver 2008 SP1 en linux

Tengo una BBDD sql server funcionando y con conectividad, he instalado visual studio core y he tratado de conectar a la BBDD sin éxito.

He comprobado lo siguiente:

  1. hay conexión a la BBDD me puedo conectar desde DBveaver y desde python sin problemas desde varios pcs incluido desde el que me quiero conectar y alguna VM
  2. El usuario y contraseña son correctos
  3. La ip es correcta, he intentado también hacerlo por nombre de hosts
  4. La BBDD no esta bloqueada, por otros metodos funciona perfectamente
  5. Al configurar la BBDD en visual studio y darle a “probar conexión” me da todo bien

He probado con las extensiones:
SQLtools 0.23.0 con el driver versión 0.2.0
SQL server(mssql) 1.9.0

EL SO es fedora 32

el servidor sql es Microsoft SQL Server 2008 (SP1) – 10.0.2531.0 (X64) (y no se puede actualizar)

Al parecer es un problema con TLS según lo que he logrado encontrar y todas las soluciones hablan de actualizar el SQL server cosa que no es posible

¿alguna sugerencia?

el error que me da:

mssql: Failed to connect: Microsoft.Data.SqlClient.SqlException
(0x80131904): A connection was successfully established with the
server, but then an error occurred during the pre-login handshake.
(provider: TCP Provider, error: 35 – An internal exception was caught)
—> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. —>
Interop+OpenSsl+SslException: SSL Handshake failed with OpenSSL error

  • SSL_ERROR_SSL. —> Interop+Crypto+OpenSslCryptographicException: error:1425F102:SSL routines:ssl_choose_client_version:unsupported
    protocol — End of inner exception stack trace — at
    Interop.OpenSsl.DoSslHandshake(SafeSslHandle context, Byte() recvBuf,
    Int32 recvOffset, Int32 recvCount, Byte()& sendBuf, Int32& sendCount)
    at
    System.Net.Security.SslStreamPal.HandshakeInternal(SafeFreeCredentials
    credential, SafeDeleteContext& context, SecurityBuffer inputBuffer,
    SecurityBuffer outputBuffer, SslAuthenticationOptions
    sslAuthenticationOptions) — End of inner exception stack trace
    — at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken
    message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo
    exception) at
    System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken
    message, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.StartSendBlob(Byte() incoming, Int32
    count, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.ProcessReceivedBlob(Byte() buffer, Int32
    count, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.StartReadFrame(Byte() buffer, Int32
    readBytes, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.StartReceiveBlob(Byte() buffer,
    AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken
    message, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.StartSendBlob(Byte() incoming, Int32
    count, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst,
    Byte() buffer, AsyncProtocolRequest asyncRequest) at
    System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult
    lazyResult) at
    System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions
    sslClientAuthenticationOptions) at
    System.Net.Security.SslStream.AuthenticateAsClient(String targetHost,
    X509CertificateCollection clientCertificates, SslProtocols
    enabledSslProtocols, Boolean checkCertificateRevocation) at
    System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
    at Microsoft.Data.SqlClient.SNI.SNITCPHandle.EnableSsl(UInt32 options)
    at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException
    exception, Boolean breakConnection, Action1 wrapCloseInAction) at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at Microsoft.Data.SqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean& marsCapable, Boolean& fedAuthRequired) at Microsoft.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover, SqlAuthenticationMethod authType, SqlAuthenticationProviderManager sqlAuthProviderManager) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at Microsoft.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool, SqlAuthenticationProviderManager sqlAuthProviderManager) at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) at Microsoft.Data.ProviderBase.DbConnectionFactory.<>c__DisplayClass40_0.<TryGetConnection>b__1(Task1
    _) at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
    at System.Threading.ExecutionContext.RunInternal(ExecutionContext
    executionContext, ContextCallback callback, Object state)
    — End of stack trace from previous location where exception was thrown — at
    System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&
    currentTaskSlot)
    — End of stack trace from previous location where exception was thrown — at
    Microsoft.SqlTools.ServiceLayer.Connection.ReliableConnection.ReliableSqlConnection.<>c__DisplayClass30_0.<b__0>d.MoveNext()
    in
    D:a1ssrcMicrosoft.SqlTools.ManagedBatchParserReliableConnectionReliableSqlConnection.cs:line
    314
    — End of stack trace from previous location where exception was thrown — at
    Microsoft.SqlTools.ServiceLayer.Connection.ConnectionService.TryOpenConnection(ConnectionInfo
    connectionInfo, ConnectParams connectionParams) in
    D:a1ssrcMicrosoft.SqlTools.ServiceLayerConnectionConnectionService.cs:line
    524 ClientConnectionId:d4798651-a241-4ed5-a9c5-ebbb7407fcfa

Restoring bitcoin core wallet – Bitcoin Stack Exchange

I am trying to restore my bitcoin core wallet, but I only have the bitcoin private key and passphrase, I don’t have any wallet. dat file.

I tried with importprivkey privatekey xxxxxxxxxxxxxxxxxxxx

it is giving me Rescan is disabled when blocks are pruned ( code -4 )

Any help is appreciated.

Thanks,
Indian hodl

bitcoin core – Is it possible to query a node for all addresses containing value?

Bitcoin-core (the full node implementation that makes up the majority of the network) does not keep an index of all addresses and balances, so without writing additional code to do the job, it is not possible. Bitcoin-core keeps track of coins via the UTXO model– the idea of ‘an address with a balance’ is just an abstraction of this that makes for a more user-friendly interface.

Of course, you could write some code to create an index of addresses and their respective balances, or perhaps find an already-existing open-source block explorer project that accomplishes this.

What are some of the GitHub alternatives that you consider for Bitcoin Core and other Bitcoin related projects?

Time for Bitcoin Core and other bitcoin related projects to look for GitHub alternatives?

Some of the issues:

https://techcrunch.com/2019/07/29/github-ban-sanctioned-countries/

https://twitter.com/lrvick/status/1320246266270519297

bitcoin core – Password before complete transaction

I was about to spend some bitcoins but Bitcoin Core required my password, which I don’t remember, to complete transaction… The wallet is open but cant use bitcoins.

I would like to know if before ANY transaction, you must ALWAYS enter password. This is the first time I try to send bitcoins so I don’t know how this goes…

Thanks.

bitcoincore development – How will the migration tool from a Bitcoin Core legacy wallet to a descriptor wallet work?

The migration tool will go through all the keys in the legacy wallet and create descriptors for them. This requires considering everything that IsMine matches on. From the Bitcoin Core release notes:

IsMine refers to the function used to determine whether a script belongs to the wallet. This is used to determine whether an output belongs to the wallet. IsMine in Legacy Wallets returns true if the wallet would be able to sign an input that spends an output with that script. Since keys can be involved in a variety of different scripts, this definition for IsMine can lead to many unexpected scripts being considered part of the wallet.

For HD wallets, it is pretty simple to compute the xpriv for the HD seed using a single descriptor. For non-HD wallets but still only key things, it’s a descriptor for each key. The set of scriptPubKeys is finite and O(n!) so it is doable.

For watch-only wallets and multisigs it gets more complicated. Also getting the Descriptor Wallet to treat as IsMine any future script that the Legacy Wallet would have treated as IsMine is probably impossible for all edge cases.

Thanks to Andrew Chow and Pieter Wuille for answering this question on IRC. Any errors are my own.

microservices – Refactoring and moving monolithic ASP.NET Core app to Kubernetes

(This is my very first post here, so I’m sure I violate a few rules of this community, mainly by asking too much questions in a simple post. Sorry for that.)

I have a monolithic ASP.NET Core MVC application which I develop as a hobby project for private use. It can download videos and music from several video sharing websites by using youtube-dl. This application simply shell executes youtube-dl using the correct cmdline arguments, captures stdout and stderr, does some parsing on it, and reports any status changes real-time to the frontend using SignalR. Also, every day when it is idle, shell executes youtube-dl to update itself. I made some changes in the code to limit the maximum parallel downloads to a specified value in appsettings.json.

It does its job fine on a single server. But at work I became an architect associate, learned about Kubernetes, and from scratch I never made my own software for Kubernetes. So, I want to make the following changes:

  1. Refactor the code from monolithic to microservice architecture…
  2. …by considering Kubernetes as the target platform.

Question 0: Does it make sense to make these changes and migrate this project to Kubernetes, considering how youtube-dl is used?

On the backend side, I have two tasks, and both of them requires youtube-dl.

  1. By using the URI given by the user, I have to collect information about the media (title, description, thumbnail image). This task is only network-heavy until youtube-dl gathers the media information and it is done within a few seconds.
  2. Also by the given URI, I have to download the media and present a file to the user. Also, I need to keep the real-time progress report. This is both network and CPU-heavy, since youtube-dl not only downloads the media, but alsp performs video merging and video to audio conversion using FFmpeg. So it takes some time and CPU resources.

Question 1: Sould I separate these responsibilities to two different backend microservice? If I have it separated, I would be able to keep only a few instances for the first task, and several instances for the second (splitted to different nodes). On the other hand, I need to use youtube-dl for both the tasks, so it would also make sense to put it in one service.

My next consideration is the real-time process feedback to the frontend. By separating this project, I have to make a chain: DownloaderMS->FrontendMS->HTML frontend. In the old world I used SignalR. According to the Microsoft docs, using SignalR between DownloaderMS and Frontend does not violate the microservice architecture until I use Redis backplane.

Question 3: By considering Kubernetes and load balancing, is it a good idea to keep using SignalR both on frontend and backend side? Or should I use something else?

The software needs some storage space to store the downloaded media. I think I should have a persistent volume with read-write access for the backend services with 1 hour data retention.

Question 4: Should the backend microservices encapsulate the persistent volume and provide the downloaded media for the FrontendMS on an API endpoint, or is it allowed in microservice architecture to let the FrontendMS access this volume but with read-only permissions?

Question 5: Do you have any other considerations or recommendations?

bitcoincore development – Why is the Bitcoin Core wallet database moving from Berkeley DB to SQLite?

The introduction of descriptor wallets presents an opportunity to introduce a new database backend as descriptor wallets are backwards incompatible. The following is taken from Andrew Chow’s blog post on what’s coming to the Bitcoin Core wallet in 0.21.

Why move from Berkeley DB?

  • Not designed to be used as an application data file. The Legacy Wallet has several hacks as a result and Berkeley DB wallet files can easily be corrupted.
  • Berkeley DB produces extra files which need to be moved with the database file. This means that Berkeley DB is less portable and requires a directory for each wallet.
  • Changes were introduced to Berkeley DB database environment files breaking backwards compatibility.

Why choose SQLite?

  • Can be used as an application data file.

  • New SQLite versions maintains backwards compatibility with versions as far back as 2013.

  • Does not require database environment. A completed write guarantees that the data was written to the database file.

  • Can now move to single wallet files instead of wallet directories.