require_relative "./lib/ruby-client" require "json" # :main: README.MD options = { host: "http://127.0.0.1", port: "8005", user: "user", pass: "pass", dev: true, # uri: "http://USER:PASS@IP:PORT", } nimiq = Nimiq::Client.new(options) puts "nimiq init #{nimiq}" # nimiq.ping # print ">>> ", nimiq.instance_variable_get(:@pingres) consensus = nimiq.request("consenasus") puts "custom #{consensus}" # accounts = nimiq.accounts() # puts "accounts #{accounts}" # blockNumber = nimiq.block_number() # puts "blockNumber #{blockNumber}" # consensus = nimiq.consensus() # puts "consensus #{consensus}" # constant = nimiq.constant("BaseConsensus.MAX_ATTEMPTS_TO_FETCH", 10) # puts "constant #{constant}" # createAccount = nimiq.create_account() # puts "createAccount #{createAccount}" # transaction = { # "from": "NQ94 VESA PKTA 9YQ0 XKGC HVH0 Q9DF VSFU STSP", # "to": "NQ16 61ET MB3M 2JG6 TBLK BR0D B6EA X6XQ L91U", # "value": 100000, # "fee": 0, # } # createRawTransaction = nimiq.create_raw_transaction(transaction) # puts "createRawTransaction #{createRawTransaction}" # # new # getRawTransactionInfo = nimiq.get_raw_transaction_info("010000...abcdef") # puts "getRawTransactionInfo #{getRawTransactionInfo}" # getAccount = nimiq.get_account("NQ30 JLD6 U347 DFVU 40J3 F93V 9TCF YMMX RKY3") # puts "GetAccount #{getAccount}" # getBalance = nimiq.get_balance("NQ30 JLD6 U347 DFVU 40J3 F93V 9TCF YMMX RKY3") # puts "GetBalance #{getBalance}" # getBlockByHash = nimiq.get_block_by_hash("14c91f6d6f3a0b62271e546bb09461231ab7e4d1ddc2c3e1b93de52d48a1da87", true) # puts "getBlockByHash #{getBlockByHash}" # getBlockByNumber = nimiq.get_block_by_number(76415, true) # puts "getBlockByNumber #{getBlockByNumber}" # getBlockTemplate = nimiq.get_block_template() # puts "getBlockTemplate #{getBlockTemplate}" # getBlockTransactionCountByHash = nimiq.get_block_transaction_count_by_hash("dfe7d166f2c86bd10fa4b1f29cd06c13228f893167ce9826137c85758645572f") # puts "getBlockTransactionCountByHash #{getBlockTransactionCountByHash}" # getBlockTransactionCountByNumber = nimiq.get_block_transaction_count_by_number(76415) # puts "getBlockTransactionCountByNumber #{getBlockTransactionCountByNumber}" # getTransactionByBlockHashAndIndex = nimiq.get_transaction_by_block_hash_and_index("dfe7d166f2c86bd10fa4b1f29cd06c13228f893167ce9826137c85758645572f", 20) # puts "getTransactionByBlockHashAndIndex #{getTransactionByBlockHashAndIndex}" # getTransactionByBlockNumberAndIndex = nimiq.get_transaction_by_block_number_and_index(76415, 20) # puts "getTransactionByBlockNumberAndIndex #{getTransactionByBlockNumberAndIndex}" # getTransactionByHash = nimiq.get_transaction_by_hash("9eb228482138a8e64c5bb60608979904aa2be5721c115a9e3db54a0c481bb398") # puts "getTransactionByHash #{getTransactionByHash}" # getTransactionReceipt = nimiq.get_transaction_receipt("465a63b73aa0b9b54b777be9a585ea00b367a17898ad520e1f22cb2c986ff554") # puts "getTransactionReceipt #{getTransactionReceipt}" # getTransactionsByAddress = nimiq.get_transactions_by_address("NQ699A4AMB83HXDQ4J46BH5R4JFFQMA9C3GN", 100) # puts "getTransactionsByAddress #{getTransactionsByAddress}" # getWork = nimiq.get_work() # puts "getWork #{getWork}" # hashrate = nimiq.hashrate() # puts "hashrate #{hashrate}" # log = nimiq.log("BaseConsensus", "debug") # puts "log #{log}" # mempool = nimiq.mempool() # puts "mempool #{mempool}" # mempoolContent = nimiq.mempool_content() # puts "mempoolContent #{mempoolContent}" # minerAddress = nimiq.miner_address() # puts "minerAddress #{minerAddress}" # minerThreads = nimiq.miner_threads(2) # puts "minerThreads #{minerThreads}" # minFeePerByte = nimiq.min_fee_per_byte(0) # puts "minFeePerByte #{minFeePerByte}" # mining = nimiq.mining() # puts "mining #{mining}" # peerCount = nimiq.peer_count() # puts "peerCount #{peerCount}" # peerList = nimiq.peer_list() # puts "peerList #{peerList}" # peerState = nimiq.peer_state("wss://seed-1.nimiq.com:8443/dfd55fe967d6c0ca707d3a73ec31e4ac") # puts "peerState #{peerState}" # pool = nimiq.pool("eu.nimpool.io:8444") # puts "pool #{pool}" # poolConfirmedBalance = nimiq.pool_confirmed_balance() # puts "poolConfirmedBalance #{poolConfirmedBalance}" # poolConnectionState = nimiq.pool_connection_state() # puts "poolConnectionState #{poolConnectionState}" # sendRawTransaction = nimiq.send_raw_transaction("010000...abcdef") # puts "sendRawTransaction #{sendRawTransaction}" # transaction = { # "from": "NQ94 VESA PKTA 9YQ0 XKGC HVH0 Q9DF VSFU STSP", # "to": "NQ16 61ET MB3M 2JG6 TBLK BR0D B6EA X6XQ L91U", # "value": 100000, # "fee": 0, # } # sendTransaction = nimiq.send_transaction(transaction) # puts "sendTransaction #{sendTransaction}" # block="0000000" # submitBlock = nimiq.submit_block(block) # puts "submitBlock #{submitBlock}" # syncing = nimiq.syncing() # puts "syncing #{syncing}" # require_relative "./lib/ruby-client" # aaaaaaaa = Nimiq::Client.new() # puts aaaaaaaa.world