ADDED examples/generate-work-rpc/generate-work-rpc Index: examples/generate-work-rpc/generate-work-rpc ================================================================== --- /dev/null +++ examples/generate-work-rpc/generate-work-rpc @@ -0,0 +1,26 @@ +#! /usr/bin/env tclsh + +package require nano + +if {[llength $argv] < 2} { + puts stderr "Usage: generate-work-rpc ..." + + exit 1 +} + +set rpcURL [lindex $argv 0] +set argv [lrange $argv 1 end] + +package require http 2 +::nano::rpc::client::init url $rpcURL + +foreach arg $argv { + if {[catch { + set work [::nano::rpc::client work_generate -hash $arg -use_peers true] + set work [dict get $work work] + } err]} { + puts stderr "Error generating work for \"$arg\": $err" + } else { + puts "WORK($arg) = $work" + } +}