Skip to content

Instantly share code, notes, and snippets.

@inertia186
Last active April 1, 2017 05:40
Show Gist options
  • Save inertia186/3e2949c1e5665f400a1e68c4554dfa7d to your computer and use it in GitHub Desktop.
Save inertia186/3e2949c1e5665f400a1e68c4554dfa7d to your computer and use it in GitHub Desktop.
def signature
public_key_hex = @private_key.pub
ec = Bitcoin::OpenSSL_EC
digest_hex = digest.freeze
loop do
@expiration += 1
sig = ec.sign_compact(digest_hex, @private_key.priv, public_key_hex)
next if public_key_hex != ec.recover_compact(digest_hex, sig)
return sig if canonical? sig
end
end
def canonical?(sig)
sig = sig.unpack('C*')
!(
((sig[0] & 0x80 ) != 0) || ( sig[0] == 0 ) ||
((sig[1] & 0x80 ) != 0) ||
((sig[32] & 0x80 ) != 0) || ( sig[32] == 0 ) ||
((sig[33] & 0x80 ) != 0)
)
end
is_canonical( c ): signature is not canonical
{}
th_a elliptic_secp256k1.cpp:162 public_key
{}
th_a transaction.cpp:187 get_signature_keys
{"*this":{"ref_block_num":25307,"ref_block_prefix":3831486211,"expiration":"2017-03-28T18:47:27","operations":[["vote",{"voter":"social","author":"raaman","permlink":"get-paid-to-share-links","weight":10000}]],"extensions":[],"signatures":["1b001461033e6067e3a40e0a25c1b2fe740152d4b0ce6446b88a1155a7588887420e0c69af249c15023a949a3bb0ba81f50d75da96b0d82e09c0e6a9fb5f85e378"]}}
th_a transaction.cpp:285 verify_authority
{"trx":{"ref_block_num":25307,"ref_block_prefix":3831486211,"expiration":"2017-03-28T18:47:27","operations":[["vote",{"voter":"social","author":"raaman","permlink":"get-paid-to-share-links","weight":10000}]],"extensions":[],"signatures":["1b001461033e6067e3a40e0a25c1b2fe740152d4b0ce6446b88a1155a7588887420e0c69af249c15023a949a3bb0ba81f50d75da96b0d82e09c0e6a9fb5f85e378"]}}
th_a database.cpp:2994 _apply_transaction
{"trx":{"ref_block_num":25307,"ref_block_prefix":3831486211,"expiration":"2017-03-28T18:47:27","operations":[["vote",{"voter":"social","author":"raaman","permlink":"get-paid-to-share-links","weight":10000}]],"extensions":[],"signatures":["1b001461033e6067e3a40e0a25c1b2fe740152d4b0ce6446b88a1155a7588887420e0c69af249c15023a949a3bb0ba81f50d75da96b0d82e09c0e6a9fb5f85e378"]}}
th_a database.cpp:735 push_transaction
{"call.method":"call","call.params":["network_broadcast_api","broadcast_transaction_synchronous",[{"expiration":"2017-03-28T18:47:27","ref_block_num":25307,"ref_block_prefix":3831486211,"operations":[["vote",{"voter":"social","author":"raaman","permlink":"get-paid-to-share-links","weight":10000}]],"extensions":[],"signatures":["1b001461033e6067e3a40e0a25c1b2fe740152d4b0ce6446b88a1155a7588887420e0c69af249c15023a949a3bb0ba81f50d75da96b0d82e09c0e6a9fb5f85e378"]}]]}
th_a websocket_api.cpp:124 on_message
social voting for @wakeupnd/north-dakota-hemp-production-expands-greatly-in-second-year
Pausing 0.2 :: Unable to vote with social. 10 assert_exception: Assert Exception
is_canonical( c ): signature is not canonical
{}
th_a elliptic_secp256k1.cpp:162 public_key
{}
th_a transaction.cpp:187 get_signature_keys
{"*this":{"ref_block_num":57736,"ref_block_prefix":2125514308,"expiration":"2017-04-01T04:44:45","operations":[["vote",{"voter":"social","author":"wakeupnd","permlink":"north-dakota-hemp-production-expands-greatly-in-second-year","weight":10000}]],"extensions":[],"signatures":["1c0011075842d69b4b9bf7517c0c12eb77002f0c62a6fdb6e802294a0e70733e33295a25cf3a3a71a8255a7d358610b0de7a104834b8dcbd11908e67152089e80b"]}}
th_a transaction.cpp:285 verify_authority
{"trx":{"ref_block_num":57736,"ref_block_prefix":2125514308,"expiration":"2017-04-01T04:44:45","operations":[["vote",{"voter":"social","author":"wakeupnd","permlink":"north-dakota-hemp-production-expands-greatly-in-second-year","weight":10000}]],"extensions":[],"signatures":["1c0011075842d69b4b9bf7517c0c12eb77002f0c62a6fdb6e802294a0e70733e33295a25cf3a3a71a8255a7d358610b0de7a104834b8dcbd11908e67152089e80b"]}}
th_a database.cpp:2994 _apply_transaction
{"trx":{"ref_block_num":57736,"ref_block_prefix":2125514308,"expiration":"2017-04-01T04:44:45","operations":[["vote",{"voter":"social","author":"wakeupnd","permlink":"north-dakota-hemp-production-expands-greatly-in-second-year","weight":10000}]],"extensions":[],"signatures":["1c0011075842d69b4b9bf7517c0c12eb77002f0c62a6fdb6e802294a0e70733e33295a25cf3a3a71a8255a7d358610b0de7a104834b8dcbd11908e67152089e80b"]}}
th_a database.cpp:735 push_transaction
{"call.method":"call","call.params":["network_broadcast_api","broadcast_transaction_synchronous",[{"expiration":"2017-04-01T04:44:45","ref_block_num":57736,"ref_block_prefix":2125514308,"operations":[["vote",{"voter":"social","author":"wakeupnd","permlink":"north-dakota-hemp-production-expands-greatly-in-second-year","weight":10000}]],"extensions":[],"signatures":["1c0011075842d69b4b9bf7517c0c12eb77002f0c62a6fdb6e802294a0e70733e33295a25cf3a3a71a8255a7d358610b0de7a104834b8dcbd11908e67152089e80b"]}]]}
th_a websocket_api.cpp:124 on_message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment