$input->addAddress("n3D2YXwvpoPg8FhcWpzJiS3SvKKGD8AXZ4"); /// Tx outputs $output = new \BlockCypher\Api\TXOutput(); $output->setAddresses(array("03798be8162d7d6bc5c4e3b236100fcc0dfee899130f84c97d3a49faf83450fd81", "03dd9f1d4a39951013b4305bf61887ada66439ab84a9a2f8aca9dc736041f815f1", "03c8e6e99c1d0b42120d5cf40c963e5e8048fd2d2a184758784a041a9d101f1f02")); $output->setScriptType("multisig-2-of-3"); $output->setValue(1000); // Satoshis /// Tx $tx = new \BlockCypher\Api\TX(); $tx->addInput($input); $tx->addOutput($output); /// For Sample Purposes Only. $request = clone $tx; $txClient = new \BlockCypher\Client\TXClient($apiContexts['BTC.test3']); try { $txSkeleton = $txClient->create($tx); } catch (Exception $ex) { ResultPrinter::printError("Created Multisig TX (fund multisig address)", "TXSkeleton", null, $request, $ex); exit(1); } ResultPrinter::printResult("Created Multisig TX (fund multisig address)", "TXSkeleton", $txSkeleton->getTx()->getHash(), $request, $txSkeleton); return $txSkeleton; // ## TX request object: // // Source: <a href="https://live.blockcypher.com/btc-testnet/address/n3D2YXwvpoPg8FhcWpzJiS3SvKKGD8AXZ4/">n3D2YXwvpoPg8FhcWpzJiS3SvKKGD8AXZ4</a> // // Destination: <a href="https://live.blockcypher.com/btc-testnet/address/2Mu7dJvawNdhshTkKRXGAVLKdr2VA7Rs1wZ/">2Mu7dJvawNdhshTkKRXGAVLKdr2VA7Rs1wZ</a> // // Script type: multisig-2-of-3 // // Value: 1000 satoshis
require __DIR__ . '/../bootstrap.php'; /// Tx inputs $input = new \BlockCypher\Api\TXInput(); $input->setWalletName("5596926E976A1149871172"); //$input->setWalletName("AC33394F28292099183"); $input->setWalletToken("c0afcccdde5081d6429de37d16166ead"); /// Tx outputs $output = new \BlockCypher\Api\TXOutput(); $output->addAddress("mvwhcFDFjmbDWCwVJ73b8DcG6bso3CZXDj"); $output->setValue(1000); // Satoshis /// Tx $tx = new \BlockCypher\Api\TX(); $tx->addInput($input); $tx->addOutput($output); /// For Sample Purposes Only. $request = clone $tx; $txClient = new \BlockCypher\Client\TXClient($apiContexts['BTC.test3']); try { $output = $txClient->create($tx); } catch (\BlockCypher\Exception\BlockCypherConnectionException $ex) { $data = $ex->getData(); $txSkeleton = new \BlockCypher\Api\TXSkeleton($data); ResultPrinter::printError("Created TX", "TXSkeleton", null, $request, $ex); exit(1); } catch (\Exception $ex) { ResultPrinter::printError("Created TX", "TXSkeleton", null, $request, $ex); exit(1); } ResultPrinter::printResult("Created TX", "TXSkeleton", $output->getTx()->getHash(), $request, $output); return $output;