Skip to content

Getting Started

github-actions[bot] edited this page Oct 20, 2026 · 20 revisions

Installation

Bundler:

# Gemfile
gem 'mixin_bot'
bundle install

Or directly:

gem install mixin_bot

The gem ships the mixinbot executable. The separate mixin native CLI is optional — it is used only by encode_raw_transaction_native and decode_raw_transaction_native.

First call

Configure credentials on the global configuration, then call the API:

require 'mixin_bot'

MixinBot.configure do
  self.app_id = '25696f85-b7b4-4509-8c3f-2684a8fc4a2a'
  self.session_id = '25696f85-b7b4-4509-8c3f-2684a8fc4a2a'
  self.session_private_key = 'base64-ed25519-or-pem-rsa-key'
  self.server_public_key = 'base64-or-hex-public-key'
  self.spend_key = 'base64-encoded-spend-key' # required for Safe transfers
end

puts MixinBot.api.me['full_name']

MixinBot.api.assets.each { |a| puts "#{a['symbol']}: #{a['balance']}" }

MixinBot.api is a singleton MixinBot::API bound to the global configuration. For an additional bot, build a dedicated instance — see Configuration.

Safe transfer

result = MixinBot.api.create_transfer(
  members: '6ae1c7ae-1df1-498e-8f21-d48cb6d129b5',
  asset_id: '965e5c6e-434c-3fa9-b780-c50f43cd955c',
  amount: '0.01',
  memo: 'test transfer',
  trace_id: SecureRandom.uuid
)
puts result['transaction_hash']

spend_key must be configured (or passed per call) — the Safe pipeline signs with it. create_transfer selects UTXOs, builds, verifies, signs and submits in one call; see Safe Pipeline.

Note: Several convenience methods (me and friends) historically return the inner data hash. MixinBot::Models::ApiEnvelope also allows res['data']['user_id'] style access — see Models.

Prerequisites

  • Ruby >= 4.0 (mixin_bot.gemspec sets required_ruby_version >= 4.0.0)
  • Bundler 2.6+ recommended
  • Optional mixin CLI for the native encoder helpers

Common commands

Command Purpose
rake Default task: test + rubocop
rake test Offline test suite (WebMock stubs)
rake test_live Live API tests (LIVE=1 rake test, needs test/config.yml)
rake mixin_bot:api_coverage Compare the endpoint catalog with the Go SDK
rake rdoc Generate doc/
rake build Build the .gem package
rake publish Build and push to RubyGems

Source

Clone this wiki locally