From a27438b6cbdb57421c64ab5ac2dd7de2b464d932 Mon Sep 17 00:00:00 2001 From: Efe Date: Thu, 26 Dec 2019 23:09:07 +0300 Subject: [PATCH] Interations --- notes_01.py => 1_notes.py | 0 bitcoincli_02.py => 2_bitcoincli.py | 0 3_digital_signatures | 26 ++++++++++++++++++++++++++ bitcoin_blockreward_calculator.py | 2 +- my2.py | 24 ++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 1 deletion(-) rename notes_01.py => 1_notes.py (100%) rename bitcoincli_02.py => 2_bitcoincli.py (100%) create mode 100644 3_digital_signatures create mode 100644 my2.py diff --git a/notes_01.py b/1_notes.py similarity index 100% rename from notes_01.py rename to 1_notes.py diff --git a/bitcoincli_02.py b/2_bitcoincli.py similarity index 100% rename from bitcoincli_02.py rename to 2_bitcoincli.py diff --git a/3_digital_signatures b/3_digital_signatures new file mode 100644 index 0000000..29db32a --- /dev/null +++ b/3_digital_signatures @@ -0,0 +1,26 @@ +### Digital Signatures ### + +from helpers import mainnet,testnet +from pprint import pprint + +#sign and verify messages like this: signmessage "address" "message" + +#First we have to get an address: +address = testnet.getnewaddress('','legacy') +print(f"Address created with private key is:{address}") + +#Create our message. Just a basic string +msg = 'this is a message' +print(f"Message is:{msg}") + +#Create the signature by signing the address with a message. It returns you a signature +signature = testnet.signmessage(address, msg) +print(f"Signature created with address for the message {msg} is:{signature}") + +#Verify that our signature is valid with my address for 'my message' msg +verified = testnet.verifymessage(address, signature, 'this is a message') +print(f"Verified?:{verified}") + +#If you try the worng msg to sign, it will print false. +verified2 = testnet.verifymessage(address, signature, 'this is a message too') +print(f"Verified?:{verified2}") \ No newline at end of file diff --git a/bitcoin_blockreward_calculator.py b/bitcoin_blockreward_calculator.py index 739187f..2d66e45 100644 --- a/bitcoin_blockreward_calculator.py +++ b/bitcoin_blockreward_calculator.py @@ -2,7 +2,7 @@ from helpers import mainnet from decimal import Decimal def calculate_bitcoin_cycle_and_block_reward(): - #This little program tells you the bitcoin's cycle count and the bitcoin block reward amount + #This little program gives the bitcoin's cycle count and the bitcoin block reward amount INITIAL_SUBSIDY = Decimal(50) BLOCKS_PER_HALVENING = 210000 last_block = mainnet.getblockchaininfo()["blocks"] diff --git a/my2.py b/my2.py new file mode 100644 index 0000000..d41b6be --- /dev/null +++ b/my2.py @@ -0,0 +1,24 @@ +""" +_ = set(map(int, input().split())) +arr = input().split() +s1 = set(map(int, input().split())) +s2 = set(map(int, input().split())) + +print(s1) +print(s2) +print(s3) +print(sum([(i in s1)-(i in s2) for i in arr])) + +n, m = raw_input().split() + +sc_ar = raw_input().split() + +A = set(raw_input().split()) +B = set(raw_input().split()) +print sum([(i in A) - (i in B) for i in sc_ar]) +""" +A = set(input().split()) +B = set(input().split()) +print(A) +print(B) +print(A.issuperset(B)) \ No newline at end of file