Bitcoin Forum
June 01, 2024, 09:55:05 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Electrum Python Console  (Read 27 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
Husna QA (OP)
Legendary
*
Offline Offline

Activity: 2296
Merit: 2892


#SWGT CERTIK Audited


View Profile WWW
May 15, 2024, 02:01:39 PM
 #1

-snip-
Dulu sempat ada sebuah situs yang memberikan penjelasan mengenai kegunaan dan contoh penggunaan argumen dari Console Electrum, namun entah mengapa situs tersebut sekarang sudah tidak bisa diakses lagi.
https://bitzuma.com/posts/an-introduction-to-the-electrum-python-console/

Sebagaimana disebutkan agan z@punk di atas bahwa fungsi dan contoh penggunaan argumen pada Console Electrum yang dijelaskan di situs bitzuma saat ini tidak bisa lagi diakses, namun demikian saya sempat memiliki beberapa salinan terkait penggunaan Console di Electrum tersebut.

Thread ini saya buat tidak untuk diskusi melainkan sebagai salinan/referensi untuk lebih memudahkan pencarian dan terpisah dari thread Electum;
Maka dari itu, untuk diskusi silahkan ke thread Electrum yang sudah ada sebelumnya (https://bitcointalk.org/index.php?topic=3664755.0).


Salah satu fitur yang ada di Electrum adalah Console, tulisan ini mencoba menunjukkan penggunaan Console dan mendokumentasikan fungsi-fungsi bawaannya. Bagi yang baru menggunakan wallet Electrum, mungkin sebaiknya lebih dulu membaca tulisan-tulisan dasar terkait Electrum dengan menggunakan GUI (silahkan merujuk pada thread Electrum diantaranya pada link di atas).


Membuka Console

Console secara default-nya disembunyikan. Untuk menampilkannya pilih menu View -> Show Console. Kemudian klik pada Tab Console dibagian atas jendela utama Electrum.

Contoh tampilan Console pada Electrum di PC saya (bisa saja keterangan yang tertera pada tampilan awal berbeda antara satu Electrum dengan lainnya):




Fungsi Built-in

Electrum men-support berbagai fungsi built-in/bawaan, dan banyak diantaranya yang menyediakan antarmuka command-line untuk hal-hal yang bisa dilakukan melalui GUI Electrum, namun sebagian lainnya hanya mungkin dilakukan melalui Console.

Berikut ini daftar fungsi bawaan yang disupport oleh Console, untuk versi detailnya silahkan merujuk ke sumber dari Electrum:
https://github.com/spesmilo/electrum/blob/master/lib/commands.py <- dulu link nya yang ini, namun nampaknya sudah dipindah dan saya temukan di sini:
https://github.com/spesmilo/electrum/blob/e679e6074f1f915427459e5c7240c3ba818d866e/electrum/commands.py

Note: Untuk deskripsi saya biarkan apa adanya dalam bahasa Inggris.

addrequest

Code:
addrequest(amount, label)

Quote
Create a payment request for amount (in BTC) with label, using the first unused address of the wallet. The address will be considered as used after this operation. If no payment is received, the address will be considered as unused if the payment request is deleted from the wallet.


addtransaction

Code:
addtransaction(tx)

Quote
Adds transaction tx (serialized hex format) to the wallet history. tx must have at least one input controlled by the wallet. It’s not clear why this function would ever be necessary.


broadcast

Code:
broadcast(tx)

Quote
Broadcast transaction tx (serialized hex format) to the network.


check_seed

Code:
check_seed(seed, opt_entropy, opt_language)

Quote
Check that seed (a string) was generated with given opt_entropy (optional) and opt_language (optional).


clearrequests

Code:
clearrequests()

Quote
Removes all payment requests. Does not detach labels that may have been attached to addresses by previous requests.


commands

Code:
commands()

Quote
Prints a list of available commands.


createmultisig

Code:
createmultisig(threshold, pubkeys)

Quote
Creates a multisignature P2SH address with threshold and pubkeys (an array). For example, this creates representing a 1-of-2 multisignature address:

Code:
createmultisig(1, ["045a5713f24ba168d9c9d797ce5b9d7867fb936b7ea632cc1da08a6c4ba08aef8f7427e7ee1cf297212b58898657e3426dc9902d9ffc53e41787f8029804d49a87", "048fff4af0894075a46f3abf0b7b51f469e686ede3de2bc70a0bf7767f394362dad564c91ed8808d51aba4238b60b7979c6d805d1e55226d5b8935bdda2e4a47bd", "0405b4f342460aa8512e28a70393dc98117ebb56b10bb38968f986199ff9c5904bf834ba9fd0b323128127baa0e800b2bb12df4672cace22ac48cf6fa742ed2d19"])

Quote
and returns an object representing the result:

Code:
{
    "address": "2NBjFEvBWi7pNcJaLhSh58yD17oKVYHqWJ7",
    "redeemScript": "5141045a5713f24ba168d9c9d797ce5b9d7867fb936b7ea632cc1da08a6c4ba08aef8f7427e7ee1cf297212b58898657e3426dc9902d9ffc53e41787f8029804d49a8741048fff4af0894075a46f3abf0b7b51f469e686ede3de2bc70a0bf7767f394362dad564c91ed8808d51aba4238b60b7979c6d805d1e55226d5b8935bdda2e4a47bd410405b4f342460aa8512e28a70393dc98117ebb56b10bb38968f986199ff9c5904bf834ba9fd0b323128127baa0e800b2bb12df4672cace22ac48cf6fa742ed2d1953ae"
}


createnewaddress

Code:
createnewaddress()

Quote
Creates a new receiving address. The new address will be displayed with a red background to indicate that it falls outside of the gap limit.


InsyaAlloh nanti dilanjut lagi...


Referensi:
https://bitzuma.com/posts/an-introduction-to-the-electrum-python-console/
https://github.com/spesmilo/electrum/blob/e679e6074f1f915427459e5c7240c3ba818d866e/electrum/commands.py

Pages: [1]
  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!