Code Monkey home page Code Monkey logo

Comments (8)

mehcode avatar mehcode commented on June 18, 2024
  1. When a transaction is executed, the pubKeyPrefix needs to reduced as much as possible without losing the original pubKeyPrefix.

  2. Hedera can return with PUBLIC_KEY_PREFIX_MISMATCH that means that there are some hidden keys that need accounting for (e.g., there is a threshold key in play somewhere). When this happens, we need to undo the prefix compression and re-send.

from hedera-sdk-java.

lbaird avatar lbaird commented on June 18, 2024

from hedera-sdk-java.

gregscullard avatar gregscullard commented on June 18, 2024

from hedera-sdk-java.

lbaird avatar lbaird commented on June 18, 2024

from hedera-sdk-java.

suraj21090 avatar suraj21090 commented on June 18, 2024

A feature of the next version of HAPI is signatureMaps to replace the old method of providing signatures to a transaction.
Not only is the signatureMap much easier to use being a flat list of public key + signature compared to the hierarchical lists of old, it is possible to reduce the public keys provided in the map to the bare minimum required to uniquely identify them, it's even possible to leave the public key blank/null if there is only one key on an account/file. This causes a potential problem in multi-signature scenarios.

-User 1 creates and signs a transaction, sends it to user 2
-User 2 signs the transaction and submits to the network

If the transaction created by user 1 has had its public key reduced, it will potentially be null. When user 2 signs the transaction, it's no longer possible to ensure the public key reduction will result in uniquely identifiable keys.

When a transaction payload is created and signed, the full public keys should be included in the signatureMap.
Only when the transaction is sent to Hedera should the public keys be reduced.

hello guys, hello guys, when was i created my contract id so it return com.hedera.hashgraph.sdk.HederaException: INSUFFICIENT_PAYER_BALANCE exception but i have balance in my operatorId is 112654452727 .can anyone please tell me what is a problem behind this.

public class ContractService {

@Autowired
private HederaHelperClass hederaHelperClass;

@Autowired
private ContractRepository contractRepository;

final Logger LOGGER = LoggerFactory.getLogger(ContractService.class);

public Contract createContract() throws HederaException {
Ed25519PrivateKey operatorKey =Ed25519PrivateKey.fromString(hederaHelperClass.getOpreatorKey());
AccountId operatorId =AccountId.fromString(hederaHelperClass.getOperatorId());
var client = hederaHelperClass.hederaClientSetup();
client.setMaxTransactionFee(Long.MAX_VALUE);

   Long balance =client.getAccountBalance(operatorId);
   LOGGER.info("balance===================>{}",balance);

   String byteCodeHex =hederaHelperClass.getByteCode();
   byte[] byteCode = byteCodeHex.getBytes();

   FileCreateTransaction fileTx = new FileCreateTransaction(client).setExpirationTime(
           Instant.now()
                   .plus(Duration.ofSeconds(7890000)))
           // Use the same key as the operator to "own" this file
           .addKey(operatorKey.getPublicKey())
           .setContents(byteCode)
           .setTransactionFee(2_000_000_000)
           ;

   TransactionReceipt fileReceipt = fileTx.executeForReceipt();
   FileId newFileId = fileReceipt.getFileId();

   LOGGER.info("contract bytecode file============================>{} " , newFileId);


   var contractTx = new ContractCreateTransaction(client).setBytecodeFile(newFileId)
           .setAutoRenewPeriod(Duration.ofHours(1))
           .setGas(100_000_000)
           .setTransactionFee(1_330_000_000)
           .setConstructorParams(
                   CallParams.constructor()
                           .addString("hello from hedera!"));

   var contractReceipt = contractTx.executeForReceipt();
   var newContractId = contractReceipt.getContractId();

// TransactionReceipt contractReceipt = contractTx.executeForReceipt();
// ContractId newContractId = contractReceipt.getContractId();

   System.out.println("new contract ID: " + newContractId);
   LOGGER.info("new contract id==========================>",newContractId);

from hedera-sdk-java.

suraj21090 avatar suraj21090 commented on June 18, 2024

2019-10-18 18:14:49.857 INFO 21274 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-10-18 18:14:49.862 INFO 21274 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-10-18 18:14:49.900 INFO 21274 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 37 ms
0.0.3
{0.0.3=0.testnet.hedera.com:50211, 0.0.4=1.testnet.hedera.com:50211, 0.0.5=2.testnet.hedera.com:50211, 0.0.6=3.testnet.hedera.com:50211}
hedera client value com.hedera.hashgraph.sdk.Client@17cc23b7
2019-10-18 18:14:53.068 INFO 21274 --- [nio-8080-exec-1] c.p.H.service.ContractService : balance===================>112654452727
2019-10-18 18:14:54.700 INFO 21274 --- [nio-8080-exec-1] c.p.H.service.ContractService : contract bytecode file============================>0.0.113964
2019-10-18 18:14:55.013 ERROR 21274 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.hedera.hashgraph.sdk.HederaException: INSUFFICIENT_PAYER_BALANCE] with root cause

com.hedera.hashgraph.sdk.HederaException: INSUFFICIENT_PAYER_BALANCE
at com.hedera.hashgraph.sdk.HederaException.throwIfExceptional(HederaException.java:38) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.HederaException.throwIfExceptional(HederaException.java:33) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.Transaction.mapResponse(Transaction.java:193) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.Transaction.mapResponse(Transaction.java:37) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.HederaCall.execute(HederaCall.java:52) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.Transaction.executeAndWaitFor(Transaction.java:203) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.Transaction.executeForReceipt(Transaction.java:265) ~[sdk-0.7.0.jar:na]
at com.hedera.hashgraph.sdk.TransactionBuilder.executeForReceipt(TransactionBuilder.java:178) ~[sdk-0.7.0.jar:na]
at com.phicoin.HederaService.service.ContractService.createContract(ContractService.java:70) ~[classes/:na]
at com.phicoin.HederaService.controller.ContractController.addNewContract(ContractController.java:26) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) ~[spring-web-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1589) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-9.0.26.jar:9.0.26]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]

from hedera-sdk-java.

lbaird avatar lbaird commented on June 18, 2024

from hedera-sdk-java.

mehcode avatar mehcode commented on June 18, 2024

This cannot be generically done from the SDK so I'm going to close this out.

from hedera-sdk-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.