neto737 / bitgosdk-php Goto Github PK
View Code? Open in Web Editor NEWBitGo SDK written in PHP
License: MIT License
BitGo SDK written in PHP
License: MIT License
Transaction return null
<?php
ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);
require 'vendor/autoload.php';
use neto737\BitGoSDK\BitGoExpress;
use neto737\BitGoSDK\BitGoSDK;
use neto737\BitGoSDK\Enum\CurrencyCode;
$hostname = 'localhost';
$port = 3081;
$coin = CurrencyCode::BITCOIN_TESTNET;
$bitgo = new BitGoSDK('api_token', $coin, true);
$bitgo->unlockSession('0000000');
$bitgoExpress = new BitGoExpress($hostname, $port, $coin);
$bitgoExpress->accessToken = 'api_token';
$bitgoExpress->walletId = 'wallet_id';
/**
* Send the amount in satoshi
*/
$value_in_btc = 0.05;
$amount = BitGoSDK::toSatoshi($value_in_btc);
$sendTransaction = $bitgoExpress->sendTransaction('addres_destinantion', $amount, 'wallet_password');
var_dump($sendTransaction);
have used http://bitgo.com and port 3080 but its giving error
Hi
I used send transaction functionality, but it doesnot return any response.
It showing blank page in return response.
I execute the functionality in local machine.
Please give solution and sample code example.
Thanks.
PHP Fatal error: Uncaught Error: Call to undefined method neto737\BitGoSDK\BitGoSDK::sendTransaction() in /var/www/html/test.php:7\nStack trace:\n#0 {main}\n thrown in /var/www/html/test.php on line 7
PHP7.2 on CentosOS 7
composer already installed, please suggestion what I missed?
Thank you in advance
Hey,
I am new in bitcoin integration. I want integrate your bitgo php sdk in our website built in codeigniter. But i am unable to setup your sdk in our system. Please guide me step by step that how to integrate this sdk.
Please tell me that what is "YOUR_WALLET_PASSPHRASE".
Thanks
Yogesh Goyal
Hello i noticed a missing param on the post parameter to the send crpto functions, 'maxFeeRate'
is it possible to be added.
Found anything that might be related to this? It might help us find the cause.
Anything else?
Hello Neto737,
I am using this SDK for implementation of bitgo wallet. While I am running its function $bitgo->listWalletAddresses('xyz')
xyz = 'my API key'
giving me error
Array ( [error] => unauthorized [name] => Unauthorized [requestId] => cja0w3yb55dvkj9rtcdx6nxck )
Can you please assist me on this. Why I am getting this error.
My skype name is [email protected]
Thanks.
Mo. Rizwan Shaikh
Everything works well on TESTNET, but switching to production, Adding a new wallet is returning null
$hostname = '0.0.0.0'; //THE HOSTNAME YOU INSTALLED THE BITGOEXPRESS (1st step)
$port = 3080; //THE PORT YOU SET IN YOUR BITGOEXPRESS INSTALLATION
$coin = CurrencyCode::BITCOIN; //THE COIN YOU WANT TO USE
$bitgoExpress = new BitGoExpress($hostname, $port, $coin);
$bitgoExpress->accessToken = 'Your_Token';
$label = 'wallet_label';
$pass = 'pass_key';
$generateWallet = $bitgoExpress->generateWallet($pass,$label);
var_dump($generateWallet);
I get a NULL response error with any function in BitGoExpress, both as a local server and in the cloud.
I leave the code used that is completely copied from the example.
$hostname = 'localhost';
$port = 3080;
$coin = CurrencyCode::BITCOIN_TESTNET;
$bitgoExpress = new BitGoExpress($hostname, $port, $coin);
$bitgoExpress->accessToken = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx';
$generateWallet = $bitgoExpress->generateWallet('LABEL', 'PASSPHRASE');
var_dump($generateWallet);
RESP: NULL
2.1.10
3002fba#diff-77d36084e24607dfce767db7e835c19fL231
public function createWalletAddress(bool $allowMigrated = false, int $chain = 0, int $gasPrice = null, string $label = null)
public function createWalletAddress(int $chain = AddressType::P2SH_DEPOSIT, string $label = null, bool $lowPriority = false, int $gasPrice = null)
Perhaps this warranted a major version increase instead?
"neto737/bitgosdk-php": "^2.1",
Hello can you add search address by label. In bitgo documentation endpoint below has param labelContains
which help us find address by label.
https://test.bitgo.com//api/v2/{coin}/wallet/{walletId}/addresses
Thanks a lot)
hello.
I m using your library.
I have integrated your code into my codeigniter project.
And I chanaged your code a little.
public function __construct()
{
$this->_ci = & get_instance();
}
public function set_init($accessToken, $testNet = false)
{
$this->accessToken = $accessToken;
$this->testNet = $testNet;
if ($this->testNet) {
$this->API_Endpoint = self::BITGO_TESTNET_API_ENDPOINT;
} else {
$this->API_Endpoint = self::BITGO_PRODUCTION_API_ENDPOINT;
}
var_dump($this->API_Endpoint);
}
... ... ...
private function execute($requestType) {
$ch = curl_init($this->url);
if ($requestType === 'GET') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
} elseif ($requestType === 'PUT') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->params));
} elseif ($requestType === 'DELETE') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
} elseif ($requestType === 'POST') {
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($this->params));
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer ' . $this->accessToken));
curl_setopt($ch, CURLOPT_CAINFO, dirname(FILE) . '/cacert.pem');
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
i called in controller.
$access_token = 'XXXX';
$wallet = "XXX";
$this->bitgosdk->set_init($access_token, true);
$result = $this->bitgosdk->listWalletTransactions($wallet);
response data is :
"https://test.bitgo.com/api/v1" array(3) { ["error"]=> string(12) "unauthorized" ["name"]=> string(12) "Unauthorized" ["requestId"]=> string(25) "cjf9ji8ux0alwitrt3ddzmdh9" }
I need to help me
In the getWalletAddress function you need to use execute('GET') as below, you didn't have the 'GET' and it was always returning null. Just FYI.
public function getWalletAddress(string $wallet,$cointype,$id) {
$this->url = $this->API_Endpoint . '/' . $cointype . '/wallet/' . $wallet . '/address/'.$id;
$this->params = [
'wallet' => $wallet
];
return $this->execute('GET');
}
Type here, e.g. 2.1
Found anything that might be related to this? It might help us find the cause.
Anything else?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.