#!/usr/bin/perl use lib '.'; use strict; use warnings; use HTTP::Tiny; use JSON; use Data::Dumper; use CGI; use JSON::XS; use Digest::MD5 qw(md5_hex); use JSON::Create 'create_json'; use constant false => 0; use constant true => 1; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); print "Content-type: text/html\n\n"; my $md5_data = "FB5alkerbyE1!"; # USER KEY my $md5_data1 = "ASKkerbyC45!#4KK0"; # BACKUP KEY my $md5_data2 = "JJBTkerbyC45!#400"; # BITGO KEY my $md5_hash = md5_hex( $md5_data ); my $md5_hash1 = md5_hex( $md5_data1 ); my $md5_hash2 = md5_hex( $md5_data2 ); my $url = "https://app.bitgo.com/api/v2/btc/wallet"; my $json = encode_json { # isCold => 1, # if enabled this is the error it occur {"error":".isCold should be boolean label => "WallZZZ", m => 2, n => 3, keys => ["$md5_hash","$md5_hash1","$md5_hash2"] }; my $http = HTTP::Tiny->new( default_headers => { Authorization => 'Bearer v2x8860bb4d615cf139191b1e98a69598cae4aded3c71f007c67', } ); my $response = $http->post( $url => { content => $json, headers => { 'Content-Type' => 'application/json' }, }); if ( $response->{'is_success'} ) { print Dumper( decode_json $response->{'content'} ); } else { print "$response->{'content'} $response->{'reason'}\n"; }