Is there a way to send funds from a specific bitcoin address in a wallet? - send

The first result from Google gave me an answer from 2012 so I wondered if there was a better one than 'use armoury' now?
It's fine if I have to decode the raw transactions, I would be grateful if someone could take me through the steps.
Thanks in advance :)

I'll answer my own question,
It was unbelievably easy.
(from the debug console or command line)
listunspent
produces a/the list of unspent outputs at your disposal.
Make a note of the 'txid', 'vout' and 'scriptPubKey' of each output you wish to use.
Use the 'createrawtransaction' command followed by a list of dictionaries containing the txid's and vout's of the inputs you chose earlier followed by the addresses you wish to send them to (the send to addresses are in a single dictionary, not a list of dictionaries).
createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
If you don't want to send the outputs in total (you want some change for yourself) you will need to include an address that you control in your sending dictionary (from your wallet or somewhere else) since outputs cannot be partially spent, sorry.
To pay the mining fee simply leave some of the total output amount unaccounted for and bitcoin will use it as the mining fee by default (fee is 0.0001 at time of writing).
If all went well you should be given a hex string.
Use the 'signrawtransaction' command to check there are no errors by passing in your new hex string followed by a list of dictionaries with the txid's, vout's and scriptPubKeys we got at the very beginning of all this.
signrawtransaction <hex string> [{"txid":txid,"vout":n,"scriptPubKey":hex},...]
note: in newer versions of bitcoin the list of dictionaries is not required
If you got a new hex with "complete" : true after it then all went well and you can now use the 'sendrawtransaction' command followed by the even newer hex you were just given to broadcast your newly created transaction into the bitcoin network.
sendrawtransaction <new hex string>
If you managed to sign it successfully but get a "code":-22,"message":"TX rejected" error please see the footnote below.
Notice it only took four commands in total:
*get (listunspent)
*create (createrawtransaction)
*sign (signrawtransaction)
*send (sendrawtransaction)
Easy :)
FOOTNOTE:
Be aware if you designate an unusually large fee like 0.5btc (I tried this on the testnet) the network will reject your transaction when you try to broadcast it because it thinks you've made a mistake which I discovered whilst I was experimenting.
(This is also the case if you are trying to spend more BTC than you have available.)
In the end I set the fee to 0.001 and it worked fine, here is a link to my question regarding this situation.

Another possibility is with Electrum. Under the Addresses tab right-click on one with non-zero balance and select 'Spend from'.
You have to click View > Show Addresses if you do not have the Addresses tab.

from where you wanna send your BTC. All you need to fill the withdrawal address of bitcoins. You may send your BTC to Bitfinex with the same process:
Fill withdraw address
Fill amount to be sent.
Verify your payment.
Done.

Related

Setting BTC Pay Server invoice expiration time to never?

This is a follow up question to this post but my question is more programming related so I'm hoping this is the right place to post it.
I too am trying to use BTC Pay Server as a wallet. Thera are two problems:
As described in the article, you have to specify an amount when creating an invoice.
It has a security feature that basically results in you not being able to re-use deposit addresses.
The workaround for problem 1 is to set the invoice amount to 0.000001 BTC. So low that the client will always overpay. That works for me to.
But my problem is that address must not expire ever. I checked the code:
Here you can see the Invoice object.
Here you can see the code in use.
It looks like I might be able to use this:
public function setExpirationTime($expirationTime)
{
if (is_a($expirationTime, 'DateTime')) {
$this->expirationTime = $expirationTime;
} else if (is_numeric($expirationTime)) {
$expirationDateTime = new \DateTime('', new \DateTimeZone("UTC"));
$expirationDateTime->setTimestamp($expirationTime);
$this->expirationTime = $expirationDateTime;
}
return $this;
}
And set the expiration time to the year 3000. So my questions are:
Will BTC Pay server ditch my address if I attempt to use this to make it never expire?
Will I still receive the funds if a user sends to an expired address/
Or is there perhaps a better way to get BTC Pay server to act as a wallet as I want it to?
Thanks!
Will BTC Pay server ditch my address if I attempt to use this to
make it never expire?
Actually, you may encounter the year 2038 problem if the type for expirationTime is DateTime. If that really is the case, it will be set a negative value when you try to pass a value larger than 2038. It is unclear what will happen next.
If the system the code is running on is 64bit, then the Y2038 problem does not apply.
Will I still receive the funds if a user sends
to an expired address
https://docs.btcpayserver.org/FAQ/FAQ-Stores/#payment-invalid-if-transactions-fails-to-confirm-minutes-after-invoice-expiration
If the customer pays the invoice, but it fails to get the defined
number of confirmations within the set period, it is marked as
"invalid." The merchant can then decide whether to accept the invoice
afterward manually or decline it and require additional payment from
the customer. This is an additional protection mechanism against the
volatility
So not exactly - some work is required on your part to accept it, if it expires.
Or is there perhaps a better way to get BTC
Pay server to act as a wallet as I want it to?
Instead of setting it to the year 3000, why don't you just set the invoice a year ahead at a time ?

How to create "Round Robin Call Forwarding Function" in Twilio Stack

I have researched high and low through multiple websites and have not found a single fully documented solution for round-robin call forwarding with-in the Twilio stack; let alone within Twilio Studio. The last time this question was asked in detail was in 2013 so your help is greatly appreciated. I am looking to find a solution to the following to educate myself and others:
[Round Robin Scenario]
Mentioned by Phil Krnjeu on Aug 1 '13 at 23:04, "I'm trying to create a website that has a phone number on it (say, a phone number for a school). When you call that number, it has different secretary offices (A,B,C, D). I want to create something where the main number is called, and then it goes and calls phone number A the first time, the second time someone calls the main number, number B is called, C, then D. Once D is called (which would be the 4th call), the 5th call goes back to A."
The response to the above question was to use an IVR Screening & Recording application which requires the caller to pick an agent which is not a true Round Robin solution. The solution I am looking for and many others require the system to know which agent is in a group and which agent is next to receive a call.
[Key Features Needed]
Ability to add forwarding numbers as identified above A, B, C, D as a group or IVR extensions such as 1 = Management, 2 = Sales and etc...
Set a subsequent calling rule that notates in a DB of some sort. Caller A through D, for example, equals 1 unsuccessful. When caller A has been forwarded a call it now equals 0 successful then the script stops and allows the call to be answered by the user or its voicemail. Then the next call comes in and is forwarded to user B and assigned a 0 successful value, then the script stops.
After the caller finishes the call or finishes leaving a voicemail the script needs to end the call.
[Final Destination]
The round-robin should finalize its call with the forwarded phone numbers voicemail.
[Known Issues]
Forwarding a call to multiple numbers not stopping when someone answers
[Options]
Once this question is posted I am sure someone will ask in the near future what if I wanted the call to be forwarded to a Twilio voicemail instead of using the forwarded phone number's voicemail which could be let's say a cell phone. I do not necessarily need this feature, however, making an additional comment would be very helpful to the community. Thank you for your time.
I have limited knowledge of programming besides having the ability to review articles posted by other users. One article I researched in detail that did not work for me was, "IVR: Screening & Recording with PHP and Laravel."
The solution I am looking for first would be to make this code through the new Twilio Studio interface if that is not possible then any other solution would be helpful to all.
Sam here from the Twilio Support Team. You can build what you've described using Twilio's Runtime suite, Studio, and Functions.
I wrote a blog post with detailed instructions and screenshots here, and I've included a summarized version below as well.
CREATE YOUR VARIABLE
First, you need to create a serverless Variable which will be used as the round robin counter. The variable must be inside an Environment, which is inside a Service. This is the only part of the application where you will need your own laptop. You can see how to create these with any of the SDKs or using curl in the docs.
Create a Service
Create an Environment
Create a Variable
Be sure to copy the SIDs of your Service, Environment, and Variable since you will need that for your function.
For convenience, this is how you create the Variable in NodeJS.
const accountSid = 'your_account_sid';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);
client.serverless.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
.variables
.create({key: 'key', value: 'value'})
.then(variable => console.log(variable.sid));
CREATE YOUR FUNCTION
Create the following Environment Variables here in the console and save set them equal to their respective SID that you saved earlier.
RR_SERVICE_SID
RR_ENV_SID
RR_VAR_SID_CTR
Next, make sure you check the Enable ACCOUNT_SID and AUTH_TOKEN checkbox above the Environment Variables section under Credentials.
Be sure your Twilio Client version in the Dependencies section is set to the latest, so we can be sure it includes the Serverless resources. At the time of writing (March 2020), the default Client version does not include them, so we upgraded to 3.41.1, which was the latest.
Go here in the console and create a blank Function.
Copy and paste the following code and replace the numbers with the ones you would like to include in your Round Robin (make sure the environment variables you just created match what's in the code).
exports.handler = function(context, event, callback) {
// Number List
let numbers = [
"+18652142345", //Sam
"+18651092837", //Tina
"+19193271892", //Matt
// Copy and paste line above to add another number.
];
// Initialize Twilio Client
let client = context.getTwilioClient();
// Fetch Round Robin Ctr
client.serverless.services(context.RR_SERVICE_SID)
.environments(context.RR_ENV_SID)
.variables(context.RR_VAR_SID_CTR)
.fetch()
.then(variable => {
// Use counter value to determine number to call
let number = numbers[variable.value];
// Create var with new ctr value
let ctr = variable.value;
// Check if current counter value is less than RR length (i.e. the number of numbers in round robin)
// If so, increment
if(ctr == numbers.length-1) {
ctr = 0;
}
// Otherwise reset ctr
else ctr++;
// Update counter value
client.serverless.services(context.RR_SERVICE_SID)
.environments(context.RR_ENV_SID)
.variables(context.RR_VAR_SID_CTR)
.update({value: ctr})
.then(resp => {
// Return number to call
let response = {number};
// Return our counter value and a null error value
callback(null, response);
});
});
};
CREATE YOUR STUDIO FLOW
Click the red plus sign to create a new Flow here.
Give the Flow a name and click Next.
Scroll to the bottom of the templates and click 'Import from JSON' and click Next.
Paste the Flow JSON shown here and click Next.
Click the RoundRobin function widget and select the Function you just created under the Default service.
Click the FunctionError widget, click MESSAGING & CHAT CONFIG, and change the SEND MESSAGE TO number to a number that you would like to notify by text in the event of a Function failure.
Click the DefaultNumber widget and change the default number that will be forwarded to in the event of a Function failure.
Click the Publish button at the top of your Flow.
CONFIGURE YOUR TWILIO NUMBER
Go here in the console.
Click the Twilio number you would like to configure.
Scroll down to the A CALL COMES IN dropdown in the Voice section and select Studio Flow.
Select your new Flow in the Select a Flow dropdown to the right.
Click Save at the bottom.
And that's it. You're now all set to test!

How do I pass in the SignatureOption to the FedEx RateRequest API?

For some deliveries I require a signature which is an extra charge. I would like to know what that extra charge is, using the rate request API. I'd like to know if this is the place to get that value or if there is some other way.
In the documentation, I only see the SignatureOption element in the explanation for the RateReplyDetails, but nothing for how to send it to them in the RateRequest. The replies always say "SERVICE_DEFAULT" for the SignatureOption with a value of zero. I would like the reply to come back with, for example, INDIRECT and some dollar amount. Other options for this are ADULT, DIRECT, NO_SIGNATURE_REQUIRED, etc.
Below you can see where I tried putting the element under the RequestedShipment element. But that causes the reply to be an "invalid element" error. I tried it in various places in the RateRequest to no avail.
<ns:RateRequest xmlns:ns="http://fedex.com/ws/rate/v7" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns:WebAuthenticationDetail>
<ns:UserCredential>
<ns:Key>00000</ns:Key>
<ns:Password>00000</ns:Password>
</ns:UserCredential>
</ns:WebAuthenticationDetail>
<ns:ClientDetail>
<ns:AccountNumber>00000</ns:AccountNumber>
<ns:MeterNumber>00000</ns:MeterNumber>
</ns:ClientDetail>
<ns:Version>
<ns:ServiceId>crs</ns:ServiceId>
<ns:Major>7</ns:Major>
<ns:Intermediate>0</ns:Intermediate>
<ns:Minor>0</ns:Minor>
</ns:Version>
<ns:RequestedShipment>
<ns:SignatureOption>INDIRECT</ns:SignatureOption>
<ns:ShipTimestamp>#DateFormat(Now(),'yyyy-mm-dd')#T#TimeFormat(Now(),'hh:mm:ss')#</ns:ShipTimestamp>
<ns:DropoffType>REGULAR_PICKUP</ns:DropoffType>
<ns:PackagingType>YOUR_PACKAGING</ns:PackagingType>
When using more recent versions of the API you need to set the option inside of RequestedPackageLineItems. Only send the element when you've got an actual signature option selection.
<RequestedPackageLineItems>
… dim, weight, etc…
<SpecialServicesRequested>
<SpecialServiceTypes>SIGNATURE_OPTION</SpecialServiceTypes>
<SignatureOptionDetail>
<OptionType>DIRECT|INDIRECT|ADULT|NO_SIGNATURE_REQUIRED</OptionType>
</SignatureOptionDetail>
</SpecialServicesRequested>
</RequestedPackageLineItems>
While adnyknas answer is correct, regarding the place you should put it in your XML, please note that the Signature service request only works in the USA:
This is info I got from FedEX tech support:
Signature Require (SR) services are unavailable in most countries. It is for FedEx Express U.S. package services and FedEx Ground U.S. services only in U.S.A. Refer to below restriction from http://www.fedex.com/us/2014rates/surcharges-and-fees.html

Command Status 0x00000011 with submit_multi for SMPP integration

Hi am integrating with Sybase Mobile 365 Services and I have gotten submit_sm and deliver_sm to work fine. I am trying to get submit_multi to work, but no matter what I try I get back a Command Status = 11. Does anyone have any thoughts as to what that command status means? Why I would get that? I have tried different service types and everything else I can think of... with no success.
Thanks,
Stephen
Command Status = 11 (ESME_RINVDSTADR) means "Invalid destination address".
This mean that probably the the dest_address field in your submit_multi request is wrong.
The dest_address field for submit_multi should be a list of destination address structures as defined in SMPP 3.4 Specification - chapter 4.5.1.1.
The number of destination addresses in the list is set in the number_of_dests field.
Additionally, you could also check that the dest_addr_ton (Type of Number) and dest_addr_npi (Numbering Plan Indicator) are correct for each destination address. For more details about this check out this link.

Using the Bloomberg API, how do I request the price information for the HTUSMOML and GSTHHVIP indexes

Using the Bloomberg API, how do I request the price information for the HTUSMOML and GSTHHVIP indexes.
Part of the basic code which I am using is listed below:
session.OpenService("//blp/refdata");
Service refDataService = session.GetService("//blp/refdata");
Request request = refDataService.CreateRequest("ReferenceDataRequest");
request.Set("security", "HTUSMOML US INDEX");
request.Set("security", "GSTHHVIP US INDEX");
request.Append("fields", "PX_LAST");
request.Append("fields", "OPEN");
I get an error of "Symbol not available in service: ReferenceDataRequest.
Thanks
RC
Have you tried using the same syntax and asking for a well-known index, like INDU or QQQQ or something? That would eliminate a lot of possibilities.
If that works, then are you sure there is reference data available for these indices? Sometimes they only have pricing data, not reference data.
Next, are you sure you are permissioned to get this data? Either you may not be allowed, or your API setup may not be providing proper authentication for an account that does have permission.
If none of that works, you really need to follow Help Help and call the analytics desk for assistance.
There are a few issues with your code you should address:
You're setting the security twice, the second time overrides the first
You probably should be doing
request.Append("securities", ...);
The yellow key which you're specifying should be given in lower case.
Index securities don't have an exchange in their name - lose the US, it's just "HTUSMOML Index"
I recommend not using the yellow key at all, instead use the Bloomberg Global Identifier in this format:
request.Append("securities", "/bbgid/BBG000RGBSK8");
(BTW, BBG000RGBSK8 is the actual Bloomberg Global Identifier for HTUSMOML Index)