Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNSHIP PROJECT: Writing Coding in Different Languages for LBTCftCL #10

Closed
shannona opened this issue Jun 10, 2020 · 25 comments
Closed
Labels
intern project This issue is in regards to an internship project. program: lbtcftcl associated with the Learning Bitcoin from the Command Line projects

Comments

@shannona
Copy link
Collaborator

shannona commented Jun 10, 2020

We are looking to fill out Chapter 18 of Learning Bitcoin from the Command Line by offering up six short sections which each describe how to command bitcoind via RPC with a popular programming language.

We have six options:

Each of these sections will include how to set up a developer environment for programming Bitcoin in the language of choice; how to issue RPC commands and get results; how to do basic wallet manipulation; and (ultimately) how to send a transaction. The object is not to create any sort of complete program for the users (as we sort of do in the C sections), but just to show these short fragments to get users the barest of foundation.

Each section needs to be standardized into the same format, shown below, so that anyone can jump from one section to another and see the exact same code in different libraries.

We don't have this precise format anywhere, but take a look at the Java section which is 75% of the way there. The first and second chapters of C may also be of use for the general categories of what we want to do, but do note that (1) it's more in-depth than we want here, and (2) it shows how to write a complete program, which we're not doing here.

The overall concept here is simplicity and brevity. We want to do the minimum necessary to show this functionality, in brief, but leave the readers with enough knowledge to move forward on their own. Obviously, the scope of each chapter is intended to be much smaller than the large-scale C work in Issue #11

Here's the standard section names:

Setup [Language]

Setup the complete IDE for the user to program Bitcoin on a Debian machine using the language of choice. Assume they have none of it at start.

  1. Install anything necessary to code with the library

Setup [any sublibraries]

  1. Install any libraries necessary for accessing RPC
  2. Install any chosen Bitcoin libraries

Remember that our object here is to teach RPC-focused Bitcoin programming. Bitcoin libraries are good to use if that's their paradigm. Maybe the user isn't making the RPC callout themselves, but the functions should still be each tightly connected to an RPC command. If a Bitcoin library is higher level and obscures the RPC functionality, we should not be using it (but it's OK to reference it, below).

Build Your Connection

Make an RPC Call

Using "getmininginfo" as an example

Output Your Response

  1. Get the results
  2. Output the results
  3. Close the connection

Make an RPC Call with Arguments

Is it notably different to send an RPC call with arguments? If so, explain/demonstrate it here with the abstract methodology for encoding and setting parameters. (We'll use it more completely in some of the next section.)

Manipulate Your Wallet

Look Up Addresses

Look Up Funds

Create an Address

Create a Transaction

For More Information

[if there are links to how to do more programming in Bitcoin with this language, this is where to put them; we can link multiple sites, reference books, whatever you think will help people learn more.]

Summary

Just a few sentences on how you set things up and how they worked. See the summaries elsewhere in the course.

@shannona shannona added the intern project This issue is in regards to an internship project. label Jun 10, 2020
@shannona shannona changed the title 2020 Summer Internship Project: Coding in Different Languages 2020 Summer Internship Project: Writing Coding in Different Languages for LBTCftCL Jun 10, 2020
@jodobear
Copy link
Collaborator

@shannona I can take the lead to complete the Python section.

@gg2001
Copy link

gg2001 commented Jun 11, 2020

I can lead the completion of the NodeJS section. I can also help out with the Golang section.

@shannona
Copy link
Collaborator Author

Great. Tag me when you have a section complete & submit a PR. It'll sometimes take me a few days to get back. I'll offer some comments in the short-term, and will then do a full polish way down the road when I complete the big upgrade of the rest of the book.

Looking forward to seeing the material!

@gg2001
Copy link

gg2001 commented Jun 11, 2020

Sure, I'll be submitting a PR soon for the Node.js and Go sections.

The usage code in the README for bcrpc didn't work so I fixed it and submitted a PR. This is my bcrpc fork with the fix: https://github.com/gg2001/bcrpc.

@javiervargas
Copy link

I can lead the completion of the Java section.

@javiervargas
Copy link

@shannona Take a look. I'm deepening in Create a transaction section.
https://github.com/javiervargas/Accesing_Bitcoind_with_Java/blob/master/18_2_Accessing_Bitcoind_with_Java.md

@cprkrn
Copy link

cprkrn commented Jun 15, 2020

@shannona I can take the lead to complete the Python section.

Can help here.

@shannona
Copy link
Collaborator Author

@javiervargas So you inherited a previously written section that could use your work. Definitely feel free to revise what's there as much as you see fit.

Here's some ways you could clean up the previous sections that you inherited:

  1. I'm a bit confused at Maven vs gradle, and this might just be my personal inexperience with Java. But we show the package installation for Maven, and then it looks like gradle comes out of nowhere. Is that because it's a default (if so we should mention it) or is that because it's an alternative (if so, we should show how to get it)?

  2. This isn't quite laid out in the organization I suggest (see the major and minor sections in the outline, with the major sections being what's missing), but that's easy enough to change.

  3. I can't tell what's actually being done in "Look Up an Address". It seems to offer a function then set an address. Maybe we could show its usage and output?

  4. Similarly, "Create a Transaction" shows a function but now how to use it, and not how that connects with the "Send a Transaction" in the next section. (I don't even know what the second argument in sendToAddress is, though my guess is BTCs.

[Generally, we can always add brief explanation about what's being done.]

The summary you created is fine. If you're able to help polish things up (or change them, as you see fit), above, we can have a fine chapter here.

@shannona
Copy link
Collaborator Author

So far I've heard:

Go @gg2001
Java @javiervargas
NodeJS @gg2001
Python @jodobear [help from @cprkrn ? ; you two should discuss]
Rust (unwritten)
Swift (unwritten)

Thanks folks!

@jodobear
Copy link
Collaborator

@shannona I can take the lead to complete the Python section.

Can help here.

Cool! I've already starrted writing it, will share and let's take it from there

@javiervargas
Copy link

@javiervargas So you inherited a previously written section that could use your work. Definitely feel free to revise what's there as much as you see fit.

Here's some ways you could clean up the previous sections that you inherited:

  1. I'm a bit confused at Maven vs gradle, and this might just be my personal inexperience with Java. But we show the package installation for Maven, and then it looks like gradle comes out of nowhere. Is that because it's a default (if so we should mention it) or is that because it's an alternative (if so, we should show how to get it)?
  2. This isn't quite laid out in the organization I suggest (see the major and minor sections in the outline, with the major sections being what's missing), but that's easy enough to change.
  3. I can't tell what's actually being done in "Look Up an Address". It seems to offer a function then set an address. Maybe we could show its usage and output?
  4. Similarly, "Create a Transaction" shows a function but now how to use it, and not how that connects with the "Send a Transaction" in the next section. (I don't even know what the second argument in sendToAddress is, though my guess is BTCs.

[Generally, we can always add brief explanation about what's being done.]

The summary you created is fine. If you're able to help polish things up (or change them, as you see fit), above, we can have a fine chapter here.

  1. In that case I should create a maven project and show results and outputs. You're right, I understand gradle it's an alternative.
  2. OK,
  3. Same as case 1, I'll create methods for lookup an address and create a raw.
  4. I'll try to connect create and send tx and show output. Hope have it this weekend.

@javiervargas
Copy link

@shannona I've add more code and outputs to sections and completed others. Take a look and tell me if it's ready to merge.

https://github.com/javiervargas/Accesing_Bitcoind_with_Java/blob/master/18_2_Accessing_Bitcoind_with_Java.md

@shannona
Copy link
Collaborator Author

@shannona I've add more code and outputs to sections and completed others. Take a look and tell me if it's ready to merge.

https://github.com/javiervargas/Accesing_Bitcoind_with_Java/blob/master/18_2_Accessing_Bitcoind_with_Java.md

Looks great. I have one request:

You "List generatedBlocksHashes = rpcClient.generateToAddress(110, addr1);" but don't really explain what that's doing. If you can add some explanation of that, I think this is ready to PR.

Thanks!

@javiervargas
Copy link

Great!!

Ok, I’ll check it and add it.

@shannona
Copy link
Collaborator Author

Thanks, @javiervargas I've merged the Java content. Is "Javier Vargas" the correct credit for you?

@shannona
Copy link
Collaborator Author

And thanks to @jodobear I've merged in the Python section.

@javiervargas
Copy link

Thanks, @javiervargas I've merged the Java content. Is "Javier Vargas" the correct credit for you?

It's Ok!, thanks!.

@shannona
Copy link
Collaborator Author

A Note for is someone picks up the SWIFT section: we should consider basing it on (or referencing) the code in FullyNoded2.

@gg2001
Copy link

gg2001 commented Jun 25, 2020

@shannona I've completed the JavaScript section and I'm almost done with the Go section. I've submitted a pull request.

@shannona
Copy link
Collaborator Author

@gg2001, terrific, this was a very pleasant surprise!

I've looked it over and offered a general style suggestion that I think could help polish this up and make it an improved teaching piece.

@gorazdko
Copy link
Contributor

gorazdko commented Jun 26, 2020

Rust (unwritten)

I'll write this. Written.

@javiervargas
Copy link

@shannona I've completed last C section and I've submitted a PR.

@shannona
Copy link
Collaborator Author

Hey Folks,

Thanks for all the great work on this. Here's the current status:

Go: Drafted by @gg2001, revisions requested
Java: Updated by @javiervargas (DONE)
NodeJS: Drafted by @gg2001, revisions requested
Python: Written by @jodobear (DONE)
Rust: Written by @gorazdko (DONE)
Swift: Unwritten, but @Fonta1n3 has provided a basis at Issue #137

@gg2001
Copy link

gg2001 commented Jul 1, 2020

@shannona I just made some revisions to the Go and NodeJS sections.

@shannona
Copy link
Collaborator Author

shannona commented Nov 3, 2020

We've got this fully completed as Chapter 17 (https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/17_0_Talking_to_Bitcoind_Other.md), which has been released under v2.0 of Learning Bitcoin.

Thanks for all intern updates to Learning Bitcoin: gg2001 (Go, Node.js sections), gorazdko (Rust section), Javier Vargas (C, Java, Lightning, Tor sections), jodobear (Appendix: Compiling Bitcoin, Python section). I wrote Swift, thanks to that code snipped supplied by Fonta1n3.

@shannona shannona closed this as completed Nov 3, 2020
@ChristopherA ChristopherA changed the title 2020 Summer Internship Project: Writing Coding in Different Languages for LBTCftCL INTERNSHIP PROJECT: Writing Coding in Different Languages for LBTCftCL May 18, 2022
@ChristopherA ChristopherA added the program: lbtcftcl associated with the Learning Bitcoin from the Command Line projects label Oct 4, 2022
@ChristopherA ChristopherA moved this to 2022 Done in High Level Roadmap Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intern project This issue is in regards to an internship project. program: lbtcftcl associated with the Learning Bitcoin from the Command Line projects
Projects
Status: 2022 Done
Development

No branches or pull requests

7 participants