Skip to content

Instantly share code, notes, and snippets.

@daoka
Last active November 26, 2017 00:31
Show Gist options
  • Save daoka/61cccd5228ca4df41f41c600a73cb0bb to your computer and use it in GitHub Desktop.
Save daoka/61cccd5228ca4df41f41c600a73cb0bb to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'nis'
# turn on output request information
Nis.logger.level = Logger::DEBUG
PRIVATE_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
nis = Nis.new(host: '23.228.67.85')
keyPair = Nis::Keypair.new(PRIVATE_KEY)
mosaic = nil
mosaic_difinitions = nis.namespace_mosaic_definition_page(namespace: 'daoka')
mosaic_difinitions.each do |md|
#p md.mosaic.id.name
#p "------"
if md.mosaic.id.name == 'daokasweep'
mosaic = md.mosaic
p mosaic
end
end
tx_log_file = File.open("tx_log.txt", "w")
File.open("address.txt", "r") do |f|
f.each_line do |addr|
address = addr.chomp
tx = Nis::Transaction::Transfer.new(address, 1, 'mosaic send test')
tx.mosaics << Nis::Struct::MosaicAttachment.new(mosaic, 1)
req = Nis::Request::Announce.new(tx, keyPair)
res = nis.transaction_announce(req)
p address
p res.transaction_hash
p "--------------------"
tx_log_file.puts("#{address} : #{res.transaction_hash}")
sleep(3)
end
tx_log_file.close
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment