5 March 2021

Pay Button with BTCPAY Server and Mynode without Woocommerce

In this article, I comment on my experiments with BTCPAY Server integrated in Mynode, in order to be able to easily create a payment button to integrate on our website, autonomously, without having to have third-party services, against our own bitcoin node.


BTCPAY advertise itself as something easy and accessible for anyone who wants to open a business accepting bitcoins without the need to resort to third parties. As of today, this objective is certainly complex, even for those who have expert-level knowledge ( https://www.sosthene.net/btcpay-bilan/ ). As far as I can see, the average user is necessarily doomed to either spend the money on a Lunanode-like hosting solution, or at best, have to resort to a DDNS service like no-ip.com ( free) and turn to friends or professionals with high knowledge in the field. Another highly recommended option would be to use the services of bitcoinheiros . For those interested in this initiative, I recommend the recent talk led by Lunaticoin , accessible on youtube .

After many attempts and hours of study, I got stuck in step 3 of this tutorial ( https://docs.btcpayserver.org/DynamicDNS/ , Configure your BTCPay docker install to provide HTTPS certificates) for which you have to go to the command line and the instructions are simply that you connect to your “instance” and run some commands, without further explanation on, for example, how to access the “instance”. If the two previous steps can be done from the graphical interface, I do not understand why they have not done the same with this third step. Maybe that’s nonsense and you really have to do it like this, but I think this should be improved.

To access mynode by ssh, I think the most operative thing to do is to do it on the “settings” page

Image 1

But there it is accessed as admin, not as root and as indicated in the BTCPAY control panel it seems that it should be accessed as root

Picture 2

If you leave it so, when trying the pairing from Woocommerce (by the way we must put the virtual domain that we have followed by “: 49392”, the BTCPAY port) we get a message saying that we must access it through https or of TOR, without instructions on how to access with TOR.

Picture 3

Anyway … After giving up on my attempt to integrate BTCPAY with Woocomerce, I started to think of some other option to, at least, use the “Pay button” that can be configured once we generate a store in BTCPAY:

Picture 4


As we say, the idea was to create a payment button with bitcoins without the need to develop and match a store with Woocommerce or similar with our BTCPAY server, and all this, as BTCPAY is supposed to achieve, using its own means without having to resort to nodes or third-party payment button solutions that, among other things, carry commission in many cases.

We start from the base that we use as a tool Mynode and BTCPAY SERVER included in the Mynode package.

An artisanal solution is simply to give each new customer a new address and send it through traditional means, such as email, but the idea is an automatic solution so that each payment goes to a new address and thus not having to reuse addresses.

The objective, therefore, is to be able to create payment buttons easily, with the generation of an html code to include on the web so that BTCPAY SERVER can interact with our local node, regardless of the server where the web page is hosted where let’s insert the code.

After thinking a lot about the matter, the key to the solution that I present was given to me by the video https://www.youtube.com/watch?v=hQxCOSgYqTo from Satoshi Radio, which showed me the way forward.

Next, I explain the steps with which the commented solution is reached. I am not a computer scientist and surely there may be other methods to achieve the goal set; With this work, I simply explain the path followed in case it could be of interest and utility for other people in a similar or analogous situation.

The idea is to be able to create a payment button or, as indicated below, a link to generate receipts, based on Mynode’s BTCPAY Server, so that we can easily embed it on our website (hosted on a site other than the node de Mynode), which operates against our own Bitcoin node, and without the need to install and integrate BTCPAY with Woocommerce or similar platforms.


Store creation in BTCPAY Server

First, from Mynode we access BTCPAY Server and create a store. We will have to configure the wallet to which we associate the store, for which there are different options. One of them is to enter the public master key of a wallet whose private keys are not in the node or equipment connected to it. This will then allow each user, collaborator or client who clicks on the payment button or link to generate a new address not previously used, which benefits the privacy of both the site that hosts the payment button and the payer.

In the “Payment” section of “General Settings” of the store created, we have to enable the “Allow anyone to create invoice” box.

Picture 5

Enable VPN in Mynode

At first, I thought it was necessary to enable VPN access to our Mynode node ( https://mynodebtc.com/guide/vpn ) with the port forwarding mentioned in the guide. I did so in the beginning, but, curiously, I have realized that for this solution it is not necessary to enable the VPN in Mynode, nor the port forwarding in the router. We avoid all this port forwarding if we use TOR, as I comment at the end of the article.

BTCPAY Server port forwarding

This is one of the keys to the process, as it is necessary to do so if we do not want to use TOR. We have to go to our router and do a port forwarding (Port Forwarding) 49392 which is the one used by BTCPAY Server. Depending on your router, this will be done in one way or another. In this redirection, you will have to put the local IP of your Mynode node in a similar way to that mentioned in the previous section. I have tried to remove this forwarding and then, as expected, the thing does not work, unless we use the TOR option that I comment later.

Create the payment button

Once this is done, within the BTCPAY store menu we go to the “Pay Button” section and configure the parameters we want, such as the button payment amount, the size of the image, etc.

By clicking the Preview button on the right side, we can check if the whole process is on the right track.

Using the generated HTML code

Once everything is correct, at the end of the page we can see the “Generate Code” that will be something like the following:

If we look at it, there are 2 calls to… mynode.local: 49392… What we have to do is copy all the code, paste it into a plain text editor and replace the two instances of “mynode.local” with the public IP that it has. the Mynode node. If we paste that code in the WordPress input like this, I don’t know exactly for what reasons, the thing does not work well.

But if instead of copying the code, we paste it into a txt file, change the extension to html and upload it to the web as a standalone file, curiously then it works ( here example which will only work if we use TOR browser). Another problem that I have observed is that the image of the payment button does not resolve well depending on what circumstances. With the computer with which I am doing everything and locally, it goes well, but when I connected from my mobile or another device, the image did not load, although the link to generate the receipt did. I understand that a solution could be to download the image upload the file to the web and in the aforementioned txt replace the call to the image that is made to the node by the uploaded image. By the way, wordpress wouldn’t let me upload the svg file and what I had to convert to png.

In some browsers, and depending on the security settings, warnings may appear that the connection is not secure, but hey, this is an experiment and no data will be collected from the visitor. We must also bear in mind that in this way we are exposing the public IP of our node installation, which is why I decided not to make the html files that I referred to earlier accessible.

Creation of payment link for a fixed amount in FIAT currency

The truth is that I don’t really understand why I can’t put the payment button in an entry like this and yet I can put it in a separate html file. If you don’t want to go around with button flourishes and simply generate the receipt directly and for a fixed amount, instead of copying the code at the bottom of the page, you can copy the link that appears to the right of the “preview” image from the “Pay button” section. Keep in mind that every time we make a change in the configuration of the pay button, a new link is generated. And that link, changing “mynode.local” for the node’s public IP does seem to work. In this way, we can embed the link in a normal entry like this, either in text or in an image that we want.

But of course, the problem we have is that when generating the “invoice” the public IP of the node is being revealed, which affects our privacy .

An option to avoid this problem of revealing our IP would be to do the whole process from TOR . That is, we access MYNODE from TOR, from there we access btcpayserver and then the links that are generated, as well as the corresponding ” invoice”, are made to TOR addresses.

The links are generated with the pay button appear like this:
http://u76hm3kfcuro4qyf6mc7ng2x7optl75x6moq6r25ahkc2bx7wwhmsbqd.onion:49392/api/v1/invoices?storeId=FAy9ZoVKrixZwLECeS7FbJ7TkKpxpEm6NUunWGooeNo5&price= 5¤cy = EUR
and thus does not work the thing. The part in bold “5¤cy” should be replaced by “5&currency”. This error in the generation of the link text must be corrected. The error is in the text, the link that is generated after the text is correct. In addition, with this link, we can create all the payment instances that we want with different prices “price = X ” without having to enter the BTCPAY Server again.

Here are a couple of links generated with different values. That will only work if you are viewing the page using TOR Browser.

Example donate 5 euros.

Example donate 10 euros .

Example of a donation page_for variable amountIt will only work if you are viewing the page using TOR Browser.

25 September 2020

Analysis of the European Union Regulation on Markets in Crypto-assets (MiCA) 1. Concepts

Google translation. Working on improving the text.


1. Introduction

A draft of the European Regulation on Cryptoasset Markets (MiCA) (COM (2020) 593) has recently been published, and it is going to bring a tremendous change in the European legislative landscape of cryptocurrencies, crypto-assets if we use the terminology used by the regulator [1 ].

The explanatory memorandum indicates that the proposal supports a holistic approach to blockchain and Distributed Ledger Technologies (DLT), that is, it aims to establish comprehensive regulation of what it calls “crypto-assets”.

The four main objectives mentioned in the memorandum (p. 2) seem laudable, namely: 1.- the creation of a sound legal framework , 2.- to support innovation , 3.- to ensure financial stability, and 4.- to instil appropriate levels of consumer and investor protection. Unfortunately, the impudence and hypocrisy of our politicians make that, more and more often, the explanations of our regulations hide their true intentions, or even express the opposite of what is intended, so that these worthy objectives could be those who are led by the blue pill [2] , and that the red one shows us, instead, the imposition of strong entry barriers to the markets related to crypto-assets through a thick blanket (168 pages) of bureaucratic , financial and technical requirements, thus discouraging innovation, to prolong the agonizing configuration of the current financial system (protect banks), using the protection of citizens as an excuse , since they are very clumsy to know what suits them.

For example: the explanatory memorandum reflects on the difficulties that crypto-asset businesses have to access certain services today when it states on p. 4 that : “the lack of applicable regimes to crypto-asset service providers in many Member States limits the availability of funding and sometimes even wider access to necessary financial services, such as banking services, due to the regulatory uncertainty associated with crypto-assets and therefore crypto-asset service providers” That is, it links the difficulties of access to banking services with the lack of regulation, when, as anyone linked to the sector knows for sure, banks, although they are ready to sell all the blockchain vaporware they can, especially if they are financing it with everyone’s money, they don’t allow legitimate cryptocurrency businesses to make use of the banking system [3] . Something that in Chile has led to litigation by buda.com against the banks [4] , for which, in iterim, they were forced to reopen the accounts that had been closed.


2.- The importance of the concept [5]. Definitions of the Regulation

The draft articulated text, after identifying the object of the regulation, its scope of application and exemptions, in article 3 deals with defining the main concepts that will be used, some of which we will analyze below and which are of great importance.

In this regard, it should be noted that this regime of definitions, if the rule as we know it is approved, can be easily modified in practice, since art. 3.2 empowers the Commission to “to adopt delegated acts in accordance with Article 121 to specify technical elements of the definitions laid down in paragraph 1, and to adjust those definitions to market developments and technological developments.

A true catch-all that will allow the European executive power to decide what behaviors and to what extent fall within the scope of the Regulation.

2.1.- Definition of crypto-asset and distributed ledger technology (‘distributed ledger technology’ or ‘DLT’). Is bitcoin a crypto-asset?

The first two definitions of art. 3 deal with these two concepts. Thus, the Regulation understands by crypto-asset a  digital representation of value or rights which may be transferred and stored electronically, using distributed ledger technology or similar technology. And distributed ledger technology (DLT) is simply defined as a type of technology that support the distributed recording of encrypted data.

One of the doubts that arise with this definition is whether cryptocurrencies such as bitcoin fall within the concept of crypto-asset that the Regulation establishes.

Although it is foreseeable that the European authorities consider bitcoin as one more crypto-asset, the truth is that if we pay attention to the literal wording of the exposed definition, a “digital representation of value“, there are doubts about whether bitcoin fits into it, since that, rather than representing value, bitcoin HAS value [6], it is not a mere representation of it. According to twitter user @fiscalidadbtc, it seems that this expression “comes from the European Banking Authority and is a twisted way of avoiding mentioning the concept of “unit of account”, in a similar way to how it was recommended to change “medium payment” by “means of exchange.” In the aforementioned twitter topic there is an interesting discussion on the concepts of “having value” and “representing value” for those who want to expand the information on this issue. Personally, I share the opinion of @fiscalidadbtc when he compares bitcoin with gold, to consider, as Manuel Polavieja also defends, that bitcoin is an asset with value in itself [7]  and not a mere representation of value.

For a more detailed analysis of the terminology that European authorities have been using to define crypto assets and cryptocurrencies, I recommend the chapter “Cryptocurrencies: legal nature, electronic evidence and taxation” by David Maeztu in the book coordinated by Ofelia Tejerina “Legal Aspects of Cybersecurity” [8], where we see that in 2012 [9], the ECB referred to cryptocurrencies as“ a type of digital money ”, while in 2015 [10] already adopted the current definition of “a digital representation of value”. Later, in another 2016 report [11], the ECB qualified them as “alternative means of payment”, but indicating that ” it would be more accurate to regard them as a means of exchange, rather than as a means of payment.”

For the current Directive on Money Laundering, in the wording conferred by Directive (EU) 2018/843 [12], “virtual currencies” would be a type of crypto-asset, following the definition of the Central Bank of 2015: “representation digital of value that is not issued or guaranteed by a central bank or a public authority, is not necessarily attached to a legally established currency and does not possess a legal status of currency or money, but is accepted by natural or legal persons as a means of exchange and which can be transferred, stored and traded electronically.”

Anyway, if we accept “neatness” as a desease[13] and that bitcoin digitally represents value, even in a self-referential way, as David Maeztu indicates in the aforementioned work, then it would fall within the generic category of crypto-assets, but the European legislator dispenses to go further in defining the key concept of all regulation.

Below we will analyze the types of crypto-assets that the draft expressly mentions.

2.2.- Types of crypto-assets (Art. 3)

Recital 9 of the Regulation tells us that, “beyond the general definition of crypto-assets” (a phrase that doesn’t figure in the second draft published), “A distinction should be made between three sub-categories of crypto-assets, which should be subject to more specific requirements” and these are the following:

2.2.1.- Asset-referenced tokens. Application to the Lightning Network?

The Regulation considers that ‘asset-referenced token’ means a type of crypto-asset that purports to maintain a stable value by referring to the value of several fiat currencies that are legal tender, one or several commodities or one or several crypto-assets, or a combination of such assets.

One of the questions raised by this definition is whether it is applicable to second-layer networks such as the Lightning Network in relation to bitcoin, and which has led to an interesting debate on Twitter [14].

Surely, the European authorities have not claimed that the regime is applicable to the Lightning Network, but the truth is that there are interpretative doubts since it could be considered that the tokens of the said network would be assets referenced to bitcoin. However, if we observe the regime envisaged for these crypto-assets, I understand that we must conclude that the Lightning Network does not imply that we are before the figure of the asset-referenced token, among other things, although there may be those who think otherwise, because we cannot glimpse the existence of the figure of the token issuer (which we will analyze later), to which we require compliance with the requirements imposed for the creation and offer of the token, so in practice, in the network, the Regulation could not influence. And, although [15] the Regulation could be imposed on market operators preventing the exchange of the token, the truth is that this would not affect the very existence and operation of the Lightning Network, just, centralized exchanges could not be used.

Another issue that this wording introduces is the consideration of crypto-assets as means of payment, an expression that does not seem to be to the liking of the European authorities,  or means of exchange (an expression used in the Directive on Money Laundering). Without going into this terminological disquisition now, the evolution of which we have commented in the previous section, it should be noted that the draft, although in the articulated text the expression “means of payment” is not mentioned, it does admit it clearly in the Recitals, at least in relation to the referenced tokens, and especially in which the reference “asset” is a fiat currency and that it even alludes to another of the classic functions of money, the store of value[16]

2.2.2.- Electronic money token or e-money token)

‘electronic money token’ or ‘e-money token’ means a type of crypto-asset the main purpose of which is to be used as a means of exchange and that purports to maintain a stable value by referring to the value of a fiat currency that is legal tender.

As we can see, the definition is practically identical to the previous one, simply limit the referenced asset to a specific fiat currency. Therefore, this type of crypto-assets, in short, is only one type of referenced crypto-assets, when the reference is a specific FIAT currency.

The Regulation subsequently deals with these figures, which it subjects to a differentiated regime with respect to crypto assets in general.


2.2.3.- Utility tokens (Utility token)

These are the crypto assets intended to  provide digital access to  an  application ,  services  or  resources  available in a distributed registry and that  are accepted only by the issuer of that token  to grant access to said application, services or available resources. Let’s think, for example, of the exchange’s own tokens to pay transaction fees or, at a given moment, the one that represents the latest model sword of a game [17] .

2.2.4.- Crypto assets not expressly defined

The above are the  three types of cryptoa-ssets that the standard expressly mentions, but, as we discussed in the previous section, there are other tokens that, falling into the category of crypto-assets, do not have a specific regulation, such as those they represent (or have) value, but that are not referenced to another asset or are not utility tokens, such as bitcoin. As we have said, it is foreseeable that the European authorities will consider bitcoin as a crypto-asset, despite its deficient definition, as shown in Article 4 of the Regulation, which makes a very brief reference to this category when it refers to “cryptoa-ssets [that] are created automatically through mining as a reward for the maintenance or validation of transactions, or similar technology ”.

2.3 Subjective scope. Types of affected by the regulations

As we will see below, the standard establishes a series of subjective figures on which it imposes various obligations that it details throughout its articulated text. In short, there are three: Cryptoasset issuers, crypto-asset service providers, and, as a catch-all, anyone related to crypto-assets.

2.3.1.- Emisor (issuer)

In principle, an issuer (issuer) should be understood as the person who creates and puts the crypto-asset into circulation, but the definition of the Regulation gives the impression of being a bit broader since the issuer is considered to be the person who “offers” crypto assets to third parties. without more. Then we have another definition that should be considered, that of “offer to the public”, which consists of the offer to acquire a crypto asset in exchange for fiat currency or other crypto assets.

A literal interpretation of this definition would result in anyone selling a crypto asset falling into the category, which doesn’t make much sense. It gives the impression that the standard wants to go beyond the concept of creating the crypto-asset, because when it establishes its obligations it refers both to the issuers that offer the crypto-asset and to those who seek its inclusion in a trading or trading platform for crypto-assets, but it is not clear how far this extension goes. Of course, a more precise definition of this figure would have been preferable.

Then we will see that it is expressly excluded from the regime applicable to “issuers” related to currencies such as bitcoin. The art. 4 establishes some of the obligations to which these issuers are subject and the second paragraph of this precept expressly establishes that said obligations will not be enforceable if, among other assumptions, “the crypto assets are created automatically through mining as a reward for the maintenance or validation of transactions, or similar technology ”. It gives the impression that here you are expressly excluding from the figure of the issuer the miners who are constituted as the first holders of the bitcoins that are generated with their activity and that would formally fall within the broad definition of issuer provided by the standard.

2.3.2.- Crypto-asset services Providers

The art. 3 defines the Crypto-asset Service Provider as any person whose occupation or business is the provision of one or more crypto-asset services to third parties on a professional basis. This last expression is important, as it excludes people who do these activities in an unprofessional way, such as an individual who sells cryptocurrencies sporadically.

        And the activities that are considered crypto-asset services are the following:

  1. The  custody and administration of crypto assets  on behalf of third parties, understood as the custody or control, on behalf of third parties, of the crypto assets or the means of access to said crypto assets, when appropriate in the form of private cryptographic keys;
  2. Operating a  crypto-asset trading  or trading platform, which means managing one or more crypto-asset trading platforms, within which multiple third parties, through purchase and sale orders on crypto-assets, can interact in a way that results in a contract, either by exchanging one crypto asset for another or a crypto asset for legal tender;
  3. The  exchange of crypto assets for fiat currency , whereby contracts for the purchase or sale of crypto assets are entered into with third parties against legal tender, using their  own capital ;
  4. The  exchange criptoactivos by other criptoactivo s , for which contracts to buy or sell criptoactivos held with third against other criptoactivos, using  equity ;
  5. The  execution of orders for cryptoassets  on behalf of third parties that means the conclusion of agreements to buy, sell or subscribe one or more cryptoassets on behalf of third parties;
  6. The  placement of crypto assets , which means the marketing of newly issued crypto assets or crypto assets that are already issued, but not admitted to trading on a crypto asset trading platform, to specific buyers and that does not imply an offer to the public or an offer to existing holders of the issuer’s crypto assets;
  7. The  reception and transmission of orders on cryptoassets  on behalf of third parties, which means the receipt by a person of an order to buy, sell or subscribe cryptoassets and the transmission of that order to a third party for execution;
  8. The advice on criptoactivos , consisting of the offering, giving or accepting provide customized or specific recommendations to a third party, either at the request of the party or on the initiative of the service provider criptoactivos providing advice on the purchase or sale of one or more crypto assets, or the use of crypto asset services; 
  9. The  execution of payment transactions  in tokens referenced to assets , consisting of the activity, carried out on behalf of one or more natural or legal persons, of transferring a referenced token from an address or registered position used to receive crypto assets to another, regardless of the underlying obligations between sender and recipient.

The Regulation then provides in its articulated text a differentiated regime for each of these services.

2.3.4.- Anyone related to crypto assets

Finally, in this section of concepts, we have to refer to the provisions contained in Title VI, relating to the abuse of markets that involve crypto assets and that affects, in a generic way, any person related to crypto assets. We will have the opportunity to analyze this Title more closely, but, basically, it affects the use of privileged information and market manipulation.

And so far this first approach to the draft that has been made public. As discussed, it is foreseeable that it will not be definitively approved until 2022, so there will surely be changes in the process. We are currently working on other articles to comment on the implications that this regulation will have and that we will publish.

[4] https://www.buda.com/blog/categories/juicio/  Especially interesting is the intervention of Guillermo Torrealba (@Guilletorrealba) in the Court of Defense of Free Competition (TDLC) of Chile. A gem that anyone interested in bitcoin cannot miss: https://open.spotify.com/episode/5os43SpBh73FSAeeSeNJVk?si=PudYZ-6uTzGL-SyY5vrpJw  

[6] https://twitter.com/fiscalidadbtc/status/1305211216256806913 Reviewing the definition of virtual currencies of the 5AMLD I see that it speaks of “digital representation of value”, as if it were financial assets. Bitcoin does not represent any value, it * has * value. The difference is important. 

[7] “… the essence of Bitcoin… is to be… a present good, a real asset. In other words, it is not the liability or the obligation of anyone, it is not a contract, nor does its nature or qualities depend on any person, entity or group of entities in particular, but on the market in general. Just as who decides what is gold and what is not gold is the market as a whole, with Bitcoin it is exactly the same ”. Cryptocurrencies and Bitcoin: https://www.juandemariana.org/ijm-actualidad/analisis-diario/criptomonedas-y-bitcoin 

[15] https://twitter.com/AleGuardia/status/1307637568662577158 

[16] Recital 10 (first draft): It admits that the referenced asset tokens may have a “payment functionality” and (Recital 9 second draft) that their objective is for their holders to use them as a  means of payment to buy goods and services and as a store of value.
22 (first draft) and 25 (second draft) : they could be widely adopted by users to transfer value or as a means of payments.
Recital 61 (first and second draft): asset-referenced tokens can be used as means of payment.

[17] https://cointelegraph.com/news/new-platform-helps-developers-tokenize-their-games-on-ethereum 

NEWER OLDER 1 2 3 5 6