idea


SUBMITTED BY: PimpDaddy

DATE: Feb. 27, 2023, 12:57 p.m.

FORMAT: Text only

SIZE: 2.0 kB

HITS: 133

  1. <?php
  2. // Define Millix DAG node endpoints
  3. define('MILLIX_NODE_1', 'http://node1.millix.org:8080');
  4. define('MILLIX_NODE_2', 'http://node2.millix.org:8080');
  5. // Define Millix DAG transaction fee
  6. define('MILLIX_TX_FEE', 0.0001);
  7. // Define your Millix address where you want to receive payments
  8. define('YOUR_MILLIX_ADDRESS', '15vu8ndbG8okHHUyXsy4T2A8DwHESQxjiB0a015vu8ndbG8okHHUyXsy4T2A8DwHESQxjiB');
  9. // Define the song that you want to play
  10. define('SONG_NAME', 'D.G.A.D (Radio Edit)');
  11. // Define the amount of Millix you want to earn per play
  12. define('MILLIX_PER_PLAY', 0.01);
  13. // Connect to a random Millix DAG node
  14. $node = (rand(0, 1) == 0) ? MILLIX_NODE_1 : MILLIX_NODE_2;
  15. // Create a new Millix transaction for the song play
  16. $tx = array(
  17. 'inputs' => array(
  18. array(
  19. 'address' => YOUR_MILLIX_ADDRESS,
  20. 'amount' => MILLIX_TX_FEE,
  21. ),
  22. ),
  23. 'outputs' => array(
  24. array(
  25. 'address' => YOUR_MILLIX_ADDRESS,
  26. 'amount' => MILLIX_PER_PLAY,
  27. ),
  28. ),
  29. 'data' => SONG_NAME,
  30. );
  31. // Sign the transaction with your Millix private key
  32. // (not shown here for security reasons)
  33. // Broadcast the transaction to the Millix DAG network
  34. $ch = curl_init($node.'/api/transactions');
  35. curl_setopt($ch, CURLOPT_POST, 1);
  36. curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($tx));
  37. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
  38. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  39. $response = curl_exec($ch);
  40. curl_close($ch);
  41. // Check if the transaction was successfully broadcasted
  42. if ($response === false) {
  43. echo 'Error: Failed to broadcast Millix transaction to DAG network';
  44. } else {
  45. $result = json_decode($response, true);
  46. if ($result['success']) {
  47. echo 'Success: Millix transaction for song play broadcasted to DAG network';
  48. } else {
  49. echo 'Error: Failed to broadcast Millix transaction to DAG network: '.$result['error'];
  50. }
  51. }

comments powered by Disqus