Programming Challenges & Improvements - Discussion

Welcome to the discussion thread about this lecture section. Here you can feel free to discuss the topic at hand and ask questions.

Challenge 2:
Took me quite some time to figure it our my solution is actually working. :smiley:
But you can only see the information on the BitPay dashboard. Can you change the invoice information shown to the user?

Good job! What invoice information are you talking about?

It would have done it a week ago. But I was…offline! Neighbor cut my cable.

Can I change the design of the invoice and what is displayed? Here:

By the way, maybe its just me, but it was kind of to easy :slight_smile:

I think a better example for a LAPP would be how to create some kind of money streaming service. Like video streaming, not just how to create simple invoices. It would better present the capabilities of lightning network.

Can I do this using BitPay or would I be required to set up my own node to achieve the desired throughput?

No, since we are using the btcpay library to display the invoice we can’t change the look. However, when the invoice was created you get the invoice in both text and QR code in the response from the server. You can choose to display that however you like instead of using the btcpay library we imported. That’s how you can achieve more customization.

I understand that the challenge might be too easy for some people, it’s a difficult balance since we have both new and experienced devs here.

As for the streaming idea, I LOVE IT. However, the tech was not really ready when I recorded this course. Maybe I can add it in the future. Because now we should be able to do it.

Take a look at this blog post and the github commit linked within it:

As long as you have an up to date lightning node you can now send payments without an invoice. Which is really what you need in order to stream money. Now you only need to attach that to a server that will query the lightning node to send the payments every second or every minute or whatever. Unfortunately btcpay doesn’t support this right now through a nice interface, so you need to do it yourself.

1 Like

Ojojoj on the second challenge you say you think it’s the same people behind bitpay and btcpayserver, they’re not! :slight_smile: There is a famous tweet from Nicolas Dorier on bitpay segwit2x bullshit and says “I will make you obsolete”, that’s btcpayserver :smiley:


Hahaha that’s great :smiley:

1 Like

btw jfyi, the first 31 seconds of the 4th challenge ‘Challenge UI’ are bloopers you could edit out. Although it’s also kind of fun to watch haha :smiley:

Hahaha, how come nobody told me before :smiley: We will edit it and re-upload! Thanks.

I can tell you there have been worse mistakes edited out :wink:

I got challenge two working and should lie when I say I didn’t look to the solution:-) But to show something else I made a solution to get 10 satoshis out of a faucet. Idea is to create a sort quiz. When you answer the right questions you will earn satoshis. To get users onboard I setup a faucet first where the users can get soms satoshis to start the quiz. When you go to you have to follow all the steps. In the last step you will get some satoshis out of a faucet so long there are, you can get them. Have to work on this further.

1 Like

I created a new challenge for myself and was wondering if this is possible first of all.

Idea is to create a sort quiz test. User have to pay for a quize, let’s say 10 satoshis. After payment a quiz comes up with random 10 questions (I know this step can be done). The next step that the user will get for every good answer a satoshi back is a difficult one seems to me. Could this be possible? Making use of return money?!

1 Like

Hello sir, I think it can be possible, you could try to create a function that track the amount of questions that are correct, but there is no way to “return the money”, let me put it this way:

  • User pay 10 satoshis, got permission to 10 questions.
  • User start the quiz, 1 question correct = 1 satoshi. (here is where the function comes up).
  • User finish the quiz, lets say 7/10 correct, that meanst 7 satoshis earned.
  • The function that calculate the amount of correct questions should then pass that data to another function.
  • The other function does only have to create a payment to the address of the User, so in this case will have to create a transaction for 7 satoshis.

Is not a return money function, is a builder of a new transaction based on the amount of correct answers.

Hope you find this useful! :slight_smile:

If you have any doubt, please let us know so we can help you!

Carlos Z.

Challenge 2:
I believe the documentation is incorrect about locality, region and postalCode:
locality => city
region => state
postalCode => zip

1 Like

Thanks, will try to work this out.

1 Like