Can I send XRP to multiple addresses? - blockchain

I'm new to XRP devlopment and I was making an api for an exchange project with XRP and wanted to know that is XRP can be sent to multiple addresses?

No, it is currently not possible for a single transaction to send to multiple destination addresses. Instead, you should create one transaction for each destination. Be sure to increment the account sequence number (Sequence) so that each transaction sent from the same (source) account has a unique, sequential, monotonically-increasing sequence number.

Related

Offchain Workers & Signed Transactions

It's stated that fn offchain_worker function is called every time by all nodes after a block import. Imagine the case where in fn offchain_worker we make a http call to fetch some not deterministic value from a remote server, and once we get the result we call to pub fn onchain_callback to sign a transaction to include that result in the blockchain state.
If Off-chain workers are executed by all validators after each block import, would I end up with one new signed transaction per validator with different results (remember is not deterministic).
Example. My Off-chain worker fetch a random number from a remote server and callback the result signing a new transaction. If I have in my network 10 validators... questions:
1.- I would end up with 10 new transactions with different random numbers?
2.- It would be executed only by the validators or also by all the full nodes connected to the blockchain?
3.- Is it possible to trigger the Off-chain workers only when a certain extrinsic is included in the block, instead of after every block import?
Yes, if the validators run with default off-chain workers settings.
If this is not desired, your OCW can pick a validator or introduce a
random delay & extra conditions between different runs. We do that
for im-online pallet in substrate repo or offchain phragmen
elections.
Other nodes can opt-in with a CLI flag (and most likely extra keys
to sign transactions), but you can also put a guard in your OCW code
to run only in case sp_io::offchain::is_validator() == true
That has to be done manually for now - off-chain worker has full
state access so it can inspect the Events in frame_system and only
run in case some specific one is there. I believe there are some
examples in substrate-recipies repo fo that.
More information here: Role of off-chain workers

Azure EventHub / Azure Monitoring - Create alert when incoming bytes exceed outgoing bytes, preferrably by a certain amount?

I want to know when my consumer group fails to handle the amount of events coming in into EventHub. Looking at the metrics, I think the symptom is incoming bytes exceed outgoing bytes.
In Azure portal, I only see alert condition when incoming bytes greater than a static number, which is not what I want. Is it even possible to set up condition like this?
I have checked Azure Monitor docs and alerts don't seem to support metric comparison.
One solution might be to create an Azure Logic App which can store and remember incoming/outgoing byte values and then compare them on a scheduled basis.
For variable support you can look at - https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-create-variables-store-values

How many Tasks can I add to a Chilkat Task Chain?

How many Tasks can I add to a Task Chain? I'm using the ActiveX component.
Specifically I'm adding emails using MailMan.SendMailAsync and will have thousands of emails queued.
Theoretically there is no limit, other than eventual memory limitations.
In any case, I wouldn't recommend it as a solution for sending thousands of emails. The reason is that here is no good way to handle external problems that may occur midway in the sending process, such as network or mail server problems.
A better and more scalable approach might be to write all the .eml files to a directory. You could write code to do the following until the "mail queue directory" is empty.
Select a .eml in the directory.
Load it into a Chilkat Email object.
Send the email using Chilkat MailMan via the SendEmail or SendEmailAsync method.
If your programming language allows you to create background threads, then you could create N threads, each with its own MailMan object that does the above. You would want to control/synchronize access to .eml files in some way to ensure that no two threads simultaneously choose the same .eml file. Also, N would limited to the number of connections from the same IP an SMTP server might allow.
If you're sending the same email to each recipient, or the same email template with replacements, then there's no need to actually write the full email for every recipient ahead of time. You could just manage the list, and for each subsequent email just update it with a new To/CC/BCC address (taking care to clear the To/CC/BCC email addresses from the Email object prior to calling AddTo/AddCc/AddBcc to add the new email address, otherwise the recipient list in the email grows with each iteration), do subject/body string replacements, etc. and send.

Sending SMS and email to 100000 members in django-mysql envrionment

I am having a real headache on how to handle this one. Basically, the application got members that are projected to reach one million at the end of the year. It relies heavily on USSD but also have email. Actually for now, I would prefer to send the SMS first.
The issue is this: the members have groups based on their activities and a single member can have multiple groups. Currently, the highest number of members in a group is 17,000.00. The group can basically send SMS to those 17,000 members. The group leaders specify paramters ("All Members","Females","Age 24-28" etc) and send the SMS, which must save a copy in the database. Currently, there are 5 active groups but they will certainly increase in the future and they can all request to broadcast SMS to members at once.
The phone numbers of members is kept in:
class Profile(model.Models):
user=models.ForeignKey(User)
phone=models.CharField(max_length=13)
Similarly, the app should basically scan the member profiles to send them period notifications. For now, I am following the following:
Select the phone numbers of all members that satisfy the criteria
Create an id for the broadcast and wait for previously stacked SMS requests to finish. Then add the selected phones to a secondary table referencing to the broadcast
Loop through each phone and send one by one. Once finished, mark the broadcast as finished
class BroadCast(models.Model):
code=models.CharField(max_length=50) #rand generated
group=models.ForeignKey(Corporate)
finished=models.IntegerField(default=0)
message=models.CharField(max_length=200)
class Phone(models.Model):
broadcast=models.ForeignKey(BroadCast)
But am disappointed by its performance especially for multiple requests. What can i do to improve it?
I am using twilio paid SMS.
tele=models.CharField(max_length=13)
I had an sms application before that had scaled and slowed down when the user base was large, to fix that we used queue for the sms sending task. Worked wonders and should also work perfectly in your case.

Accepting Bitcoin - monitoring transactions coming in

I want to accept Bitcoin on my site. I assign each incoming sale a Bitcoin public key/address from a pool of non-used addresses.
I add records to the pool of non-used addresses by generating 1000 receiving addresses on a separate computer using MultiBit and then importing them into the table. I do this as often as I need when I am running out of addresses.
My question is this:
What is the best way or API (and most simple, that does not require bitcoind installation?!) to monitor incoming deposits to a list of addresses to which I don't have public keys for? Basically I would need a cron to check for incoming transactions to these addresses so I can detect payment acceptance.
If you use btc.blocker.io's API you can find the balance of any address use the url like so
http://btc.blockr.io/api/v1/address/info/PublicAdressGoesHere
It will have an outcome something close to this
{"status":"success","data":{"address":"198aMn6ZYAczwrE5NvNTUMyJ5qkfy4g3Hi","is_unknown":false,"balance":8000.00176957,"balance_multisig":0,"totalreceived":8000.00176957,"nb_txs":30,"first_tx":{"time_utc":"2009-02-22T10:50:53Z","tx":"0f0fbcc18fd0d090ad3402574df8404cec1176bc000f9aa0dc19f8d832ff94db","block_nb":"5219","value":400,"confirmations":385428},"last_tx":{"time_utc":"2015-11-25T00:47:46Z","tx":"77bfb2a8098508646980195c7885baf710c1b30b83cfb7432c6de01a1afe1bc7","block_nb":"385201","value":0.000135,"confirmations":5446},"is_valid":true},"code":200,"message":""}
if you want to read the data in python try using this code. It will out put the data into a file called data.txt And it takes data in from a file called address.txt. only do one address at a time
import urllib2.urlopen
with open("address.txt","r") as file:
address = str(file.read())
data = urllib2.urlopen("http://btc.blockr.io/api/v1/address/info/" + address)
with open("data.txt", "w") as a:
a.write(str(data.read()))
hope this helps!