How to retrive past transaction values or data from the ethereum contract?

I have made one contract where I have taken a string name. I have updated this string name three times. 1st – Mike 2nd – Ronaldo 3rd – Tyson

Now, I want to extract past or old transaction data from ganache-cli. I am able to extract the recent name “Tyson” but I want to extract previous data which was stored in ethereum.

I tried using web3.getaTransaction(), I am getting everything like a nonce, block number, but data is in encrypted form.

Can anyone please suggest me, how to retrieve the older transaction data?

Spring boot, JDBC Не работает откат изменений в аннотированном @Transaction методе

Пишу REST сервис из контроллера вызывается Сервис В методе сервиса помеченого @Transactional проиходят такие действия: 1.вызывается метод объекта DAO для получения контента 2. после идет проверка условия, 3.потом делается апдейт в базу данных (markAnsweredQuestion()) 4. далее через метод объекта DAO делается запрос на получение контента (getPositiveMessage() в этом месте происходит ошибка). Если последний пункт не выполняется, все равно update в базу происходит, а должен произойти откат изменений, не могу понять почему не проиходит отката изменений. QuestionService.class

@Service public class QuestionService implements IContentService {  /** Компонент для работы с базой данных */ private QuestionDao questionDao;  private Log log;  /** Конструктор класса */ public QuestionService(QuestionDao questionDao, Log log) {     this.questionDao = questionDao;     this.log = log; }  /**  * Проверка ответа на вопрос  * @param contentType тип контента  * @param questionNum номер ответа  * @param answer      номер ответа  * @return Контент позитивного сообщения  * @throws InvalidAnswerException Ошибка что ответ дан не верно  */ @Transactional(rollbackFor = CoreException.class) public Content checkAnswer(String contentType, int questionNum, Answer answer) throws SQLException, InvalidAnswerException {     Content question = questionDao.getContent(ContentType.QUESTION, questionNum);     boolean isCorrect = checkCurrentAnswer(question, answer);     if (!isCorrect) {         InvalidAnswerException exception = new InvalidAnswerException(questionNum, "Не правильно, Попробуй еще раз, малышка");         log.error("Неверный ответ.", exception);         throw exception;     }     questionDao.markAnsweredQuestion(questionNum);     return questionDao.getPositiveMessage(answer.getAnswer()); }  /**  * Сравнивает id ответа на вопрос и id корректного ответа  * @param questionContent контент вопроса  * @param answer          ответ пользователя  * @return true если ответ верный, false если неверный  */ private boolean checkCurrentAnswer(Content questionContent, Answer answer) {     Question question = (Question) questionContent.getContent();     return question.getCurrentAnswer() == answer.getAnswer(); } 


@Component public class QuestionDao {  /**  * Конструктор класса  * @param log Логгер  */ public QuestionDao(Log log) {     this.log = log; }  /**  * Инициализация подключения к базе данных  * @throws SQLException            Ошибки работы с базой данных  * @throws ClassNotFoundException  Ошибка драйвера h2.Driver  */ @PostConstruct public void initConnection() throws SQLException, ClassNotFoundException {     Class.forName(JDBC_DRIVER);     connection = DriverManager.getConnection(DATA_BASE_URL, USER_NAME, PASSWORD);     log.warn("Connected: " + connection.getCatalog()); }  /**  * Проверяется правильностть ответа на вопрос  * @param answerNum   номер ответа  * @return Сообщение пользователю  * @throws SQLException Ошибка работы с базой данных  * @throws InvalidAnswerException Ошибка, что был дан неправилльный ответ  */ @SuppressWarnings("unchecked") public Content getPositiveMessage(int answerNum) throws SQLException {     Content content = new Content();     PreparedStatement prstmt = connection.prepareStatement(GET_POSITIVE_MESSAGE_QUERY);     prstmt.setInt(1, answerNum);     ResultSet messageResult = prstmt.executeQuery();     if ( {         Message message = buildMessage(messageResult);         content.setContent(message);         return content;     }     throw new CoreException("Ошибкка работы с базой данных"); }  public void markAnsweredQuestion(int questionId) throws SQLException {     PreparedStatement prstmt = connection.prepareStatement(MARK_ANSWERED_QUESTION);     prstmt.setInt(1, questionId);     prstmt.executeUpdate(); } 

Main class

@SpringBootApplication @EnableTransactionManagement @EnableAspectJAutoProxy public class QuestionServiceApplication {  public static void main(String[] args) {, args);  } } 

What data is transmitted by a credit card booking / security transaction (country & address)?

I was recently asked if a credit card security / booking (Not sure what it is called. It is the method where no money is transferred and the credit card company just pays in case the company notifies them that no money was received) could help to lock out malicious users.

The idea is to ask the users for a booking when registering and then every year again. No money is ever withdrawn. The purpose is just to get a valid address (or at least the country of residence). Is this kind of data transmitted to the “shop”?

How SQL Server transaction works with log records

My textbook says:

Starting when you begin a transaction, your changes are isolated from other users. What you’re doing is visible to you only,and isn’t really done until you COMMIT — although it looks real to you, only you can see that result. Anyone else attempting to look, they could see the old value, or if they’re daring they could get a dirty read.

I am confused, so I will use a picture below to raise some questions: enter image description here and the t-sql code is

BEGIN TRAN UPDATE checking  SET Balance = Balance - 1000  WHERE Account = 'Sally'    // original balance is 2000 --------------a checkpoint occurs --------- UPDATE savings  SET Balance = Balance + 1000  WHERE Account = 'Sally' COMMIT TRAN 

and we know that a new log record describing the COMMIT will only be created in the log buffer after ‘COMMIT TRAN’ has been executed.

Q1- Why the result is only visible for me before COMMIT? let’s say a checkpoint happens after checking for sally has been minus -1000, and let’s the the updated record is in page 4(in memory), since it hasn’t been commit yet, so there won’t be a log record in the log buffer, therefore there won’t be a corresponding log record in disk(.ldf), but the cache page 4 will be written to disk (.mdf), so sin’t that any user can see the latest change for the record?

Q2-How transaction control maintains atomicity in this case?

As I have discussed, when the checkpoint happens, page 4(in cache, and the containing record’s latest balance value: 1000) will be written to disk, and if there is a system failure immediately. After SQL server restarts, how does it know how to restore the record’s balance(currently 1000) back to its original value(balance is 2000), since there is no log record in .ldf file?

How to export Transaction ID and Credit Card Approval to CSV

I’ve been writing a script that exports a CSV into a directory. The CSV contains the information of the order, once the order has been made. The issue i’m having is exporting the information for transaction ID and CC Approval. Does anyone have any idea on how to gather that information?

Below you can see the two vars that are trying to gather the information $ paymentId and $ paymentApproval

public function sales_order_place_after($  observer) {     $  order = $  observer->getEvent()->getOrder();     $  quote_id = $  order->getQuoteId();      $  orderId = $  order->getEntityId();     $  order = Mage::getModel('sales/order')->load($  orderId);      $  text = "";     $  fp = fopen('hide/directory/for/question' . $  order->getIncrementId() . '.txt', 'w');      // billing info     $  billingAddress = $  order->getBillingAddress();     $  countryCode = $  billingAddress->getCountryId();     $  country = Mage::getModel('directory/country')->loadByCode($  countryCode);     $  countryName = $  country->getName();      //ship to billing info     $  shippingAddress = $  order->getShippingAddress();     $  shippingAddressCountryCode = $  shippingAddress->getCountryId();     $  shippingAddressCountry = Mage::getModel('directory/country')->loadByCode($  shippingAddressCountryCode);     $  shippingAddressCountryName = $  shippingAddressCountry->getName();      $  query = "Collect";     $  shippingDescription = $  order->getShippingDescription();     if (substr($  shippingDescription, 0, strlen($  query)) !== $  query) {         $  shippingCode = "PPD";         $  shippingAgentCode = "UPS";         $  shippingServiceCode = explode(" - UPS ", $  shippingDescription)[1];         $  carrierAccountNumber = "";         $  shippingAmount = $  shippingAddress->getShippingAmount();     } else {         // Shipping info         $  shippingCode = "COL";         $  shippingAgentCode = "";         $  shippingServiceCode = "";          $  order_id = $  order->getId();          $  carrierAccountNumber = Mage::getSingleton('checkout/session')->getCollectmemoComment();         $  carrierAccountNumber = $  carrierAccountNumber[$  quote_id];         $  shippingAmount = 0;     }      //Order Info     $  orderDate = $  order->getCreatedAt();     $  orderDateToShow = date('n/j/Y',strtotime($  orderDate));       // Transaction Info     $  orderTransactionDateTime = date('n/j/Y h:i:s A',strtotime($  orderDate));      // Account INfo     $  userEmail = $  order->getCustomerEmail();      // Payment info     $  payment = $  order->getPayment();     $  paymentCcType = $  payment->getData('cc_type');     $  paymentPoNumber = $  payment->getData('po_number');     $  paymentPoComment = $  payment->getData('po_comment');     $  paymentIdTwo = $  payment->getCcTransId();     $  poRefferenceNumber = $  payment->getData('po_ref_number');        $  paymentId = $  payment->getCcTransId();     // $  paymentId = $  payment->getData('cc_trans_id');      $  paymentApproval = $  payment->getData('cc_approval');     // $  paymentApproval = $  payment->getCcApproval();       $  paymentCcStatus = "";       if ($  paymentPoNumber != "" ) {         $  paymentCcStatus;     } else {         $  paymentCcStatus = "Approved";       }      if ($  paymentCcType == "VI") {         $  paymentCcType = "Visa";     } else if ($  paymentCcType == "MC") {         $  paymentCcType = "MasterCard";     } else if ($  paymentCcType == "AE") {         $  paymentCcType = "American Express";     } else if ($  paymentCcType == "DI") {         $  paymentCcType = "Discover";     }      $  item_incrementer = 1;     foreach ($  order->getAllItems() as $  itemId => $  item) {         $  fields = array($  billingAddress->getCompany(), $  billingAddress->getFirstname(), $  billingAddress->getMiddlename(), $  billingAddress->getLastname(), $  billingAddress->getStreet(1), $  billingAddress->getStreet(2), $  billingAddress->getCity(), $  billingAddress->getRegion(), $  billingAddress->getPostcode(), $  countryName, $  billingAddress->getTelephone(), $  userEmail ,$  shippingAddress->getCompany(), $  shippingAddress->getFirstname(), $  shippingAddress->getMiddlename(), $  shippingAddress->getLastname(), $  shippingAddress->getStreet(1), $  shippingAddress->getStreet(2), $  shippingAddress->getCity(), $  shippingAddress->getRegion(), $  shippingAddress->getPostcode(), $  shippingAddressCountryName, $  shippingAddress->getTelephone(), $  shippingCode, $  shippingAgentCode, $  shippingServiceCode, $  carrierAccountNumber, $  order->getShippingAmount(), $  paymentPoNumber, $  paymentPoComment, $  poRefferenceNumber, $  order->getIncrementId(), $  orderDateToShow, $  paymentCcStatus, $  paymentCcType, $  paymentApproval, $  paymentId, $  paymentIdTwo ,$  order->getGrandTotal(), $  orderTransactionDateTime,  $  item_incrementer, $  item->getSku(), $  item->getQtyOrdered(), $  item->getPrice() );           // echo '<pre>' , var_dump($  fields) , '</pre>';          $  field_incrementer = 0;         foreach($  fields as $  field ) {             if ($  field_incrementer > 0) {                 $  text .= "\t";             }             $  text .= $  field;              $  field_incrementer++;         }          $  text .= "\r\n";          $  item_incrementer++;     }      fwrite($  fp, $  text) ;      fclose($  fp); } 

Best practice for transaction handling using Entity Framework

I am developing an app which uses Entity Framework for data access. The architecture of the app somewhat like below:

enter image description here

As depicted in the drawing, the business service can be consumed from either web app, cli app or windows service. What I’m trying to design is, each service request should be performed in a single transaction. I’m using dependency injection to inject services to web api controllers. If I use request scoped dbcontext using DI container, it’ll do the job for web api, but won’t work for service requests coming directly from CLI app or windows services.

What are best practices used to handle service level transactions with Entity Framework?


// Services public class UserService {     private TaskService _taskService;     private UserRepository _userRepository;      public UserService(TaskService taskService, UserRepository userRepository)     {         this._taskService = taskService;         this._userRepository = userRepository;     }      public void MarkInactive(int userId)     {         this._taskService.CloseAllPendingTasks(userId);         this._userRepository.MarkInactive(userId);     } }  public class TaskService {     public void CloseAllPendingTasks(int userId)     {         ...     } }  // Consumer // Scenario 1: this._taskService.CloseAllPendingTasks(1);  // Scenario 2: this._userService.MarkInactive(2); 

In above example, In case of Scenario 1, task service should create new transaction for the operation. While in Scenario 2, user service should create a transaction and task service should join the already open transaction.

Transaction discrepancy between Google Analytics and Woocommerce

Hey guys!

I am currently experiencing a 25% discrepancy between the numbers reported in Google Analytics and those reported in Woocommerce backend and don't know the cause of it. I have read many articles (ie: Google Analytics and Woocommerce transaction mismatch, etc) but so far I haven't been able to fix my problem and Google Analytics is still reporting 25%…

Transaction discrepancy between Google Analytics and Woocommerce

Is it possible to verify the requesting user for a REST transaction secured by JWT at a later date?

I have a React (Javascript) single-page application that authenticates users via username/password/MFA to Keycloak, receives a signed JWT upon successful authentication, and then uses that JWT to call stateless/session-less REST services.

With this setup, or with additional “moving parts” to be added to the overall system, is there a way to at a later date to assert that a certain user identity was responsible for a transaction? Assume that we are able to store any/all data that is in-context (i.e., is part of the REST call for the transaction) at the time the transaction is requested.

Thanks to @alnbhclyn for their thoughts below. I think I need to clarify — the key gap above seems to be the link between a JWT and the specific contents of a transaction. Is there a means of “signing” the transaction with the JWT or some part thereof such that a positive link between the two can be made at any point in the future?

About to find the maximum sum of transaction within a time window period

I received hundreds of transactions within one week. Each transaction has amount. I’d like to create an algorithm to find the maximum amount within 24 hour time window period. I know how to do that by creating a nested loop. But I am looking for a better performance algorithm such as n*Log(n) time complexity.

For example, the transaction data looks like:

[  {'05-05-2019:10.00.00', 100},  {'05-05-2019:11.00.00', 100}, {'05-05-2019:12.00.00', 100}, {'05-06-2019:10.00.00', 100},  {'05-06-2019:11.00.00', 100}, {'05-07-2019:10.30.00', 100}  ] 

For the above data, there are 6 transactions across 2 days. When calculate the 24 hours period time of transactions, there are 4 time period. The first three transactions happens within 24 hours which has a total amount as 300. The second time period includes three transactions, 2ed, 3rd and 4th which has a total of 300 amount. The third time period is 3rd, 4th and 5th has 300 amount. The fourth time period is 4th and 5th which is 200. The last time period is the last two which is 200. So the maximum amount is 300.

How much data does it take to prove a given transaction exists on the blockchain?

As I understand the SVP protocol, a client can be reasonably certain that a transaction has been accepted on the blockchain if they know it is a member of a certain block, via the Merkle path, and a reasonable number of blocks have been mined on top of that block.

How much total data would that be, roughly? I guess if you were beginning with 0 knowledge, you would need all of the block headers, beginning from the genesis block? But once you are convinced you are looking at the head of the right chain, you could discard all of the ancient block headers, and just save a recent one as a trusted starting point to evaluate subsequent transactions?

I guess the premise of my question is faulty, as a fake transaction could always be embedded in a fake chain, if enough computing resources were available. So, there is no amount of data that insures a transaction is valid, without access to other information, e.g., what is the longest chain currently in existence.

A better question for my purposes would be how much would the electricity cost to create one fake block header at today’s difficulty level? Figuring that blockchain currently pays around $ 60K to mine one block, I would guess it must be in that order of magnitude, though smaller since we are removing the race condition.