Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create transaction example #915

Open
tcolonel opened this issue Jan 22, 2024 · 0 comments
Open

Create transaction example #915

tcolonel opened this issue Jan 22, 2024 · 0 comments

Comments

@tcolonel
Copy link

tcolonel commented Jan 22, 2024

Hello.

Could you write an example of creating a transaction, signing it, and obtaining a transaction hash that can be sent further - having:

  • only with private key
  • only private key in WIF format

So I don't know nothing about prev tx and so on. I have only private key in diff formats which I get from:

private function generateWallet()
{
    $oPrivateKeyFactory = new PrivateKeyFactory();
    $oRandom = new Random();
    $this->sPrivateKey = $oPrivateKeyFactory->generateCompressed($oRandom);
    $this->sPrivateKeyWif = $this->sPrivateKey->toWif();
    $this->sPublicKey = $this->sPrivateKey->getPublicKey();
    $sPublicKeyHash = $this->sPublicKey->getPubKeyHash();
    $oAddress = new PayToPubKeyHashAddress($sPublicKeyHash);
    $this->sAddress = $oAddress->getAddress($this->oNetwork);
    $oSegwitAddress = new SegwitAddress(WitnessProgram::v0($sPublicKeyHash));
    $this->sSegwitAddress = $oSegwitAddress->getAddress();
}

I read these links and many others, but they didn't help me:

I need a simple solution: received the keys, the address, created a transaction, signed, sent (I know that I a not empty balance).

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant