Bitcoin Forum
May 08, 2024, 02:33:23 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: Is Python good for bitcoin apps?  (Read 388 times)
MrCrank (OP)
Sr. Member
****
Offline Offline

Activity: 1336
Merit: 258



View Profile
February 08, 2018, 09:28:42 AM
 #1

Hi,

I want know, Is Python good for bitcoin apps?

I want to try make easy bitcoin app and heard that Python is best for coding blockchain..
Is it really? (I choose new stack for code)

or best stack MEAN?

What language you use for coding?

Thanks.
1715178803
Hero Member
*
Offline Offline

Posts: 1715178803

View Profile Personal Message (Offline)

Ignore
1715178803
Reply with quote  #2

1715178803
Report to moderator
Whoever mines the block which ends up containing your transaction will get its fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
February 08, 2018, 11:50:08 AM
Merited by OgNasty (1), LoyceV (1)
 #2

I want know, Is Python good for bitcoin apps?

Depends on what you mean with "apps".
Python is a scripting language.
You won't be able to comfortably code "big" software using python

For small scripts, sure.. python is awesome IMO.



I want to try make easy bitcoin app and heard that Python is best for coding blockchain..
Is it really?

There is no "best for coding blockchain".
Blockchain is a technology. Bitcoin utilizes blockchain.

The best programming language to code scripts/programs is the one you are most comfortable with!

If you are just starting to program and you don't want to code a wallet like electrum from scratch i would say Python is pretty good to get started.
Its straight forward and lets you pretty much "do whatever you want" without having to worry about memory allocation, etc.. too much



What language you use for coding?

I personally use either C, Java or Python.
Most preferably i use python because.. well.. its basically like writing pseudo code.
Additionally you can basically modify strings/data in python any way you want without having to write 100's of lines just for a simple modifying function.

jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
February 08, 2018, 11:51:45 AM
 #3

Python is used a lot of programming apps as it's easier to program and is a bit more forgiving syntax wise than other programming languages are.

There are some useful code snippets on github depending on what specifically you're trying to program for? If you want to look into basic stuff, there's a Python module called Bitcoin-tools that might be helpful if you don't want to code from scratch.

As an extra note, Python is quite slow as a language to run (not entirely sure why) so you can't make really complex stuff using it, for that you'd turn to C/C#/C++.
Julia_KA
Member
**
Offline Offline

Activity: 96
Merit: 15


View Profile
February 08, 2018, 11:55:58 AM
 #4

Python is used a lot of programming apps as it's easier to program and is a bit more forgiving syntax wise than other programming languages are.

There are some useful code snippets on github depending on what specifically you're trying to program for? If you want to look into basic stuff, there's a Python module called Bitcoin-tools that might be helpful if you don't want to code from scratch.
Thank you for a cool tip! Will definitely check github out. I'm not that good at Python but it's interesting to see what people came up with. Thanks again!  Cheesy
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
February 08, 2018, 12:43:22 PM
 #5

As an extra note, Python is quite slow as a language to run (not entirely sure why) ...

For the ones of you who are interested in why phyton is slower than other languages (C for example):

1) Python is more of a interpreted than compiled language. (This is dependend on the implementation. Bust mostly its interpreted)


2) Initialization of variables is dynamically, not statically.
In C the compiler knows the type of a variable by its definition.
In Python the interpreter only knows that assigned variables are objects. The interpreter has to create/initialize a new python object to hold the returned value when the code is already running.


3) Pythons object model leads to inefficient memory access
Regarding Arrays:
In C you have a pointer to a contiguous data buffer.
In Python (list) you have a pointer to a contiguous buffer of pointers, each of which points to a python object which has references to its data.
This make python more expensive in terms of storage and access time.


bitcoinvamp
Full Member
***
Offline Offline

Activity: 182
Merit: 100


View Profile
February 08, 2018, 05:41:00 PM
 #6

Hi,

I want know, Is Python good for bitcoin apps?

I want to try make easy bitcoin app and heard that Python is best for coding blockchain..
Is it really? (I choose new stack for code)

or best stack MEAN?

What language you use for coding?

Thanks.
I think choosing a language is not what matters but what matter is that in which language you are more comfortable and which language you know better. But i guess python is way more easy to operate than java , c++ or even C . I personally like to use either python or perl both are extremely easy to use compared to java and c++. Python is preferred more because it can be compiled into a executable code or even can run uncompiled. Python is way easier to understand even for beginners so choosing python over java and C++ will be a good choice.
TechPriest
Sr. Member
****
Offline Offline

Activity: 377
Merit: 282


Finis coronat opus


View Profile
February 08, 2018, 10:12:08 PM
 #7

But i guess python is way more easy to operate than java , c++ or even C . I personally like to use either python or perl both are extremely easy to use compared to java and c++
Python is good for script programs: parsers, bots and others.
But many "big" programs writed on Python. Pywallet, electrum and others.

Python is preferred more because it can be compiled into a executable code or even can run uncompiled.
Every code can be compiled into exe.
You can run code uncompiled only if you have python interpreter.

Python is way easier to understand even for beginners so choosing python over java and C++ will be a good choice.

It's hard to say what's "easier". It depends what you are learning before in your life.

In science we trust!
Welsh
Staff
Legendary
*
Offline Offline

Activity: 3262
Merit: 4110


View Profile
February 08, 2018, 11:07:13 PM
 #8

Python is considered simple by nature and is a little easier to pick up than some programming languages which require a little bit more work to get things to work but, I believe you can learn more from actually running into more problems and figuring them out. The easy way isn't always the most beneficial.
 
MrCrank (OP)
Sr. Member
****
Offline Offline

Activity: 1336
Merit: 258



View Profile
February 09, 2018, 01:53:02 AM
 #9

I want create script and use blockchain node API and create "little" online/offline game  Smiley

Thanks for answers.
I will try get few lessons "Python coding" and
after will make choose.
GarrySingh
Jr. Member
*
Offline Offline

Activity: 77
Merit: 2

CarnaLife.io


View Profile WWW
February 09, 2018, 05:49:14 AM
 #10

Hi,

I want know, Is Python good for bitcoin apps?

I want to try make easy bitcoin app and heard that Python is best for coding blockchain..
Is it really? (I choose new stack for code)

or best stack MEAN?

What language you use for coding?

Thanks.
According to me, if you have complete knowledge of even one kind of programming language, you won't find it difficult to understand a code in another language, I don't think it is necessary to learn python from scratch for this purpose.

CarnaLife | Revolutionizing Healthcare (https://carnalife.io/en)
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
February 09, 2018, 04:26:41 PM
 #11

I want create script and use blockchain node API and create "little" online/offline game  Smiley

Thanks for answers.
I will try get few lessons "Python coding" and
after will make choose.


JSON and URLLIB (preisntalled in Python are helpful - if you are pulling info from it). I started fiddling with pulling block data from it.

They do have a limit of one request per 10 seconds which is quite slow if you want to pull quite a few blocks (I haven't tried going below it but now and again if you make 2 requests in the same 10 seconds it might go unnoticed).
Welsh
Staff
Legendary
*
Offline Offline

Activity: 3262
Merit: 4110


View Profile
February 10, 2018, 02:32:25 AM
 #12

I want create script and use blockchain node API and create "little" online/offline game  Smiley

Thanks for answers.
I will try get few lessons "Python coding" and
after will make choose.


You could tie into that via Python. I would imagine that there's several APIs out there which support the blockchain and Python. Bitcoin is written in c++ but, isn't one of the easiest languages to learn as it's quite awkward in certain areas.
aplistir
Full Member
***
Offline Offline

Activity: 378
Merit: 197



View Profile
February 10, 2018, 08:55:32 AM
 #13

I want know, Is Python good for bitcoin apps?

Python is excellent for bitcoin apps.
What makes is so good is that it already has good easy to use libraries for doing all the math behind bitcoin.
Support for: big numbers, SHA256, ripemod160, elliptic curve operations etc...

Those can be a real PITA if you have to write any of them in C++, or whatever.
Actually C++ also has some libraries you can use, but at least those that I have seen are quite difficult to use and complicated.

On python being slower... yes, compiled languages are faster, but you wont be needing to use the full capabilities of a computer for doing bitcoin operations. 

One example of a python program is Electrum

My Address: 121f7zb2U4g9iM4MiJTDhEzqeZGHzq5wLh
bestr17
Member
**
Offline Offline

Activity: 89
Merit: 10


View Profile
February 10, 2018, 10:18:20 AM
Merited by grumpy619 (1), rejoin (1)
 #14

I would say that if you plan on working on wallet software, learn javascript and how Node.js works.
If you would like to work on bitcoin's core components and someday be a Satoshi 2.0... then learning C++ is the way to go.
If you want to be and all-rounder. Python is an amazing language, and can do things all the way from powering wallets like Electrum and Armory, all the way to powering blockchain parsers and the like.

If I had to pick one, I'd say Python. It's easy to learn.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
February 10, 2018, 11:14:03 AM
Merited by DarkStar_ (2), MrCrank (1)
 #15

I would say that if you plan on working on wallet software, learn javascript..

No. Just no.

Some reasons for javascript to suck hard:
  • JS supports "Number" as the only number format -> Supports only 64bit Doubles
    The problem with large intergers with floating point variables is, that you won't be able to represent large number correctly.
    99999999999999999 == 100000000000000000 evaluates to true in javascript.
    Its kinda suicide to use javascript for handling large numbers (private-/public keys).
  • JavaScript heavily depends on global variables.
    You not just can use them.. you have to use them. This makes it a pain in the ass to get a structure over a complex program (e.g. wallet)
  • There are a lot of traps you have to watch out in JS
    For example: -1 < Number.MIN_VALUE returns true, because Number.MIN_VALUE returns the lowest positive number and the real lowest number is -Number.MAX_VALUE
  • JS has a TON of vulnerabilities. You don't want to have security vulnerabilities in your wallet. To name the most common JS is so vulnerable to: XSS[1] and CSRF[2]


Those were a few reasons. There are way more.
But this should give a small insight why you shouldn't use javascript to code a wallet. In fact, you shouldn't use javascript at all.


[1] https://en.wikipedia.org/wiki/Cross-site_scripting
[2] https://en.wikipedia.org/wiki/Cross-site_request_forgery

MysteryMiner
Legendary
*
Offline Offline

Activity: 1470
Merit: 1029


Show middle finger to system and then destroy it!


View Profile
February 10, 2018, 11:35:44 AM
 #16

As a interpreted language instead of compiled, it is not good for anything serious. Python is modern day version of 90ties Visual Basic.

bc1q59y5jp2rrwgxuekc8kjk6s8k2es73uawprre4j
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
February 10, 2018, 05:25:05 PM
 #17

As a interpreted language instead of compiled, it is not good for anything serious. Python is modern day version of 90ties Visual Basic.

You do realize that:
1) Python scripts can be compiled and
2) Electrum is written in python

Your statement is completely senseless. Unless, of course, you consider electrum as "not serious".
Python is one of the (if not) the best scripting langauge to process/handle data and strings.
It provides a lot of useful functions which you would have to write yourself in other languages (e.g. C/C++/Java).

jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
February 10, 2018, 06:21:08 PM
 #18

As a interpreted language instead of compiled, it is not good for anything serious. Python is modern day version of 90ties Visual Basic.

You do realize that:
1) Python scripts can be compiled and
2) Electrum is written in python

Your statement is completely senseless. Unless, of course, you consider electrum as "not serious".
Python is one of the (if not) the best scripting langauge to process/handle data and strings.
It provides a lot of useful functions which you would have to write yourself in other languages (e.g. C/C++/Java).

I think MysteryMiner is referring to the main console only allowing interpreting of the software.

Microsoft and other companies have made powerful compilers of it though however and yes electrum is mostly written in Python. Even theymos says they like to use electrum for small amounts of bitcoins that he wants to transfer/store.
MysteryMiner
Legendary
*
Offline Offline

Activity: 1470
Merit: 1029


Show middle finger to system and then destroy it!


View Profile
February 10, 2018, 07:09:11 PM
 #19

As a interpreted language instead of compiled, it is not good for anything serious. Python is modern day version of 90ties Visual Basic.

You do realize that:
1) Python scripts can be compiled and
2) Electrum is written in python

Your statement is completely senseless. Unless, of course, you consider electrum as "not serious".
Python is one of the (if not) the best scripting langauge to process/handle data and strings.
It provides a lot of useful functions which you would have to write yourself in other languages (e.g. C/C++/Java).
Yes, I realize that
1) is true
2) also is true.

I consider Electrum as usable software, just as other software written in Python. But remember that a lot of hacking software in early 2000 was written in Visual Basic. It worked, but was nightmare, all those ocx files and also for just simple sending few magic packets and repeating it made like 700KB executable files while same functionality could be implemented in C/C++ that weighs less than 4KB.

Can You optimize Python program to take advantage of various CPU hardware features same as C with inline Assembler does? I doubt. Python is high-level programming/scripting language. By definition it cannot be as good and powerful as low level language like C and ASM. Only advantage of high level language is relatively fast development, ease of portability between Windows and *nix and it is friendly to noobish programmers.

bc1q59y5jp2rrwgxuekc8kjk6s8k2es73uawprre4j
TechPriest
Sr. Member
****
Offline Offline

Activity: 377
Merit: 282


Finis coronat opus


View Profile
February 10, 2018, 09:19:54 PM
 #20

Only advantage of high level language is relatively fast development, ease of portability between Windows and *nix and it is friendly to noobish programmers.

I counted four in your text. Also, i can tell about one more advantage: high level language is better for small projects, like blockchain parser or transaction accelerator or data storage.

In science we trust!
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!